Bug 62945 - REGRESSION: GitTestWithMock.test_create_patch fails
Summary: REGRESSION: GitTestWithMock.test_create_patch fails
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Seidel (no email)
Keywords: Regression
Depends on:
Reported: 2011-06-18 16:58 PDT by Daniel Bates
Modified: 2011-07-13 18:03 PDT (History)
3 users (show)

See Also:

Patch (7.79 KB, patch)
2011-07-13 17:56 PDT, Eric Seidel (no email)
dbates: review+
dbates: commit-queue+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2011-06-18 16:58:59 PDT
When I ran test-webkitpy --all today, webkitpy.common.checkout.scm.scm_unittest.GitTestWithMock.test_create_patch failed with:

Traceback (most recent call last):
  File "/Users/dbates/Desktop/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py", line 1454, in setUp
    self.scm = Git(None, executive=executive)
  File "/Users/dbates/Desktop/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py", line 55, in __init__
    SCM.__init__(self, cwd, executive)
  File "/Users/dbates/Desktop/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm.py", line 66, in __init__
    self.checkout_root = self.find_checkout_root(self.cwd)
  File "/Users/dbates/Desktop/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py", line 96, in find_checkout_root
    (checkout_root, dot_git) = os.path.split(run_command(['git', 'rev-parse', '--git-dir'], cwd=(path or "./")))
  File "/Users/dbates/Desktop/WebKit/Tools/Scripts/webkitpy/common/system/executive.py", line 102, in run_command
    return Executive().run_command(*args, **kwargs)
  File "/Users/dbates/Desktop/WebKit/Tools/Scripts/webkitpy/common/system/executive.py", line 403, in run_command
    (error_handler or self.default_error_handler)(script_error)
  File "/Users/dbates/Desktop/WebKit/Tools/Scripts/webkitpy/common/system/executive.py", line 322, in default_error_handler
    raise error
ScriptError: Failed to run "[u'git', u'rev-parse', u'--git-dir']" exit_code: 128 cwd: ./
Comment 1 Daniel Bates 2011-06-18 17:21:26 PDT
From briefly looking into this it, find_checkout_root() doesn't use the Executive object passed into SCM.__init__(). Instead, it calls the global run_command() (defined in Executive.py) which instantiates its own Executive. So the mock executive object we pass to the Git constructor in  GitTestWithMock.setUp() isn't being used. Hence, find_checkout_root() actually tries to run the git command, which fails since the current working directory isn't a git repository.
Comment 2 Eric Seidel (no email) 2011-07-13 17:56:49 PDT
Created attachment 100742 [details]
Comment 3 Daniel Bates 2011-07-13 17:59:19 PDT
Comment on attachment 100742 [details]

Comment 4 Eric Seidel (no email) 2011-07-13 18:03:11 PDT
Committed r90967: <http://trac.webkit.org/changeset/90967>