qyearsley | 4f0acca4 | 2017-01-30 08:18:43 | [diff] [blame] | 1 | # Web Platform Tests |
| 2 | |
rbyers | 6299b913 | 2017-02-10 18:06:57 | [diff] [blame] | 3 | Interoperability between browsers is |
qyearsley | 9c9781a | 2017-02-11 00:08:39 | [diff] [blame^] | 4 | [critical](https://www.chromium.org/blink/platform-predictability) to Chromium's |
| 5 | mission of improving the web. We believe that leveraging and contributing to a |
| 6 | shared test suite is one of the most important tools in achieving |
| 7 | interoperability between browsers. The [web-platform-tests |
rbyers | 6299b913 | 2017-02-10 18:06:57 | [diff] [blame] | 8 | repository](https://github.com/w3c/web-platform-tests) is the primary shared |
qyearsley | 9c9781a | 2017-02-11 00:08:39 | [diff] [blame^] | 9 | test suite where all browser engines are collaborating. There's also a |
rbyers | 6299b913 | 2017-02-10 18:06:57 | [diff] [blame] | 10 | [csswg-test repository](https://github.com/w3c/csswg-test) for CSS tests, but |
| 11 | that will [soon be merged into |
| 12 | web-platform-tests](https://github.com/w3c/csswg-test/issues/1102). |
qyearsley | 4f0acca4 | 2017-01-30 08:18:43 | [diff] [blame] | 13 | |
| 14 | [TOC] |
| 15 | |
| 16 | ## Import |
| 17 | |
| 18 | Chromium has mirrors |
| 19 | ([web-platform-tests](https://chromium.googlesource.com/external/w3c/web-platform-tests/), |
| 20 | [csswg-test](https://chromium.googlesource.com/external/w3c/csswg-test/)) of the |
| 21 | GitHub repos, and periodically imports a subset of the tests so that they are |
| 22 | run as part of the regular Blink layout test testing process. |
| 23 | |
| 24 | The goal of this process are to be able to run the Web Platform Tests unmodified |
| 25 | locally just as easily as we can run the Blink tests, and ensure that we are |
| 26 | tracking tip-of-tree in the Web Platform Tests repository as closely as |
| 27 | possible, and running as many of the tests as possible. |
| 28 | |
| 29 | ### Automatic import process |
| 30 | |
| 31 | There is an automatic process for updating the Chromium copy of the Web Platform |
| 32 | Tests. The import is done by the builder [w3c-test-autoroller |
| 33 | builder](https://build.chromium.org/p/chromium.infra.cron/builders/w3c-test-autoroller). |
| 34 | |
| 35 | The easiest way to check the status of recent imports is to look at: |
| 36 | |
| 37 | - Recent logs on Buildbot for [w3c-test-autoroller |
| 38 | builder](https://build.chromium.org/p/chromium.infra.cron/builders/w3c-test-autoroller) |
| 39 | - Recent CLs created by |
| 40 | [[email protected]](https://codereview.chromium.org/search?owner=blink-w3c-test-autoroller%40chromium.org). |
| 41 | |
| 42 | ### Skipped tests |
| 43 | |
| 44 | We control which tests are imported via a file called |
| 45 | [W3CImportExpectations](../../third_party/WebKit/LayoutTests/W3CImportExpectations), |
| 46 | which has a list of directories to skip while importing. |
| 47 | |
| 48 | In addition to the directories and tests explicitly skipped there, tests may |
| 49 | also be skipped for a couple other reasons, e.g. if the file path is too long |
| 50 | for Windows. To check what files are skipped in import, check the recent logs |
| 51 | for [w3c-test-autoroller |
| 52 | builder](https://build.chromium.org/p/chromium.infra.cron/builders/w3c-test-autoroller). |
| 53 | |
| 54 | ### Manual import |
| 55 | |
| 56 | To pull the latest versions of the tests that are currently being imported, you |
| 57 | can also directly invoke the |
| 58 | [wpt-import](../../third_party/WebKit/Tools/Scripts/wpt-import) script. |
| 59 | |
| 60 | That script will pull the latest version of the tests from our mirrors of the |
| 61 | upstream repositories. If any new versions of tests are found, they will be |
| 62 | committed locally to your local repository. You may then upload the changes. |
| 63 | |
qyearsley | 9c9781a | 2017-02-11 00:08:39 | [diff] [blame^] | 64 | ### Enabling import for a new directory |
| 65 | |
qyearsley | 4f0acca4 | 2017-01-30 08:18:43 | [diff] [blame] | 66 | If you wish to add more tests (by un-skipping some of the directories currently |
| 67 | skipped in `W3CImportExpectations`), you can modify that file locally and commit |
qyearsley | 9c9781a | 2017-02-11 00:08:39 | [diff] [blame^] | 68 | it, and on the next auto-import, the new tests should be imported. |
| 69 | |
| 70 | If you want to import immediately (in order to try the tests out locally, etc) |
| 71 | you can also run `wpt-import --allow-local-commits`, but this is not required. |
qyearsley | 4f0acca4 | 2017-01-30 08:18:43 | [diff] [blame] | 72 | |
| 73 | ## Contributing tests back to the Web Platform Tests project. |
| 74 | |
| 75 | If you need to make changes to Web Platform Tests, just commit your changes |
| 76 | directly to |
| 77 | [LayoutTests/external/wpt](../../third_party/WebKit/LayoutTests/external/wpt) |
| 78 | and the changes will be automatically upstreamed within 24 hours. |
| 79 | |
rbyers | 6299b913 | 2017-02-10 18:06:57 | [diff] [blame] | 80 | Note that tests in Web Platform Tests are expected to match behavior defined by |
qyearsley | 9c9781a | 2017-02-11 00:08:39 | [diff] [blame^] | 81 | the relevant WHATWG or W3C specification, not simply Blink's behavior. If in |
rbyers | 6299b913 | 2017-02-10 18:06:57 | [diff] [blame] | 82 | doubt, please request code review from someone with expertise in the relevant |
| 83 | specification text. |
| 84 | |
qyearsley | 4f0acca4 | 2017-01-30 08:18:43 | [diff] [blame] | 85 | Note: if you're adding a new test in `external/wpt`, you'll need to re-generate |
| 86 | MANIFEST.json manually until [CL 2644783003](https://crrev.com/2644783003) is |
| 87 | landed. The command to do so is: |
| 88 | |
| 89 | ```bash |
| 90 | Tools/Scripts/webkitpy/thirdparty/wpt/wpt/manifest --work \ |
| 91 | --tests-root=LayoutTests/external/wpt |
| 92 | ``` |
| 93 | |
qyearsley | 9c9781a | 2017-02-11 00:08:39 | [diff] [blame^] | 94 | ### What kinds of changes can be upstreamed? |
| 95 | |
| 96 | In general, changes involving adding, removing or modifying tests can all be |
| 97 | upstreamed. From a Chromium commit, any changes outside of |
| 98 | [external/wpt](../../third_party/WebKit/LayoutTests/external/wpt) will not be |
| 99 | upstreamed, and any changes `*-expected.txt`, `OWNERS`, and `MANIFEST.json`, |
| 100 | will also not be upstreamed. |
| 101 | |
| 102 | Entirely new top-level directories should generally be added upstream, since |
| 103 | that's the only way to add an OWNERS file upstream. After adding a new top-level |
| 104 | directory upstream, you should add a line for it in `W3CImportExpectations`. |
| 105 | |
qyearsley | 4f0acca4 | 2017-01-30 08:18:43 | [diff] [blame] | 106 | ### Will the exported commits be linked to my GitHub profile? |
| 107 | |
| 108 | The email you commit with in Chromium will be the author of the commit on |
| 109 | GitHub. You can [add it as a secondary address on your GitHub |
| 110 | account](https://help.github.com/articles/adding-an-email-address-to-your-github-account/) |
| 111 | to link your exported commits to your GitHub profile. |
| 112 | |
| 113 | ### What if there are conflicts? |
| 114 | |
| 115 | This cannot be avoided entirely as the two repositories are independent, but |
| 116 | should be rare with frequent imports and exports. When it does happen, manual |
| 117 | intervention will be needed and in non-trivial cases you may be asked to help |
| 118 | resolve the conflict. |
| 119 | |
| 120 | ### Direct pull requests |
| 121 | |
| 122 | It's still possible to make direct pull requests to web-platform-tests. The |
| 123 | processes for getting new tests committed the W3C repos are at |
qyearsley | 7b458d5 | 2017-02-02 17:51:15 | [diff] [blame] | 124 | http://testthewebforward.org/docs/. Some specifics are at |
| 125 | http://testthewebforward.org/docs/github-101.html. |