Bug 62945

Summary: REGRESSION: GitTestWithMock.test_create_patch fails
Product: WebKit Reporter: Daniel Bates <dbates>
Component: Tools / TestsAssignee: Eric Seidel (no email) <eric>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, eric, webkit.review.bot
Priority: P2 Keywords: Regression
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch dbates: review+, dbates: commit-queue+

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]
Patch
Comment 3 Daniel Bates 2011-07-13 17:59:19 PDT
Comment on attachment 100742 [details]
Patch

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