Working with web-platform-tests in blink
See here instead
Interoperability between browsers is critical to chromium's mission of improving the web. We believe that leveraging and contributing to a shared test suite is one of the most important tools in achieving interoperability between browsers. The web-platform-tests repository is the primary shared test suite where all browser engines are collaborating.
Chromium has mirrors (web-platform-tests, csswg-test) of the GitHub repos, and regularly (at least daily) imports a subset of the tests so that they are run as part of the regular Blink layout test testing process.
Note that currently the main reason we do not run more of the W3C tests is because they are (probably) mostly redundant with Blink's existing tests, and so we would double the running time of the layout tests for little benefit. Ideally we would identify the tests that are redundant and remove Blink's copies, so that we run just the W3C tests where possible.
The end goals for this whole process are to:
- Be able to run the W3C tests unmodified locally just as easily as we can run the Blink tests
- Ensure that we are tracking tip-of-tree in the W3C repositories as closely as possible
- Run as many of the W3C tests as possible
Tools/Scripts/wpt-import --auto-import wpt Tools/Scripts/wpt-import --auto-import css
Updating the set of tests run by Blink requires commit access to Chromium like anything else, so make sure you have that first.
We control which tests are imported via LayoutTests/W3CImportExpectations, which has a list of directories to skip during import. This means that any new tests and directories that show up in the W3C repos are automatically imported.
To pull the latest versions of the tests that are currently being imported (i.e., you don't need to change the blocklist), all you have to do is run:
Tools/Scripts/wpt-import wpt Tools/Scripts/wpt-import css
That script will pull the latest version of the tests from our mirrors of the W3C repos. If any new versions of tests are found, they will be committed locally to your local repository. You may then upload the changes.
If you wish to add more tests (by un-skipping some of the directories currently skipped in W3CImportExpectations), you can modify that file locally and commit it, and on the next auto-import, the new tests should be imported. If you want to import immediately, you can also run wpt-import --allow-local-commits.
If you need to make changes to Web Platform Tests, just commit your changes directly to our version in LayoutTests/external/wpt and the changes will be automatically upstreamed within 24 hours.
Note: if you’re adding a new test in external/wpt, you’ll need to re-generate MANIFEST.json manually until https://crrev.com/2644783003 is landed. The command to do so is:
Exporter: [//third_party/WebKit/Tools/Scripts/wpt-export](https://cs.chromium.org/chromium/src/third_party/WebKit/Tools/Scripts/wpt-export) Importer: [//third_party/WebKit/Tools/Scripts/wpt-import](https://cs.chromium.org/chromium/src/third_party/WebKit/Tools/Scripts/wpt-import) Libraries: [//third_party/WebKit/Tools/Scripts/webkitpy/w3c/](https://cs.chromium.org/chromium/src/third_party/WebKit/Tools/Scripts/webkitpy/w3c/?q=local_wpt&sq=package:chromium)
The email you commit with (e.g. firstname.lastname@example.org) will be the author of the commit on GitHub. You can add it as a secondary address on your GitHub account to link your exported commits to your GitHub profile.
This cannot be avoided entirely as the two repositories are independent, but should be rare with frequent imports and exports. When it does happen, manual intervention will be needed and in non-trivial cases you may be asked to help resolve the conflict.
It's still possible to make direct pull requests to web-platform-tests. The processes for getting new tests committed the W3C repos are at http://testthewebforward.org/docs/. Some specifics are at http://testthewebforward.org/docs/github-101.html.