WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
ASSIGNED
203784
Add support for finding test references via <link rel="match"> and use that in WPT
https://bugs.webkit.org/show_bug.cgi?id=203784
Summary
Add support for finding test references via <link rel="match"> and use that i...
Simon Fraser (smfr)
Reported
2019-11-02 11:14:04 PDT
We should parse test files to look for <link rel="match"> to support WPT-style ref tests. Right now we have to clone a bunch of files on import.
Attachments
Patch
(5.88 KB, patch)
2019-11-04 07:58 PST
,
Simon Fraser (smfr)
no flags
Details
Formatted Diff
Diff
Patch
(18.85 KB, patch)
2019-11-05 22:20 PST
,
Simon Fraser (smfr)
no flags
Details
Formatted Diff
Diff
Patch
(22.36 KB, patch)
2019-11-07 21:30 PST
,
Simon Fraser (smfr)
no flags
Details
Formatted Diff
Diff
Patch
(22.55 KB, patch)
2019-11-07 21:42 PST
,
Simon Fraser (smfr)
no flags
Details
Formatted Diff
Diff
Patch
(25.38 KB, patch)
2019-11-08 09:28 PST
,
Simon Fraser (smfr)
no flags
Details
Formatted Diff
Diff
Patch
(28.64 KB, patch)
2019-11-08 21:56 PST
,
Simon Fraser (smfr)
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Simon Fraser (smfr)
Comment 1
2019-11-04 07:58:32 PST
Created
attachment 382739
[details]
Patch
Simon Fraser (smfr)
Comment 2
2019-11-04 08:01:30 PST
Also need to: 1. Fix wpt import script to not copy the refs to -expected* 2. Warn about removing existing -expected.html on new imports and/or do the removal. 3. When both a ref and expected exist, compare the file contents?
Simon Fraser (smfr)
Comment 3
2019-11-05 22:20:21 PST
Created
attachment 382896
[details]
Patch
youenn fablet
Comment 4
2019-11-05 23:29:01 PST
Comment on
attachment 382896
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=382896&action=review
> Tools/ChangeLog:14 > + as reference files. On import, existing -expected.html files will be removed.
Is it implemented in this patch? If so, can we add a unit test?
> Tools/Scripts/webkitpy/port/base.py:65 > +from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup, SoupStrainer
I believe WPT is computing this in LayoutTests/imported/w3c/web-platform-tests/tools/manifest/sourcefile.py. They use html5lib. In the long run, maybe we should just copy LayoutTests/imported/w3c/web-platform-tests/tools python scripts directly.
> Tools/Scripts/webkitpy/port/base.py:-538 > - result = self._get_reftest_list(test_name)
Can we remove def _get_reftest_list?
> Tools/Scripts/webkitpy/port/base.py:550 > + _log.warning('Multiple references are not supported. Importing the first ref defined in {}'.format(test_name))
I did not know about the previous reftest list support in webkitpy. Are we able to support testing multiple reference files? The warning message could be either updated or removed.
> Tools/Scripts/webkitpy/port/base.py:584 > + def reference_files(self, test_name, device_type=None):
Can we add unit tests for this method?
Simon Fraser (smfr)
Comment 5
2019-11-07 20:33:56 PST
(In reply to youenn fablet from
comment #4
)
> Comment on
attachment 382896
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=382896&action=review
> > > Tools/ChangeLog:14 > > + as reference files. On import, existing -expected.html files will be removed. > > Is it implemented in this patch? If so, can we add a unit test?
That already happens on import (non-tracked filed are deleted).
> > Tools/Scripts/webkitpy/port/base.py:65 > > +from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup, SoupStrainer > > I believe WPT is computing this in > LayoutTests/imported/w3c/web-platform-tests/tools/manifest/sourcefile.py. > They use html5lib. In the long run, maybe we should just copy > LayoutTests/imported/w3c/web-platform-tests/tools python scripts directly.
BeautifulSoup uses html5lib. This is like the code in TestParser, but we don't need a full DOM for each test, just the <link> tags. We have to run this on every test, so it needs to be efficient, which is why I didn't just use TestParser.
> > Tools/Scripts/webkitpy/port/base.py:-538 > > - result = self._get_reftest_list(test_name) > > Can we remove def _get_reftest_list?
Yes:
webkit.org/b/203783
> > Tools/Scripts/webkitpy/port/base.py:550 > > + _log.warning('Multiple references are not supported. Importing the first ref defined in {}'.format(test_name)) > > I did not know about the previous reftest list support in webkitpy. Are we > able to support testing multiple reference files?
No
> The warning message could be either updated or removed.
This is straight from TestParser.analyze_test()
> > Tools/Scripts/webkitpy/port/base.py:584 > > + def reference_files(self, test_name, device_type=None): > > Can we add unit tests for this method?
Sure. Ideally this code wouldn't live in base.py. I tried moving it, and got hung up on some MockDRT stuff.
Simon Fraser (smfr)
Comment 6
2019-11-07 21:30:31 PST
Created
attachment 383107
[details]
Patch
Simon Fraser (smfr)
Comment 7
2019-11-07 21:42:12 PST
Created
attachment 383108
[details]
Patch
Simon Fraser (smfr)
Comment 8
2019-11-08 09:28:55 PST
Created
attachment 383132
[details]
Patch
Ryosuke Niwa
Comment 9
2019-11-08 09:34:46 PST
(In reply to Simon Fraser (smfr) from
comment #0
)
> We should parse test files to look for <link rel="match"> to support > WPT-style ref tests. Right now we have to clone a bunch of files on import.
I don't think we should do this. There was a long discussion about avoiding this so that we don't have a graph of tests referencing one another.
youenn fablet
Comment 10
2019-11-08 13:17:25 PST
(In reply to Ryosuke Niwa from
comment #9
)
> (In reply to Simon Fraser (smfr) from
comment #0
) > > We should parse test files to look for <link rel="match"> to support > > WPT-style ref tests. Right now we have to clone a bunch of files on import. > > I don't think we should do this. There was a long discussion about avoiding > this so that we don't have a graph of tests referencing one another.
What is the exact issue here? Since we will continue running 1-1 only, running the tests seems equivalent. For instance, we might be running the same test twice (A vs.B and B vs. A) with both approaches but with the patch, it might be easier to detect it.
youenn fablet
Comment 11
2019-11-08 13:26:39 PST
Comment on
attachment 383132
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=383132&action=review
> Tools/Scripts/webkitpy/port/base.py:550 > + _log.warning('Multiple references are not supported. Importing the first ref defined in {}'.format(test_name))
This code is coming from TestParser whose purpose is to import tests. The purpose of this code is to run tests, so we should update the message accordingly. Or maybe just remove the warning altogether since we know this is a limitation of webkitpy.
youenn fablet
Comment 12
2019-11-08 13:27:13 PST
LGTM to me but I'd like to hear about Ryosuke issues before we land the patch.
Ryosuke Niwa
Comment 13
2019-11-08 13:33:16 PST
(In reply to youenn fablet from
comment #10
)
> (In reply to Ryosuke Niwa from
comment #9
) > > (In reply to Simon Fraser (smfr) from
comment #0
) > > > We should parse test files to look for <link rel="match"> to support > > > WPT-style ref tests. Right now we have to clone a bunch of files on import. > > > > I don't think we should do this. There was a long discussion about avoiding > > this so that we don't have a graph of tests referencing one another. > > What is the exact issue here?
The issue is that this makes it hard to find the expected result, mismatch, and create unwarranted dependency between files. For example, you can use another test as the expected result. If you modified the test due to a code change, a random other test may start failing. See this thread:
https://lists.webkit.org/pipermail/webkit-dev/2011-November/018470.html
Ryosuke Niwa
Comment 14
2019-11-08 13:33:31 PST
Comment on
attachment 383132
[details]
Patch I don't think we should land this patch until a discussion on webkit-dev happens.
Ryosuke Niwa
Comment 15
2019-11-08 13:36:57 PST
Also ee
https://bugs.webkit.org/show_bug.cgi?id=66295
youenn fablet
Comment 16
2019-11-08 13:42:53 PST
We might think of temporary workarounds then. One of which could be to have the -ref.html file be a redirect to the actual reference file if the reference file is not in the same directory. This could be done by the test importer.
Simon Fraser (smfr)
Comment 17
2019-11-08 14:02:19 PST
I mailed webkit-dev. Since WPT use <link rel=> so extensively now, I think we should reconsider.
Ryosuke Niwa
Comment 18
2019-11-08 14:08:17 PST
(In reply to Simon Fraser (smfr) from
comment #17
)
> I mailed webkit-dev. Since WPT use <link rel=> so extensively now, I think > we should reconsider.
I think reconsidering the decision is good. After all, I was the one who proposed this change last time around. Replied in the thread.
Simon Fraser (smfr)
Comment 19
2019-11-08 21:56:45 PST
Created
attachment 383201
[details]
Patch
zalan
Comment 20
2019-11-09 11:13:10 PST
Comment on
attachment 383201
[details]
Patch rs=me
Alexey Proskuryakov
Comment 21
2019-11-09 13:14:36 PST
Comment on
attachment 383201
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=383201&action=review
> Tools/ChangeLog:3 > + Add support for finding test references via <link rel="match">
Catching up on e-mail thread, I see that there is a ~3% overhead for test runtime. That's kind of outrageous, let's not land this then.
Carlos Alberto Lopez Perez
Comment 22
2019-11-11 11:05:47 PST
Comment on
attachment 383201
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=383201&action=review
> Tools/ChangeLog:10 > + When looking for test references, we now check for a <link rel="match"> > + or <link rel="mismatch"> before looking in the filesystem for "-expected" files. > + A warning is logged if both exist.
The performance hit (3%?) is likely to be much lower if the order of searching for expected results is inverted.
Simon Fraser (smfr)
Comment 23
2019-11-19 12:07:30 PST
Comment on
attachment 383201
[details]
Patch I think what we should do is generate MANIFEST.json in imported/w3c/web-platform-tests at import time, and commit it, then use it to find references just for wpt.
Frédéric Wang (:fredw)
Comment 24
2019-11-19 13:08:15 PST
(In reply to Simon Fraser (smfr) from
comment #23
)
> Comment on
attachment 383201
[details]
> Patch > > I think what we should do is generate MANIFEST.json in > imported/w3c/web-platform-tests at import time, and commit it, then use it > to find references just for wpt.
I think some people proposed a workflow where we add WPT tests in WebKit and then use the export script to open github PR. I'm not sure this approach is really used, but if that's the case, these people should also be sure to re-generate MANIFEST.json
Radar WebKit Bug Importer
Comment 25
2020-09-21 15:38:38 PDT
<
rdar://problem/69332113
>
Ryosuke Niwa
Comment 26
2020-11-16 21:26:56 PST
FWIW, we're not using this mechanism for non-WPT tests.
Manuel Rego Casasnovas
Comment 27
2022-01-11 09:03:55 PST
Since
https://bugs.webkit.org/show_bug.cgi?id=234510
we're now importing the -ref files too, which makes us to have a lot of duplicated files using -expected.html & -ref.html at the same time. See for example the following folder:
https://github.com/WebKit/WebKit/tree/main/LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/global-attributes
I believe it'd be really nice to fix this bug and get rid of -expected.html files on WPT imported folder. Otherwise we're going to end up duplicating most of the references as we sync different folders.
David Kilzer (:ddkilzer)
Comment 28
2022-12-21 12:57:34 PST
***
Bug 249720
has been marked as a duplicate of this bug. ***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug