blob: c31390470797ce586203a9c3615e687cb2314fec [file] [log] [blame] [view]
Kai Ninomiyaa6429fb32018-03-30 01:30:561# GPU Testing
2
3This set of pages documents the setup and operation of the GPU bots and try
4servers, which verify the correctness of Chrome's graphically accelerated
5rendering pipeline.
6
7[TOC]
8
9## Overview
10
11The GPU bots run a different set of tests than the majority of the Chromium
12test machines. The GPU bots specifically focus on tests which exercise the
13graphics processor, and whose results are likely to vary between graphics card
14vendors.
15
16Most of the tests on the GPU bots are run via the [Telemetry framework].
17Telemetry was originally conceived as a performance testing framework, but has
18proven valuable for correctness testing as well. Telemetry directs the browser
19to perform various operations, like page navigation and test execution, from
20external scripts written in Python. The GPU bots launch the full Chromium
21browser via Telemetry for the majority of the tests. Using the full browser to
22execute tests, rather than smaller test harnesses, has yielded several
23advantages: testing what is shipped, improved reliability, and improved
24performance.
25
26[Telemetry framework]: https://github.com/catapult-project/catapult/tree/master/telemetry
27
28A subset of the tests, called "pixel tests", grab screen snapshots of the web
29page in order to validate Chromium's rendering architecture end-to-end. Where
30necessary, GPU-specific results are maintained for these tests. Some of these
31tests verify just a few pixels, using handwritten code, in order to use the
32same validation for all brands of GPUs.
33
34The GPU bots use the Chrome infrastructure team's [recipe framework], and
35specifically the [`chromium`][recipes/chromium] and
36[`chromium_trybot`][recipes/chromium_trybot] recipes, to describe what tests to
37execute. Compared to the legacy master-side buildbot scripts, recipes make it
38easy to add new steps to the bots, change the bots' configuration, and run the
39tests locally in the same way that they are run on the bots. Additionally, the
40`chromium` and `chromium_trybot` recipes make it possible to send try jobs which
41add new steps to the bots. This single capability is a huge step forward from
42the previous configuration where new steps were added blindly, and could cause
43failures on the tryservers. For more details about the configuration of the
44bots, see the [GPU bot details].
45
46[recipe framework]: https://chromium.googlesource.com/external/github.com/luci/recipes-py/+/master/doc/user_guide.md
47[recipes/chromium]: https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/slave/recipes/chromium.py
48[recipes/chromium_trybot]: https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/slave/recipes/chromium_trybot.py
49[GPU bot details]: gpu_testing_bot_details.md
50
51The physical hardware for the GPU bots lives in the Swarming pool\*. The
52Swarming infrastructure ([new docs][new-testing-infra], [older but currently
53more complete docs][isolated-testing-infra]) provides many benefits:
54
55* Increased parallelism for the tests; all steps for a given tryjob or
56 waterfall build run in parallel.
57* Simpler scaling: just add more hardware in order to get more capacity. No
58 manual configuration or distribution of hardware needed.
59* Easier to run certain tests only on certain operating systems or types of
60 GPUs.
61* Easier to add new operating systems or types of GPUs.
62* Clearer description of the binary and data dependencies of the tests. If
63 they run successfully locally, they'll run successfully on the bots.
64
65(\* All but a few one-off GPU bots are in the swarming pool. The exceptions to
66the rule are described in the [GPU bot details].)
67
68The bots on the [chromium.gpu.fyi] waterfall are configured to always test
69top-of-tree ANGLE. This setup is done with a few lines of code in the
70[tools/build workspace]; search the code for "angle".
71
72These aspects of the bots are described in more detail below, and in linked
73pages. There is a [presentation][bots-presentation] which gives a brief
74overview of this documentation and links back to various portions.
75
76<!-- XXX: broken link -->
77[new-testing-infra]: https://github.com/luci/luci-py/wiki
78[isolated-testing-infra]: https://www.chromium.org/developers/testing/isolated-testing/infrastructure
Kenneth Russell8a386d42018-06-02 09:48:0179[chromium.gpu]: https://ci.chromium.org/p/chromium/g/chromium.gpu/console
80[chromium.gpu.fyi]: https://ci.chromium.org/p/chromium/g/chromium.gpu.fyi/console
Kai Ninomiyaa6429fb32018-03-30 01:30:5681[tools/build workspace]: https://code.google.com/p/chromium/codesearch#chromium/build/scripts/slave/recipe_modules/chromium_tests/chromium_gpu_fyi.py
82[bots-presentation]: https://docs.google.com/presentation/d/1BC6T7pndSqPFnituR7ceG7fMY7WaGqYHhx5i9ECa8EI/edit?usp=sharing
83
84## Fleet Status
85
86Please see the [GPU Pixel Wrangling instructions] for links to dashboards
87showing the status of various bots in the GPU fleet.
88
89[GPU Pixel Wrangling instructions]: pixel_wrangling.md#Fleet-Status
90
91## Using the GPU Bots
92
93Most Chromium developers interact with the GPU bots in two ways:
94
951. Observing the bots on the waterfalls.
962. Sending try jobs to them.
97
98The GPU bots are grouped on the [chromium.gpu] and [chromium.gpu.fyi]
99waterfalls. Their current status can be easily observed there.
100
101To send try jobs, you must first upload your CL to the codereview server. Then,
102either clicking the "CQ dry run" link or running from the command line:
103
104```sh
105git cl try
106```
107
108Sends your job to the default set of try servers.
109
110The GPU tests are part of the default set for Chromium CLs, and are run as part
111of the following tryservers' jobs:
112
Kenneth Russell42732952018-06-27 02:08:42113* [linux_chromium_rel_ng], formerly on the `tryserver.chromium.linux` waterfall
114* [mac_chromium_rel_ng], formerly on the `tryserver.chromium.mac` waterfall
115* [win_chromium_rel_ng], formerly on the `tryserver.chromium.win` waterfall
Kai Ninomiyaa6429fb32018-03-30 01:30:56116
Kenneth Russell42732952018-06-27 02:08:42117[linux_chromium_rel_ng]: https://ci.chromium.org/p/chromium/builders/luci.chromium.try/linux_chromium_rel_ng?limit=100
118[mac_chromium_rel_ng]: https://ci.chromium.org/p/chromium/builders/luci.chromium.try/mac_chromium_rel_ng?limit=100
119[win7_chromium_rel_ng]: https://ci.chromium.org/p/chromium/builders/luci.chromium.try/win7_chromium_rel_ng?limit=100
Kai Ninomiyaa6429fb32018-03-30 01:30:56120
121Scan down through the steps looking for the text "GPU"; that identifies those
122tests run on the GPU bots. For each test the "trigger" step can be ignored; the
123step further down for the test of the same name contains the results.
124
125It's usually not necessary to explicitly send try jobs just for verifying GPU
126tests. If you want to, you must invoke "git cl try" separately for each
127tryserver master you want to reference, for example:
128
129```sh
130git cl try -b linux_chromium_rel_ng
131git cl try -b mac_chromium_rel_ng
Kenneth Russell42732952018-06-27 02:08:42132git cl try -b win7_chromium_rel_ng
Kai Ninomiyaa6429fb32018-03-30 01:30:56133```
134
135Alternatively, the Gerrit UI can be used to send a patch set to these try
136servers.
137
138Three optional tryservers are also available which run additional tests. As of
139this writing, they ran longer-running tests that can't run against all Chromium
140CLs due to lack of hardware capacity. They are added as part of the included
141tryservers for code changes to certain sub-directories.
142
Corentin Wallezb78c44a2018-04-12 14:29:47143* [linux_optional_gpu_tests_rel] on the [luci.chromium.try] waterfall
144* [mac_optional_gpu_tests_rel] on the [luci.chromium.try] waterfall
145* [win_optional_gpu_tests_rel] on the [luci.chromium.try] waterfall
Kai Ninomiyaa6429fb32018-03-30 01:30:56146
Corentin Wallezb78c44a2018-04-12 14:29:47147[linux_optional_gpu_tests_rel]: https://ci.chromium.org/p/chromium/builders/luci.chromium.try/linux_optional_gpu_tests_rel
148[mac_optional_gpu_tests_rel]: https://ci.chromium.org/p/chromium/builders/luci.chromium.try/mac_optional_gpu_tests_rel
149[win_optional_gpu_tests_rel]: https://ci.chromium.org/p/chromium/builders/luci.chromium.try/win_optional_gpu_tests_rel
Kenneth Russell42732952018-06-27 02:08:42150[luci.chromium.try]: https://ci.chromium.org/p/chromium/g/luci.chromium.try/builders
Kai Ninomiyaa6429fb32018-03-30 01:30:56151
152Tryservers for the [ANGLE project] are also present on the
153[tryserver.chromium.angle] waterfall. These are invoked from the Gerrit user
154interface. They are configured similarly to the tryservers for regular Chromium
155patches, and run the same tests that are run on the [chromium.gpu.fyi]
156waterfall, in the same way (e.g., against ToT ANGLE).
157
158If you find it necessary to try patches against other sub-repositories than
159Chromium (`src/`) and ANGLE (`src/third_party/angle/`), please
160[file a bug](http://crbug.com/new) with component Internals\>GPU\>Testing.
161
162[ANGLE project]: https://chromium.googlesource.com/angle/angle/+/master/README.md
163[tryserver.chromium.angle]: https://build.chromium.org/p/tryserver.chromium.angle/waterfall
164[file a bug]: http://crbug.com/new
165
166## Running the GPU Tests Locally
167
168All of the GPU tests running on the bots can be run locally from a Chromium
169build. Many of the tests are simple executables:
170
171* `angle_unittests`
172* `content_gl_tests`
173* `gl_tests`
174* `gl_unittests`
175* `tab_capture_end2end_tests`
176
177Some run only on the chromium.gpu.fyi waterfall, either because there isn't
178enough machine capacity at the moment, or because they're closed-source tests
179which aren't allowed to run on the regular Chromium waterfalls:
180
181* `angle_deqp_gles2_tests`
182* `angle_deqp_gles3_tests`
183* `angle_end2end_tests`
184* `audio_unittests`
185
186The remaining GPU tests are run via Telemetry. In order to run them, just
187build the `chrome` target and then
188invoke `src/content/test/gpu/run_gpu_integration_test.py` with the appropriate
189argument. The tests this script can invoke are
190in `src/content/test/gpu/gpu_tests/`. For example:
191
192* `run_gpu_integration_test.py context_lost --browser=release`
193* `run_gpu_integration_test.py pixel --browser=release`
194* `run_gpu_integration_test.py webgl_conformance --browser=release --webgl-conformance-version=1.0.2`
195* `run_gpu_integration_test.py maps --browser=release`
196* `run_gpu_integration_test.py screenshot_sync --browser=release`
197* `run_gpu_integration_test.py trace_test --browser=release`
198
199**Note:** If you are on Linux and see this test harness exit immediately with
200`**Non zero exit code**`, it's probably because of some incompatible Python
201packages being installed. Please uninstall the `python-egenix-mxdatetime` and
202`python-logilab-common` packages in this case; see
203[Issue 716241](http://crbug.com/716241).
204
205You can also run a subset of tests with this harness:
206
207* `run_gpu_integration_test.py webgl_conformance --browser=release
208 --test-filter=conformance_attribs`
209
210Figuring out the exact command line that was used to invoke the test on the
211bots can be a little tricky. The bots all\* run their tests via Swarming and
212isolates, meaning that the invocation of a step like `[trigger]
213webgl_conformance_tests on NVIDIA GPU...` will look like:
214
215* `python -u
216 'E:\b\build\slave\Win7_Release__NVIDIA_\build\src\tools\swarming_client\swarming.py'
217 trigger --swarming https://chromium-swarm.appspot.com
218 --isolate-server https://isolateserver.appspot.com
219 --priority 25 --shards 1 --task-name 'webgl_conformance_tests on NVIDIA GPU...'`
220
221You can figure out the additional command line arguments that were passed to
222each test on the bots by examining the trigger step and searching for the
223argument separator (<code> -- </code>). For a recent invocation of
224`webgl_conformance_tests`, this looked like:
225
226* `webgl_conformance --show-stdout '--browser=release' -v
227 '--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc'
228 '--isolated-script-test-output=${ISOLATED_OUTDIR}/output.json'`
229
230You can leave off the --isolated-script-test-output argument, so this would
231leave a full command line of:
232
233* `run_gpu_integration_test.py
234 webgl_conformance --show-stdout '--browser=release' -v
235 '--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc'`
236
237The Maps test requires you to authenticate to cloud storage in order to access
238the Web Page Reply archive containing the test. See [Cloud Storage Credentials]
239for documentation on setting this up.
240
241[Cloud Storage Credentials]: gpu_testing_bot_details.md#Cloud-storage-credentials
242
243Pixel tests use reference images from cloud storage, bots pass
244`--upload-refimg-to-cloud-storage` argument, but to run locally you need to pass
245`--download-refimg-from-cloud-storage` argument, as well as other arguments bot
246uses, like `--refimg-cloud-storage-bucket` and `--os-type`.
247
248Sample command line for Android:
249
250* `run_gpu_integration_test.py pixel --show-stdout --browser=android-chromium
251 -v --passthrough --extra-browser-args='--enable-logging=stderr
252 --js-flags=--expose-gc' --refimg-cloud-storage-bucket
253 chromium-gpu-archive/reference-images --os-type android
254 --download-refimg-from-cloud-storage`
255
256<!-- XXX: update this section; these isolates don't exist anymore -->
257You can find the isolates for the various tests in
258[src/chrome/](http://src.chromium.org/viewvc/chrome/trunk/src/chrome/):
259
260* [angle_unittests.isolate](https://chromium.googlesource.com/chromium/src/+/master/chrome/angle_unittests.isolate)
261* [content_gl_tests.isolate](https://chromium.googlesource.com/chromium/src/+/master/content/content_gl_tests.isolate)
262* [gl_tests.isolate](https://chromium.googlesource.com/chromium/src/+/master/chrome/gl_tests.isolate)
263* [gles2_conform_test.isolate](https://chromium.googlesource.com/chromium/src/+/master/chrome/gles2_conform_test.isolate)
264* [tab_capture_end2end_tests.isolate](https://chromium.googlesource.com/chromium/src/+/master/chrome/tab_capture_end2end_tests.isolate)
265* [telemetry_gpu_test.isolate](https://chromium.googlesource.com/chromium/src/+/master/chrome/telemetry_gpu_test.isolate)
266
267The isolates contain the full or partial command line for invoking the target.
268The complete command line for any test can be deduced from the contents of the
269isolate plus the stdio output from the test's run on the bot.
270
271Note that for the GN build, the isolates are simply described by build targets,
272and [gn_isolate_map.pyl] describes the mapping between isolate name and build
273target, as well as the command line used to invoke the isolate. Once all
274platforms have switched to GN, the .isolate files will be obsolete and be
275removed.
276
277(\* A few of the one-off GPU configurations on the chromium.gpu.fyi waterfall
278run their tests locally rather than via swarming, in order to decrease the
279number of physical machines needed.)
280
281[gn_isolate_map.pyl]: https://chromium.googlesource.com/chromium/src/+/master/testing/buildbot/gn_isolate_map.pyl
282
283## Running Binaries from the Bots Locally
284
285Any binary run remotely on a bot can also be run locally, assuming the local
286machine loosely matches the architecture and OS of the bot.
287
288The easiest way to do this is to find the ID of the swarming task and use
289"swarming.py reproduce" to re-run it:
290
291* `./src/tools/swarming_client/swarming.py reproduce -S https://chromium-swarm.appspot.com [task ID]`
292
293The task ID can be found in the stdio for the "trigger" step for the test. For
294example, look at a recent build from the [Mac Release (Intel)] bot, and
295look at the `gl_unittests` step. You will see something like:
296
297[Mac Release (Intel)]: https://ci.chromium.org/buildbot/chromium.gpu/Mac%20Release%20%28Intel%29/
298
299```
300Triggered task: gl_unittests on Intel GPU on Mac/Mac-10.12.6/[TRUNCATED_ISOLATE_HASH]/Mac Release (Intel)/83664
301To collect results, use:
302 swarming.py collect -S https://chromium-swarm.appspot.com --json /var/folders/[PATH_TO_TEMP_FILE].json
303Or visit:
304 https://chromium-swarm.appspot.com/user/task/[TASK_ID]
305```
306
307There is a difference between the isolate's hash and Swarming's task ID. Make
308sure you use the task ID and not the isolate's hash.
309
310As of this writing, there seems to be a
311[bug](https://github.com/luci/luci-py/issues/250)
312when attempting to re-run the Telemetry based GPU tests in this way. For the
313time being, this can be worked around by instead downloading the contents of
314the isolate. To do so, look more deeply into the trigger step's log:
315
316* <code>python -u
317 /b/build/slave/Mac_10_10_Release__Intel_/build/src/tools/swarming_client/swarming.py
318 trigger [...more args...] --tag data:[ISOLATE_HASH] [...more args...]
319 [ISOLATE_HASH] -- **[...TEST_ARGS...]**</code>
320
321As of this writing, the isolate hash appears twice in the command line. To
322download the isolate's contents into directory `foo` (note, this is in the
323"Help" section associated with the page for the isolate's task, but I'm not
324sure whether that's accessible only to Google employees or all members of the
325chromium.org organization):
326
327* `python isolateserver.py download -I https://isolateserver.appspot.com
328 --namespace default-gzip -s [ISOLATE_HASH] --target foo`
329
330`isolateserver.py` will tell you the approximate command line to use. You
331should concatenate the `TEST_ARGS` highlighted in red above with
332`isolateserver.py`'s recommendation. The `ISOLATED_OUTDIR` variable can be
333safely replaced with `/tmp`.
334
335Note that `isolateserver.py` downloads a large number of files (everything
336needed to run the test) and may take a while. There is a way to use
337`run_isolated.py` to achieve the same result, but as of this writing, there
338were problems doing so, so this procedure is not documented at this time.
339
340Before attempting to download an isolate, you must ensure you have permission
341to access the isolate server. Full instructions can be [found
342here][isolate-server-credentials]. For most cases, you can simply run:
343
344* `./src/tools/swarming_client/auth.py login
345 --service=https://isolateserver.appspot.com`
346
347The above link requires that you log in with your @google.com credentials. It's
348not known at the present time whether this works with @chromium.org accounts.
349Email kbr@ if you try this and find it doesn't work.
350
351[isolate-server-credentials]: gpu_testing_bot_details.md#Isolate-server-credentials
352
353## Running Locally Built Binaries on the GPU Bots
354
355See the [Swarming documentation] for instructions on how to upload your binaries to the isolate server and trigger execution on Swarming.
356
357[Swarming documentation]: https://www.chromium.org/developers/testing/isolated-testing/for-swes#TOC-Run-a-test-built-locally-on-Swarming
358
Kenneth Russell42732952018-06-27 02:08:42359## Moving Test Binaries from Machine to Machine
360
361To create a zip archive of your personal Chromium build plus all of
362the Telemetry-based GPU tests' dependencies, which you can then move
363to another machine for testing:
364
3651. Build Chrome (into `out/Release` in this example).
3661. `python tools/mb/mb.py zip out/Release/ telemetry_gpu_integration_test out/telemetry_gpu_integration_test.zip`
367
368Then copy telemetry_gpu_integration_test.zip to another machine. Unzip
369it, and cd into the resulting directory. Invoke
370`content/test/gpu/run_gpu_integration_test.py` as above.
371
372This workflow has been tested successfully on Windows with a
373statically-linked Release build of Chrome.
374
375Note: on one macOS machine, this command failed because of a broken
376`strip-json-comments` symlink in
377`src/third_party/catapult/common/node_runner/node_runner/node_modules/.bin`. Deleting
378that symlink allowed it to proceed.
379
380Note also: on the same macOS machine, with a component build, this
381command failed to zip up a working Chromium binary. The browser failed
382to start with the following error:
383
384`[0626/180440.571670:FATAL:chrome_main_delegate.cc(1057)] Check failed: service_manifest_data_pack_.`
385
386In a pinch, this command could be used to bundle up everything, but
387the "out" directory could be deleted from the resulting zip archive,
388and the Chromium binaries moved over to the target machine. Then the
389command line arguments `--browser=exact --browser-executable=[path]`
390can be used to launch that specific browser.
391
392See the [user guide for mb](../../tools/mb/docs/user_guide.md#mb-zip), the
393meta-build system, for more details.
394
Kai Ninomiyaa6429fb32018-03-30 01:30:56395## Adding New Tests to the GPU Bots
396
397The goal of the GPU bots is to avoid regressions in Chrome's rendering stack.
398To that end, let's add as many tests as possible that will help catch
399regressions in the product. If you see a crazy bug in Chrome's rendering which
400would be easy to catch with a pixel test running in Chrome and hard to catch in
401any of the other test harnesses, please, invest the time to add a test!
402
403There are a couple of different ways to add new tests to the bots:
404
4051. Adding a new test to one of the existing harnesses.
4062. Adding an entire new test step to the bots.
407
408### Adding a new test to one of the existing test harnesses
409
410Adding new tests to the GTest-based harnesses is straightforward and
411essentially requires no explanation.
412
413As of this writing it isn't as easy as desired to add a new test to one of the
414Telemetry based harnesses. See [Issue 352807](http://crbug.com/352807). Let's
415collectively work to address that issue. It would be great to reduce the number
416of steps on the GPU bots, or at least to avoid significantly increasing the
417number of steps on the bots. The WebGL conformance tests should probably remain
418a separate step, but some of the smaller Telemetry based tests
419(`context_lost_tests`, `memory_test`, etc.) should probably be combined into a
420single step.
421
422If you are adding a new test to one of the existing tests (e.g., `pixel_test`),
423all you need to do is make sure that your new test runs correctly via isolates.
424See the documentation from the GPU bot details on [adding new isolated
Daniel Bratellf73f0df2018-09-24 13:52:49425tests][new-isolates] for the gn args and authentication needed to upload
Kai Ninomiyaa6429fb32018-03-30 01:30:56426isolates to the isolate server. Most likely the new test will be Telemetry
427based, and included in the `telemetry_gpu_test_run` isolate. You can then
428invoke it via:
429
430* `./src/tools/swarming_client/run_isolated.py -s [HASH]
431 -I https://isolateserver.appspot.com -- [TEST_NAME] [TEST_ARGUMENTS]`
432
433[new-isolates]: gpu_testing_bot_details.md#Adding-a-new-isolated-test-to-the-bots
434
435o## Adding new steps to the GPU Bots
436
437The tests that are run by the GPU bots are described by a couple of JSON files
438in the Chromium workspace:
439
440* [`chromium.gpu.json`](https://chromium.googlesource.com/chromium/src/+/master/testing/buildbot/chromium.gpu.json)
441* [`chromium.gpu.fyi.json`](https://chromium.googlesource.com/chromium/src/+/master/testing/buildbot/chromium.gpu.fyi.json)
442
443These files are autogenerated by the following script:
444
Kenneth Russell8a386d42018-06-02 09:48:01445* [`generate_buildbot_json.py`](https://chromium.googlesource.com/chromium/src/+/master/testing/buildbot/generate_buildbot_json.py)
Kai Ninomiyaa6429fb32018-03-30 01:30:56446
Kenneth Russell8a386d42018-06-02 09:48:01447This script is documented in
448[`testing/buildbot/README.md`](https://chromium.googlesource.com/chromium/src/+/master/testing/buildbot/README.md). The
449JSON files are parsed by the chromium and chromium_trybot recipes, and describe
450two basic types of tests:
Kai Ninomiyaa6429fb32018-03-30 01:30:56451
452* GTests: those which use the Googletest and Chromium's `base/test/launcher/`
453 frameworks.
Kenneth Russell8a386d42018-06-02 09:48:01454* Isolated scripts: tests whose initial entry point is a Python script which
455 follows a simple convention of command line argument parsing.
456
457The majority of the GPU tests are however:
458
459* Telemetry based tests: an isolated script test which is built on the
460 Telemetry framework and which launches the entire browser.
Kai Ninomiyaa6429fb32018-03-30 01:30:56461
462A prerequisite of adding a new test to the bots is that that test [run via
Kenneth Russell8a386d42018-06-02 09:48:01463isolates][new-isolates]. Once that is done, modify `test_suites.pyl` to add the
464test to the appropriate set of bots. Be careful when adding large new test steps
465to all of the bots, because the GPU bots are a limited resource and do not
466currently have the capacity to absorb large new test suites. It is safer to get
467new tests running on the chromium.gpu.fyi waterfall first, and expand from there
468to the chromium.gpu waterfall (which will also make them run against every
469Chromium CL by virtue of the `linux_chromium_rel_ng`, `mac_chromium_rel_ng`,
470`win7_chromium_rel_ng` and `android-marshmallow-arm64-rel` tryservers' mirroring
471of the bots on this waterfall so be careful!).
Kai Ninomiyaa6429fb32018-03-30 01:30:56472
473Tryjobs which add new test steps to the chromium.gpu.json file will run those
474new steps during the tryjob, which helps ensure that the new test won't break
475once it starts running on the waterfall.
476
477Tryjobs which modify chromium.gpu.fyi.json can be sent to the
478`win_optional_gpu_tests_rel`, `mac_optional_gpu_tests_rel` and
479`linux_optional_gpu_tests_rel` tryservers to help ensure that they won't
480break the FYI bots.
481
482## Updating and Adding New Pixel Tests to the GPU Bots
483
484Adding new pixel tests which require reference images is a slightly more
485complex process than adding other kinds of tests which can validate their own
486correctness. There are a few reasons for this.
487
488* Reference image based pixel tests require different golden images for
489 different combinations of operating system, GPU, driver version, OS
490 version, and occasionally other variables.
491* The reference images must be generated by the main waterfall. The try
492 servers are not allowed to produce new reference images, only consume them.
493 The reason for this is that a patch sent to the try servers might cause an
494 incorrect reference image to be generated. For this reason, the main
495 waterfall bots upload reference images to cloud storage, and the try
496 servers download them and verify their results against them.
497* The try servers will fail if they run a pixel test requiring a reference
498 image that doesn't exist in cloud storage. This is deliberate, but needs
499 more thought; see [Issue 349262](http://crbug.com/349262).
500
501If a reference image based pixel test's result is going to change because of a
Xianzhu Wang519b3a4a2018-10-18 04:41:05502change in a third party repository (e.g. in ANGLE), updating the reference
503images is a slightly tricky process. Here's how to do it:
Kai Ninomiyaa6429fb32018-03-30 01:30:56504
Xianzhu Wang519b3a4a2018-10-18 04:41:05505* Mark the pixel test as failing **without platform condition** in the
506 [pixel test]'s [test expectations]
507* Commit the change to the third party repository, etc. which will change the
508 test's results
Kai Ninomiyaa6429fb32018-03-30 01:30:56509* Note that without the failure expectation, this commit would turn some bots
Xianzhu Wang519b3a4a2018-10-18 04:41:05510 red, e.g. an ANGLE change will turn the chromium.gpu.fyi bots red
511* Wait for the third party repository to roll into Chromium
Kai Ninomiyaa6429fb32018-03-30 01:30:56512* Commit a change incrementing the revision number associated with the test
513 in the [test pages]
514* Commit a second change removing the failure expectation, once all of the
515 bots on the main waterfall have generated new reference images. This change
516 should go through the commit queue cleanly.
517
Kai Ninomiyaa6429fb32018-03-30 01:30:56518When adding a brand new pixel test that uses a reference image, the steps are
519similar, but simpler:
520
Xianzhu Wang519b3a4a2018-10-18 04:41:05521* In the same commit which introduces the new test, mark the pixel test as
522 failing **without platform condition** in the [pixel test]'s [test
523 expectations]
Kai Ninomiyaa6429fb32018-03-30 01:30:56524* Wait for the reference images to be produced by all of the GPU bots on the
525 waterfalls (see [chromium-gpu-archive/reference-images])
526* Commit a change un-marking the test as failing
527
Xianzhu Wang519b3a4a2018-10-18 04:41:05528When making a Chromium-side (including Blink which is now in the same Chromium
529repository) change which changes the pixel tests' results:
Kai Ninomiyaa6429fb32018-03-30 01:30:56530
Xianzhu Wang519b3a4a2018-10-18 04:41:05531* In your CL, both mark the pixel test as failing **without platform
532 condition** in the [pixel test]'s [test expectations] and increment the
533 test's version number associated with the test in the [test pages]
Kai Ninomiyaa6429fb32018-03-30 01:30:56534* After your CL lands, land another CL removing the failure expectations. If
535 this second CL goes through the commit queue cleanly, you know reference
536 images were generated properly.
537
538In general, when adding a new pixel test, it's better to spot check a few
539pixels in the rendered image rather than using a reference image per platform.
540The [GPU rasterization test] is a good example of a recently added test which
541performs such spot checks.
542
Xianzhu Wang519b3a4a2018-10-18 04:41:05543[pixel test]: https://chromium.googlesource.com/chromium/src/+/master/content/test/gpu/gpu_tests/pixel_test_pages.py
544[test expectations]: https://chromium.googlesource.com/chromium/src/+/master/content/test/gpu/gpu_tests/pixel_expectations.py
545[test pages]: https://chromium.googlesource.com/chromium/src/+/master/content/test/gpu/gpu_tests/pixel_test_pages.py
Kai Ninomiyaa6429fb32018-03-30 01:30:56546[cloud storage bucket]: https://console.developers.google.com/storage/chromium-gpu-archive/reference-images
547<!-- XXX: old link -->
548[GPU rasterization test]: http://src.chromium.org/viewvc/chrome/trunk/src/content/test/gpu/gpu_tests/gpu_rasterization.py
549
550## Stamping out Flakiness
551
552It's critically important to aggressively investigate and eliminate the root
553cause of any flakiness seen on the GPU bots. The bots have been known to run
554reliably for days at a time, and any flaky failures that are tolerated on the
555bots translate directly into instability of the browser experienced by
556customers. Critical bugs in subsystems like WebGL, affecting high-profile
557products like Google Maps, have escaped notice in the past because the bots
558were unreliable. After much re-work, the GPU bots are now among the most
559reliable automated test machines in the Chromium project. Let's keep them that
560way.
561
562Flakiness affecting the GPU tests can come in from highly unexpected sources.
563Here are some examples:
564
565* Intermittent pixel_test failures on Linux where the captured pixels were
566 black, caused by the Display Power Management System (DPMS) kicking in.
567 Disabled the X server's built-in screen saver on the GPU bots in response.
568* GNOME dbus-related deadlocks causing intermittent timeouts ([Issue
569 309093](http://crbug.com/309093) and related bugs).
570* Windows Audio system changes causing intermittent assertion failures in the
571 browser ([Issue 310838](http://crbug.com/310838)).
572* Enabling assertion failures in the C++ standard library on Linux causing
573 random assertion failures ([Issue 328249](http://crbug.com/328249)).
574* V8 bugs causing random crashes of the Maps pixel test (V8 issues
575 [3022](https://code.google.com/p/v8/issues/detail?id=3022),
576 [3174](https://code.google.com/p/v8/issues/detail?id=3174)).
577* TLS changes causing random browser process crashes ([Issue
578 264406](http://crbug.com/264406)).
579* Isolated test execution flakiness caused by failures to reliably clean up
580 temporary directories ([Issue 340415](http://crbug.com/340415)).
581* The Telemetry-based WebGL conformance suite caught a bug in the memory
582 allocator on Android not caught by any other bot ([Issue
583 347919](http://crbug.com/347919)).
584* context_lost test failures caused by the compositor's retry logic ([Issue
585 356453](http://crbug.com/356453)).
586* Multiple bugs in Chromium's support for lost contexts causing flakiness of
587 the context_lost tests ([Issue 365904](http://crbug.com/365904)).
588* Maps test timeouts caused by Content Security Policy changes in Blink
589 ([Issue 395914](http://crbug.com/395914)).
590* Weak pointer assertion failures in various webgl\_conformance\_tests caused
591 by changes to the media pipeline ([Issue 399417](http://crbug.com/399417)).
592* A change to a default WebSocket timeout in Telemetry causing intermittent
593 failures to run all WebGL conformance tests on the Mac bots ([Issue
594 403981](http://crbug.com/403981)).
595* Chrome leaking suspended sub-processes on Windows, apparently a preexisting
596 race condition that suddenly showed up ([Issue
597 424024](http://crbug.com/424024)).
598* Changes to Chrome's cross-context synchronization primitives causing the
599 wrong tiles to be rendered ([Issue 584381](http://crbug.com/584381)).
600* A bug in V8's handling of array literals causing flaky failures of
601 texture-related WebGL 2.0 tests ([Issue 606021](http://crbug.com/606021)).
602* Assertion failures in sync point management related to lost contexts that
603 exposed a real correctness bug ([Issue 606112](http://crbug.com/606112)).
604* A bug in glibc's `sem_post`/`sem_wait` primitives breaking V8's parallel
605 garbage collection ([Issue 609249](http://crbug.com/609249)).
Kenneth Russelld5efb3f2018-05-11 01:40:45606* A change to Blink's memory purging primitive which caused intermittent
607 timeouts of WebGL conformance tests on all platforms ([Issue
608 840988](http://crbug.com/840988)).
Kai Ninomiyaa6429fb32018-03-30 01:30:56609
610If you notice flaky test failures either on the GPU waterfalls or try servers,
611please file bugs right away with the component Internals>GPU>Testing and
612include links to the failing builds and copies of the logs, since the logs
613expire after a few days. [GPU pixel wranglers] should give the highest priority
614to eliminating flakiness on the tree.
615
616[GPU pixel wranglers]: pixel_wrangling.md