Bug 71574 - [NRWT] result.html should not rely on naming convention of reference file used in reftests.
Summary: [NRWT] result.html should not rely on naming convention of reference file use...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Hayato Ito
URL:
Keywords:
Depends on: 66837
Blocks: 66295
  Show dependency treegraph
 
Reported: 2011-11-04 11:03 PDT by Hayato Ito
Modified: 2011-11-09 23:42 PST (History)
5 users (show)

See Also:


Attachments
use ref_file in results.html (5.51 KB, patch)
2011-11-09 04:36 PST, Hayato Ito
no flags Details | Formatted Diff | Diff
add tests. (14.16 KB, patch)
2011-11-09 21:30 PST, Hayato Ito
no flags Details | Formatted Diff | Diff
fixed variable name. (14.23 KB, patch)
2011-11-09 22:24 PST, Hayato Ito
no flags Details | Formatted Diff | Diff
fixed variable name, port (14.20 KB, patch)
2011-11-09 22:29 PST, Hayato Ito
rniwa: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hayato Ito 2011-11-04 11:03:00 PDT
A result.html assumes that reftests have reference filename named '-expected.html' (or '-expected-mismatch.html').
But that won't apply for w3c reftests. We should make a result.html link to the correct reference file.
Comment 1 Hayato Ito 2011-11-09 04:36:55 PST
Created attachment 114250 [details]
use ref_file in results.html
Comment 2 Adam Barth 2011-11-09 08:32:14 PST
Comment on attachment 114250 [details]
use ref_file in results.html

All functional changes to webkitpy require tests.
Comment 3 Adam Barth 2011-11-09 08:32:41 PST
Even if this doesn't affect any LayoutTests, you can wrote webkitpy unit tests to exercise the change.
Comment 4 Ryosuke Niwa 2011-11-09 09:11:41 PST
(In reply to comment #3)
> Even if this doesn't affect any LayoutTests, you can wrote webkitpy unit tests to exercise the change.

I don't think we can test this change by a unit test in practice. Most of tests for manager.py are integration tests but we can't write an integration test until https://bugs.webkit.org/show_bug.cgi?id=66837 is fixed.
Comment 5 Adam Barth 2011-11-09 09:26:00 PST
Perhaps we need to wait until Bug 66837 is fixed before landing this patch.  Another option is to improve the testability of this code.
Comment 6 Ojan Vafai 2011-11-09 10:09:57 PST
It looks to me that this can now be tested using regular reftests since bug 71567 was committed.
Comment 7 Ryosuke Niwa 2011-11-09 12:15:34 PST
(In reply to comment #5)
> Perhaps we need to wait until Bug 66837 is fixed before landing this patch.  Another option is to improve the testability of this code.

Right. We need to wait 'til the bug 66837 is resolved.
Comment 8 Ojan Vafai 2011-11-09 13:16:40 PST
(In reply to comment #7)
> (In reply to comment #5)
> > Perhaps we need to wait until Bug 66837 is fixed before landing this patch.  Another option is to improve the testability of this code.
> 
> Right. We need to wait 'til the bug 66837 is resolved.

I don't understand why. WIth bug 71567 resolved, we can hit all these codepaths using the existing reftest infrastructure (e.g. with a -expected.html or -expected-mismatch.html file).
Comment 9 Hayato Ito 2011-11-09 21:30:21 PST
Created attachment 114429 [details]
add tests.
Comment 10 Hayato Ito 2011-11-09 21:32:40 PST
Hi Ojan,
Thank you for the comments.

(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #5)
> > > Perhaps we need to wait until Bug 66837 is fixed before landing this patch.  Another option is to improve the testability of this code.
> > 
> > Right. We need to wait 'til the bug 66837 is resolved.
> 
> I don't understand why. WIth bug 71567 resolved, we can hit all these codepaths using the existing reftest infrastructure (e.g. with a -expected.html or -expected-mismatch.html file).


For existing reftests, we can hit all codepths.
But we cannot hit new codepath introduced in this patch, which requires a reftest which uses a non-default reference filename.

Therefore, I've refactored the previous patch so that we can test new codepath. I also added tests for results.html into results-test.js.

I was impressed that results.html has been also tested. :)
Comment 11 Ryosuke Niwa 2011-11-09 21:40:27 PST
Comment on attachment 114429 [details]
add tests.

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

> Tools/Scripts/webkitpy/layout_tests/controllers/manager.py:71
> +def interpret_test_failures(port_obj, test_name, failures):

It's better to call it "port"

> Tools/Scripts/webkitpy/layout_tests/controllers/manager.py:88
> +    for f in failures:

Please don't use one-letter variable.

> LayoutTests/fast/harness/results.html:552
> +            if (testObject.ref_file)
> +                row += referenceLink(test_prefix, testObject.ref_file, 'ref mismatch html');
> +            else
> +                row += resultLink(test_prefix, '-expected-mismatch.html', 'ref mismatch html');

Can we always add ref_file property instead?
Comment 12 Hayato Ito 2011-11-09 22:24:00 PST
Created attachment 114437 [details]
fixed variable name.
Comment 13 Hayato Ito 2011-11-09 22:29:32 PST
Created attachment 114439 [details]
fixed variable name, port
Comment 14 Hayato Ito 2011-11-09 22:30:33 PST
Thank you for the review.

(In reply to comment #11)
> (From update of attachment 114429 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=114429&action=review
> 
> > Tools/Scripts/webkitpy/layout_tests/controllers/manager.py:71
> > +def interpret_test_failures(port_obj, test_name, failures):
> 
> It's better to call it "port"

Done.

> 
> > Tools/Scripts/webkitpy/layout_tests/controllers/manager.py:88
> > +    for f in failures:
> 
> Please don't use one-letter variable.

Done.

> 
> > LayoutTests/fast/harness/results.html:552
> > +            if (testObject.ref_file)
> > +                row += referenceLink(test_prefix, testObject.ref_file, 'ref mismatch html');
> > +            else
> > +                row += resultLink(test_prefix, '-expected-mismatch.html', 'ref mismatch html');
> 
> Can we always add ref_file property instead?

That's intentional. We can reduce the size of the full_results.json if we omit ref_file which matches the naming convention. I think it is worth doing.
Comment 15 Ryosuke Niwa 2011-11-09 22:31:33 PST
Comment on attachment 114439 [details]
fixed variable name, port

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

> Tools/Scripts/webkitpy/layout_tests/controllers/manager.py:94
> +            if failure.reference_filename != port.reftest_expected_filename(test_name):
> +                test_dict['ref_file'] = port.relative_test_filename(failure.reference_filename)

I still think we can always add ref_file but that might bloat the json?

> LayoutTests/fast/harness/results.html:415
> +function referenceLink(testPrefix, reference_filename, contents)
> +{
> +    return '<a class=result-link href="' + reference_filename + '" data-prefix="' + testPrefix + '">' + contents + '</a> ';
> +}

Maybe we can share the code with resultLink?
Comment 16 Hayato Ito 2011-11-09 23:10:43 PST
Thank you for the review.
I'll land this patch after addressing your comment.

(In reply to comment #15)
> (From update of attachment 114439 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=114439&action=review
> 
> > Tools/Scripts/webkitpy/layout_tests/controllers/manager.py:94
> > +            if failure.reference_filename != port.reftest_expected_filename(test_name):
> > +                test_dict['ref_file'] = port.relative_test_filename(failure.reference_filename)
> 
> I still think we can always add ref_file but that might bloat the json?

Maybe I am too conservative, but I can find there are already a lot of efforts to reduce the size of full_results.json. So it might be safe to follow the local rule.

> 
> > LayoutTests/fast/harness/results.html:415
> > +function referenceLink(testPrefix, reference_filename, contents)
> > +{
> > +    return '<a class=result-link href="' + reference_filename + '" data-prefix="' + testPrefix + '">' + contents + '</a> ';
> > +}
> 
> Maybe we can share the code with resultLink?

Okay. That's trivial.
Comment 17 Hayato Ito 2011-11-09 23:42:53 PST
Committed r99818: <http://trac.webkit.org/changeset/99818>