blob: 2150f759f784e494c32164555ac8cb70588aac67 [file] [log] [blame] [view]
Stephen McGruer16f79432020-10-07 13:11:051# Using upstream wptrunner in Chromium (experimental)
2
3This page documents the *experimental* support for using the upstream
4[`wptrunner`](https://github.com/web-platform-tests/wpt/tree/master/tools/wptrunner/)
5tooling for running WPT tests in Chromium (vs the [current
6approach](web_platform_tests.md#Running-tests) that uses `run_web_tests.py`).
7
8It is written as a user guide. For technical details on the project, see the
9[design doc](https://docs.google.com/document/d/1Pq5fxR1t2JzOVPynqeRpRS4bM4QO_Z1um0Q_RiR5ETA/edit).
10
11[TOC]
12
13## Differences versus `run_web_tests.py`
14
15The main differences between `run_web_tests.py` and `wptrunner` are that:
16
171. `wptrunner` runs the full `chrome` binary, rather than the stripped-down
18 `content_shell`, and
191. `wptrunner` communicates with the binary via WebDriver (`chromedriver`),
20 instead of talking directly to the browser binary.
21
22These differences mean that any feature that works on upstream WPT today (e.g.
23print-reftests) should work in `wptrunner`, but conversely features available to
24`run_web_tests.py` (e.g. the `internals` API) are not yet available to
25`wptrunner`.
26
27## Running tests locally
28
29*** note
30**NOTE**: Running locally is an area of active development, so the following
31instructions may be out of date.
32***
33
34The runner script is
35[`testing/scripts/run_wpt_tests.py`](https://source.chromium.org/chromium/chromium/src/+/master:testing/scripts/run_wpt_tests.py).
36Before running the script, you must have built the necessary ninja targets:
37
38```
39autoninja -C out/Release wpt_tests_isolate
40```
41
42To run the script, you must enter the `testing/scripts/` directory before
43executing it:
44
45```
46cd testing/scripts
Stephen McGruer5383e3c02020-11-05 13:16:3847./run_wpt_tests.py [test list]
Stephen McGruer16f79432020-10-07 13:11:0548```
49
Stephen McGruer5383e3c02020-11-05 13:16:3850The list of tests should be given relative to `external/wpt/`, e.g.
51`webauthn/createcredential-timeout.https.html`. Directories are also accepted.
52Omitting the test list will run all WPT tests.
Stephen McGruer16f79432020-10-07 13:11:0553
Stephen McGruer5383e3c02020-11-05 13:16:3854Results from the run are placed in your build folder, in a folder called
55`layout-test-results` (e.g. `../../out/Release/layout-test-results/`). Logs from
56the browser should be shown by the runner as it executes each test.
Stephen McGruer16f79432020-10-07 13:11:0557
58Useful flags:
59
60* `-t/--target`: select which `src/out/` sub-directory to use, e.g. `-t Debug`.
61 Defaults to `Release`.
62* `--help`: show the help text
63
64## The MVP bots
65
66As of Q4 2020, an MVP of wptrunner in Chromium is being run with two customer
67teams: Web Payments and Web Identity. For these teams, two **Linux-only** bots
68have been brought up:
69
70* [linux-wpt-identity-fyi-rel](https://ci.chromium.org/p/chromium/builders/ci/linux-wpt-identity-fyi-rel),
71 which runs tests under `external/wpt/webauthn/`.
Luke Zielinski5ce5d372020-12-01 19:19:4772* [linux-wpt-input-fyi-rel](https://ci.chromium.org/p/chromium/builders/ci/linux-wpt-input-fyi-rel),
73 which runs tests under `external/wpt/{input-events, pointerevents, uievents}`,
74 as well as `external/wpt/infrastructure/testdriver/actions/`
Stephen McGruer16f79432020-10-07 13:11:0575
76These bots run on the waterfall, but can also be run on CLs by clicking the
77`Choose Tryjobs` button in Gerrit followed by searching for the bot name in the
78modal dialog that appears. One can also include the tag `Cq-Include-Trybots:
Luke Zielinski5ce5d372020-12-01 19:19:4779luci.chromium.try:linux-wpt-identity-fyi-rel` (or input) in the description
Stephen McGruer16f79432020-10-07 13:11:0580for the CL, which will make the bot mandatory for that CL.
81
82Results for the bots use the existing layout test results viewer
83([example](https://test-results.appspot.com/data/layout_results/linux-wpt-identity-fyi-rel/201/wpt_tests_suite/layout-test-results/results.html)).
84
85## Expectations and baseline files
86
87[Similar to `run_web_tests.py`](web_test_expectations.md), `wptrunner` offers
88the ability to add an expected status for a test or provide a baseline file that
89codifies what the output result should be.
90
91By default `wptrunner` will inherit expected statuses from `TestExpecations`.
92This can currently be overridden by adding an entry to the
93[`WPTOverrideExpectations`](https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/web_tests/WPTOverrideExpectations)
94file when `wptrunner` has a different result than `run_web_tests.py`.
95`WPTOverrideExpectations` is however [deprecated](https://crbug.com/1035911),
96and the preferred method for specifying expected results for `wptrunner` is to
97use baseline files (which will also override a TestExpectation entry for the
98test).
99
100Baseline files for `wptrunner` use a different filename and format than
101the `-expected.txt` files used by `run_web_tests.py`. The ini-like baseline format is
102[documented here](https://web-platform-tests.org/tools/wptrunner/docs/expectation.html),
103and baseline files should be placed alongside the test with an `.ini` suffix:
104
105```
106external/wpt/folder/my-test.html
107external/wpt/folder/my-test-expected.txt <-- run_web_tests.py baseline
108external/wpt/folder/my-test.html.ini <-- wptrunner baseline
109```
110
111We currently do not support the full ini-like format that upstream WPT does;
112most notably we have chosen not to support dynamic conditionals (such as
113platform checks). Most `.ini` baseline files in Chromium should have the form:
114
115```
116[my-test.html]
117 expected: OK
118
119 [First subtest name]
120 expected: FAIL
121 message: The failure message, e.g. assert_false didn't work
122
123 [Second subtest name]
124 expected: PASS
125```
126
127*** note
128**TODO**: Explain how .any.js and variants work in this world.
129***
130
131## Known issues
132
Stephen McGruer16f79432020-10-07 13:11:05133* There is no debugging support in `run_wpt_tests.py` today. In the future, we
134 intend to allow pausing the browser after each test, and (long-term) intend to
135 support hooking up gdb to test runs.
136* There is not yet support for non-Linux platforms. We would love for you to try
137 it on other operating systems and file bugs against us if it doesn't work!
138
139Please [file bugs and feature requests](https://crbug.com/new) against
140`Blink>Infra>Ecosystem`, tagging the title with `[wptrunner]`.