Bug 169190 - import-w3c-tests doesn't work with svn repositories
Summary: import-w3c-tests doesn't work with svn repositories
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-05 20:00 PST by Sam Weinig
Modified: 2017-03-08 20:23 PST (History)
5 users (show)

See Also:


Attachments
Potential patch (2.14 KB, patch)
2017-03-05 20:47 PST, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (4.11 KB, patch)
2017-03-08 11:11 PST, Sam Weinig
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2017-03-05 20:00:58 PST
Now, I could be totally doing something wrong, but on trying to import the subresource-integrity directory for the web-platform-tests, I could not get get the import-w3c-tests script to work.

I did the following:

> import-w3c-tests web-platform-tests/subresource-integrity

And got:

Downloading W3C test repositories
Traceback (most recent call last):
  File "/Volumes/Data/Code/WebKitSVN/OpenSource/Tools/Scripts/import-w3c-tests", line 35, in <module>
    sys.exit(test_importer.main(sys.argv[1:], sys.stdout, sys.stderr))
  File "/Volumes/Data/Code/WebKitSVN/OpenSource/Tools/Scripts/webkitpy/w3c/test_importer.py", line 99, in main
    test_importer.do_import()
  File "/Volumes/Data/Code/WebKitSVN/OpenSource/Tools/Scripts/webkitpy/w3c/test_importer.py", line 197, in do_import
    self.test_downloader().download_tests(self.source_directory, self.test_paths)
  File "/Volumes/Data/Code/WebKitSVN/OpenSource/Tools/Scripts/webkitpy/w3c/test_downloader.py", line 218, in download_tests
    self.checkout_test_repository(test_repository['revision'], test_repository['url'], self._filesystem.join(self.repository_directory, test_repository['name']))
  File "/Volumes/Data/Code/WebKitSVN/OpenSource/Tools/Scripts/webkitpy/w3c/test_downloader.py", line 81, in checkout_test_repository
    git = self.git('.')
  File "/Volumes/Data/Code/WebKitSVN/OpenSource/Tools/Scripts/webkitpy/w3c/test_downloader.py", line 78, in git
    return Git(test_repository, None, executive=self._host.executive, filesystem=self._filesystem)
  File "/Volumes/Data/Code/WebKitSVN/OpenSource/Tools/Scripts/webkitpy/common/checkout/scm/git.py", line 62, in __init__
    SCM.__init__(self, cwd, **kwargs)
  File "/Volumes/Data/Code/WebKitSVN/OpenSource/Tools/Scripts/webkitpy/common/checkout/scm/scm.py", line 66, in __init__
    self.checkout_root = self.find_checkout_root(self.cwd)
  File "/Volumes/Data/Code/WebKitSVN/OpenSource/Tools/Scripts/webkitpy/common/checkout/scm/git.py", line 120, in find_checkout_root
    checkout_root = self._run_git(['rev-parse', '--show-toplevel'], cwd=(path or "./")).strip()
  File "/Volumes/Data/Code/WebKitSVN/OpenSource/Tools/Scripts/webkitpy/common/checkout/scm/git.py", line 107, in _run_git
    return self.run(full_command_args, **full_kwargs)
  File "/Volumes/Data/Code/WebKitSVN/OpenSource/Tools/Scripts/webkitpy/common/checkout/scm/scm.py", line 77, in run
    decode_output=decode_output)
  File "/Volumes/Data/Code/WebKitSVN/OpenSource/Tools/Scripts/webkitpy/common/system/executive.py", line 459, in run_command
    (error_handler or self.default_error_handler)(script_error)
  File "/Volumes/Data/Code/WebKitSVN/OpenSource/Tools/Scripts/webkitpy/common/system/executive.py", line 377, in default_error_handler
    raise error
webkitpy.common.system.executive.ScriptError: Failed to run "['git', 'rev-parse', '--show-toplevel']" exit_code: 128 cwd: .


I'm not super familiar with the script, but it does seem to be trying to do something with git, which makes sense since the tests are located on github, but the code is actually trying to see if the current directory is a git directory, which I don't understand.
Comment 1 Sam Weinig 2017-03-05 20:47:24 PST
Created attachment 303496 [details]
Potential patch

Attaching a potential patch. This adds a class method to the Git class that allows cloning a repository without an existing git repository. The design of the Git class seems odd, at least for this use case, in that you have to initialize with an path to an existing git repository.
Comment 2 youenn fablet 2017-03-05 22:27:33 PST
Your changes make sense to me, one should not need a git repo to clone another repo.
Also, the downloader code should not use private methods (_run_git at least) of Git instances.
Comment 3 Sam Weinig 2017-03-08 11:11:08 PST
Created attachment 303822 [details]
Patch
Comment 4 WebKit Commit Bot 2017-03-08 20:23:51 PST
Comment on attachment 303822 [details]
Patch

Clearing flags on attachment: 303822

Committed r213625: <http://trac.webkit.org/changeset/213625>
Comment 5 WebKit Commit Bot 2017-03-08 20:23:56 PST
All reviewed patches have been landed.  Closing bug.