Bug 38775 - rebaseline-chromium-webkit-tests doesn't do diffs right with a Git checkout of WebKit
Summary: rebaseline-chromium-webkit-tests doesn't do diffs right with a Git checkout o...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-07 14:20 PDT by Dirk Pranke
Modified: 2010-07-01 01:15 PDT (History)
7 users (show)

See Also:


Attachments
Patch (1.81 KB, patch)
2010-05-07 15:53 PDT, Dirk Pranke
no flags Details | Formatted Diff | Diff
patch v0 (9.62 KB, patch)
2010-06-28 02:11 PDT, Hajime Morrita
no flags Details | Formatted Diff | Diff
patch v1 (10.28 KB, patch)
2010-06-28 22:13 PDT, Hajime Morrita
no flags Details | Formatted Diff | Diff
patch v2 (11.71 KB, patch)
2010-06-30 22:45 PDT, Hajime Morrita
no flags Details | Formatted Diff | Diff
patch v2.1; fixed style violation (11.69 KB, patch)
2010-06-30 22:52 PDT, Hajime Morrita
no flags Details | Formatted Diff | Diff
patch v3; removed redundant options (11.33 KB, patch)
2010-06-30 23:20 PDT, Hajime Morrita
hamaji: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Pranke 2010-05-07 14:20:37 PDT
if you run rebaseline-chromium-webkit-tests using a Git checkout of WebKit, it can't produce the correct results.html file to show the diffs - it assumes you can do an 'svn cat' of the old -expected file.

See

http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py#L697

in particular around line 719.
Comment 1 Adam Barth 2010-05-07 15:47:13 PDT
This script should use scm.py to abstract away the differences between svn and git to avoid this entire class of bugs instead of re-inventing scmy.py as it does now.
Comment 2 Dirk Pranke 2010-05-07 15:53:16 PDT
Created attachment 55425 [details]
Patch
Comment 3 Dirk Pranke 2010-05-07 15:55:04 PDT
here's a minimal patch to make things work in Git; we should really abstract all the SCM stuff out though. There's probably code already written to do this.

Also, we should diff the two files directly rather using the port routines rather than using svn diff. Haven't made that change yet.
Comment 4 Dirk Pranke 2010-05-07 15:55:29 PDT
whoops; didn't see Adam's comment, but I agree completely.
Comment 5 Victor Wang 2010-05-07 16:04:24 PDT
(In reply to comment #4)
> whoops; didn't see Adam's comment, but I agree completely.

Agreed. There are a couple of things I like to refactor the rebaseline tool after it has been upstreamed. Working with git (the tool only works with svn when it was written last year) is one item on the list, other items like better summarized messages, better working with the upstream infrastructure (port, multiple test_expectations etc). I have some other tasks on my Q2 list, but should be able to get into this in later Q2 or earlier Q3.
Comment 6 Hajime Morrita 2010-06-28 02:11:40 PDT
Created attachment 59887 [details]
patch v0
Comment 7 Hajime Morrita 2010-06-28 02:13:25 PDT
As we introduce SCM abstraction to rebaseline_chromium_webkit_test,
now we can replace diff and cat with them. Here is an attempt.
Comment 8 Victor Wang 2010-06-28 08:42:08 PDT
Comment on attachment 59887 [details]
patch v0

WebKitTools/Scripts/webkitpy/common/checkout/scm.py:441
 +              self._bogus_dir = os.path.join(parent_dir, "temp_svn_config")
Should _bogus_dir be created for win?

WebKitTools/Scripts/webkitpy/common/checkout/scm.py:462
 +              return self.run(['svn', 'diff', path])
Missing "--config-dir"?

WebKitTools/Scripts/webkitpy/common/checkout/scm.py:467
 +          return self.run(['svn', 'cat', path])
Add "-r BASE" to svn cat?
Comment 9 Hajime Morrita 2010-06-28 22:13:10 PDT
Created attachment 59986 [details]
patch v1
Comment 10 Hajime Morrita 2010-06-28 22:24:45 PDT
Hi Victor, thank you for reviewing!
I updated the patch.

(In reply to comment #8)
> (From update of attachment 59887 [details])
> WebKitTools/Scripts/webkitpy/common/checkout/scm.py:441
>  +              self._bogus_dir = os.path.join(parent_dir, "temp_svn_config")
> Should _bogus_dir be created for win?
Fixed. (I broke the code during copying...)

> 
> WebKitTools/Scripts/webkitpy/common/checkout/scm.py:462
>  +              return self.run(['svn', 'diff', path])
> Missing "--config-dir"?
Fixed.

> 
> WebKitTools/Scripts/webkitpy/common/checkout/scm.py:467
>  +          return self.run(['svn', 'cat', path])
> Add "-r BASE" to svn cat?
Fixed, and added test for SVN.show_head()
Comment 11 Victor Wang 2010-06-30 10:34:43 PDT
Ok to me, you need a reviewer to review this.

(In reply to comment #10)
> Hi Victor, thank you for reviewing!
> I updated the patch.
> 
> (In reply to comment #8)
> > (From update of attachment 59887 [details] [details])
> > WebKitTools/Scripts/webkitpy/common/checkout/scm.py:441
> >  +              self._bogus_dir = os.path.join(parent_dir, "temp_svn_config")
> > Should _bogus_dir be created for win?
> Fixed. (I broke the code during copying...)
> 
> > 
> > WebKitTools/Scripts/webkitpy/common/checkout/scm.py:462
> >  +              return self.run(['svn', 'diff', path])
> > Missing "--config-dir"?
> Fixed.
> 
> > 
> > WebKitTools/Scripts/webkitpy/common/checkout/scm.py:467
> >  +          return self.run(['svn', 'cat', path])
> > Add "-r BASE" to svn cat?
> Fixed, and added test for SVN.show_head()
Comment 12 Shinichiro Hamaji 2010-06-30 19:09:39 PDT
Comment on attachment 59986 [details]
patch v1

Cannot we test diff_for_file?

WebKitTools/Scripts/webkitpy/common/checkout/scm.py:228
 +      def diff_for_file(self, path, optios={}):
Hmm... I'd prefer using keyword arguments for all possible options.

def diff_for_file(self, use_bogus_dir=True, git_cached=True, ...)

so we won't make typo. I think this way is more consistent with other code in this file (see changed_file for example)

By the way, do we really need these options?
Comment 13 Hajime Morrita 2010-06-30 22:45:03 PDT
Created attachment 60197 [details]
patch v2
Comment 14 WebKit Review Bot 2010-06-30 22:47:10 PDT
Attachment 60197 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1
WebKitTools/Scripts/webkitpy/common/checkout/scm.py:433:  trailing whitespace  [pep8/W291] [5]
WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py:1172:  trailing whitespace  [pep8/W291] [5]
WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py:1187:  trailing whitespace  [pep8/W291] [5]
Total errors found: 3 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 15 Shinichiro Hamaji 2010-06-30 22:47:46 PDT
Comment on attachment 60197 [details]
patch v2

WebKitTools/Scripts/webkitpy/common/checkout/scm.py:455
 +      def diff_for_file(self, path, use_bogus_dir=False, log=None, **kwargs):
Still this code allows typo. I'd just remove kwargs.
Comment 16 Hajime Morrita 2010-06-30 22:52:15 PDT
Created attachment 60198 [details]
patch v2.1; fixed style violation
Comment 17 Hajime Morrita 2010-06-30 23:20:26 PDT
Created attachment 60202 [details]
patch v3; removed redundant options
Comment 18 Hajime Morrita 2010-06-30 23:22:15 PDT
Hi Hamaji-san, thank you reviewing again.
I updated the patch.

> Still this code allows typo. I'd just remove kwargs.
Ah, I get what you meant to say.
And I removed options which can be altered by appropriate default behavior.
Comment 19 Shinichiro Hamaji 2010-06-30 23:23:26 PDT
Comment on attachment 60202 [details]
patch v3; removed redundant options

Looks good. Thanks for your update!
Comment 20 Hajime Morrita 2010-07-01 01:15:33 PDT
Committed r62236: <http://trac.webkit.org/changeset/62236>