Bug 56233

Summary: Add --baseline-search-path to NRWT
Product: WebKit Reporter: Mihai Parparita <mihaip>
Component: Tools / TestsAssignee: Mihai Parparita <mihaip>
Status: RESOLVED FIXED    
Severity: Normal CC: dpranke, eric, ojan, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch tony: review+

Description Mihai Parparita 2011-03-11 16:37:09 PST
Add --baseline-search-path to NRWT
Comment 1 Mihai Parparita 2011-03-11 16:38:29 PST
Created attachment 85554 [details]
Patch
Comment 2 Tony Chang 2011-03-11 16:54:38 PST
This is for expectations that aren't going to be checked in?  Why can't we check in the baselines?
Comment 3 Dirk Pranke 2011-03-11 17:12:36 PST
We could check them in, but (a) we expect them to churn pretty frequently and (b) there will probably be a bunch of them, which could make the tree pretty confusing.
Comment 4 Dirk Pranke 2011-03-11 17:13:20 PST
The downside to not checking them in is that we'll need some other way to figure out what the references should be and how to regenerate the baselines. Mihai is working on that separately.
Comment 5 Tony Chang 2011-03-11 17:22:35 PST
Maybe we can use gclient to pull in the other baselines so it doesn't make the webkit tree noisy?
Comment 6 Mihai Parparita 2011-03-21 14:13:04 PDT
(In reply to comment #5)
> Maybe we can use gclient to pull in the other baselines so it doesn't make the webkit tree noisy?

There's going to be enough of these baselines (looks like 100/bot and around 10 bots) that I don't think we can manage them as carefully (i.e. version control). The expectation is that when the hardware bots go red, the GPU gardener will do some spot checks to make sure that the changes are expected and then run the webkit tests with --reset-results, which will update these local baselines.
Comment 7 Tony Chang 2011-03-21 15:28:32 PDT
(In reply to comment #6)
> (In reply to comment #5)
> > Maybe we can use gclient to pull in the other baselines so it doesn't make the webkit tree noisy?
> 
> There's going to be enough of these baselines (looks like 100/bot and around 10 bots) that I don't think we can manage them as carefully (i.e. version control). The expectation is that when the hardware bots go red, the GPU gardener will do some spot checks to make sure that the changes are expected and then run the webkit tests with --reset-results, which will update these local baselines.

Can we keep the local baselines in the same place as the other baselines?  E.g., LayoutTests/platform/chromium-gpu-win-foo where foo is part of --platform or some other system check?  We could even svn-ignore the directories so they don't show up.  I'd be nice to avoid adding another command line parameter.

Also, I would at least use a local git repo for each bot's results.  Having the history of changes will probably be useful at some point.  You could write a wrapper script that runs NRWT --reset-results, shows the diffs, and commits the results to a local git repo.
Comment 8 Dirk Pranke 2011-03-21 18:11:02 PDT
(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > Maybe we can use gclient to pull in the other baselines so it doesn't make the webkit tree noisy?
> > 
> > There's going to be enough of these baselines (looks like 100/bot and around 10 bots) that I don't think we can manage them as carefully (i.e. version control). The expectation is that when the hardware bots go red, the GPU gardener will do some spot checks to make sure that the changes are expected and then run the webkit tests with --reset-results, which will update these local baselines.
> 
> Can we keep the local baselines in the same place as the other baselines?  E.g., LayoutTests/platform/chromium-gpu-win-foo where foo is part of --platform or some other system check?  We could even svn-ignore the directories so they don't show up.  I'd be nice to avoid adding another command line parameter.
> 

I think the platform field and the baseline logic is complicated enough as it is. 

Also, having it have to know how to parse out some sort of '-local' substring feels wrong to me, since it is not like any of the other modifier components.
Comment 9 Tony Chang 2011-03-22 09:38:08 PDT
(In reply to comment #8)
> I think the platform field and the baseline logic is complicated enough as it is. 
> 
> Also, having it have to know how to parse out some sort of '-local' substring feels wrong to me, since it is not like any of the other modifier components.

I was thinking it would be descriptive rather than just '-local'.  E.g., chromium-gpu-nvidiaXXXX-win or something.  It seems like a small code change to pass in --platform chromium-gpu-nvidiaXXXX and have it get the right results dir.
Alternately, you could add a separate flag (e.g., --gpu-chipset), but that seems less like the other flags.

If all that still sounds worse than --baseline-search-path, I would probably make it at least be a relative path to tempfile.gettempdir() so it's easier to set across platforms (that way on windows you don't have to worry about if it's cygwin or not).
Comment 10 Mihai Parparita 2011-03-22 17:37:39 PDT
Another use-case that occurred me is wanting to temporarily override the fallback path. For example, there are times where I'd like to know if the a test would pass with the mac/ baselines, even though it has chromium-mac/ ones (right now I have to edit chromium_mac.py and temporarily change the fallback path order).

For that to work, we can't force it to always be relative to the tempdir. I think the buildbot script that we use on the (GPU) bots (that wraps NRWT) can set the flag using tempfile.gettempdir() though.
Comment 11 Tony Chang 2011-03-22 17:53:56 PDT
Comment on attachment 85554 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=85554&action=review

I think this is suboptimal, but I guess we can try it.

> Tools/Scripts/webkitpy/layout_tests/port/base.py:276
> +        baseline_search_path = map(self._filesystem.normpath, self.get_option('baseline_search_path', '').split(':'))

: seems like a poor choice for a delimiter since windows drive letters have : in them.

> Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py:267
> +            [('/tmp/local-baselines', 'fast/test-expected.txt')])

Can you add some tests for windows paths and for relative paths?
Comment 12 Dirk Pranke 2011-03-22 20:18:36 PDT
Comment on attachment 85554 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=85554&action=review

>> Tools/Scripts/webkitpy/layout_tests/port/base.py:276
>> +        baseline_search_path = map(self._filesystem.normpath, self.get_option('baseline_search_path', '').split(':'))
> 
> : seems like a poor choice for a delimiter since windows drive letters have : in them.

You might be better off declaring the argument as action="append" and specifying it multiple times on the command line, so that it is stored as a list, and not have to use a separator here. Then again, I don't know where you're getting this value from to pass in on the command line.

The only other case I can think of where we do multiple-valued lists on the command line is in the --print option, which uses a comma-separated list of values. I'd rather not have commas for one argument and colons or semicolons for another. I would also rather not change --print to have to be specified multiple times.

>> Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py:267
>> +            [('/tmp/local-baselines', 'fast/test-expected.txt')])
> 
> Can you add some tests for windows paths and for relative paths?

Because the test is using a MockFileSystem(), it can (and has to) assume hard-coded forward separators, so these tests will actually work across both unix and win32. 

I don't know if there's an easy way to do tests for windows paths and relative paths that will work very well without using a real filesystem. The only other place in this file where we've had to worry about this is in test_filename_to_uri, where it was wrapped in an if block conditional on sys.platform. But that could be cumbersome here. I'm a bit on the fence as to whether writing these tests will be worth the effort needed to ensure they're right (i.e., it's more likely that the tests will be buggy than the code they're testing).
Comment 13 Mihai Parparita 2011-04-05 11:48:47 PDT
Created attachment 88289 [details]
Patch
Comment 14 Mihai Parparita 2011-04-05 11:50:08 PDT
(In reply to comment #12)
> You might be better off declaring the argument as action="append" and specifying it multiple times on the command line, so that it is stored as a list, and not have to use a separator here. Then again, I don't know where you're getting this value from to pass in on the command line.

Changed to append, that seems cleaner.

> I don't know if there's an easy way to do tests for windows paths and relative paths that will work very well without using a real filesystem. The only other place in this file where we've had to worry about this is in test_filename_to_uri, where it was wrapped in an if block conditional on sys.platform. But that could be cumbersome here. I'm a bit on the fence as to whether writing these tests will be worth the effort needed to ensure they're right (i.e., it's more likely that the tests will be buggy than the code they're testing).

I decided that relative paths are probably not what the user wants, so those will not be used. I moved the checking for that and normalization to _set_up_derived_options.
Comment 15 Tony Chang 2011-04-05 11:53:24 PDT
Comment on attachment 88289 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=88289&action=review

> Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py:304
> +                 "Specify multiple times to add multiple search path entries."),

Clever

> Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:582
> +        (res, buildbot_output, regular_output, user) = logging_run(
> +             ['--baseline-search-path', 'foo'])

Nit: no () needed on the left hand side of the assignment
Comment 16 Mihai Parparita 2011-04-05 13:00:56 PDT
(In reply to comment #15)
> Nit: no () needed on the left hand side of the assignment

Fixed (elsewhere in the file too)
Comment 17 Mihai Parparita 2011-04-05 13:03:33 PDT
Committed r82972: <http://trac.webkit.org/changeset/82972>
Comment 18 Dirk Pranke 2011-04-05 13:54:14 PDT
LGTM as well.