Path: blob/main_old/src/tests/test_utils/runner/README.md
2585 views
ANGLE Test Harness
The ANGLE test harness is a harness around GoogleTest that provides functionality similar to the Chromium test harness. It features:
splitting a test set into shards
catching and reporting crashes and timeouts
outputting to the Chromium JSON test results format
multi-process execution
Command-Line Arguments
The ANGLE test harness accepts all standard GoogleTest arguments. The harness also accepts the following additional command-line arguments:
--batch-sizelimits the number of tests to run in each batch--batch-timeoutlimits the amount of time spent in each batch--bot-modeenables multi-process execution and test batching--debug-test-groupsdumps the test config categories when usingbot-mode--filter-fileallows passing a largergtest_filtervia a file--histogram-json-fileoutputs a formatted JSON file for perf dashboards--max-processeslimits the number of simuntaneous processes--results-directoryspecifies a directory to write test results to--results-filespecifies a location for the JSON test result output--shard-countand--shard-indexcontrol the test sharding--test-timeoutlimits the amount of time spent in each test--flaky-retriesallows for tests to fail a fixed number of times and still pass--disable-crash-handlerforces off OS-level crash handling--isolated-outdirspecifies a test artifacts directory--max-failuresspecifies a count of failures after which the harness early exits.
--isolated-script-test-output and --isolated-script-perf-test-output mirror --results-file and --histogram-json-file respectively.
As well as the custom command-line arguments we support a few standard GoogleTest arguments:
gtest_filterworks as it normally does with GoogleTestgtest_also_run_disabled_testsworks as it normally does as well
Other GoogleTest arguments are not supported although they may work.
Implementation Notes
The test harness only requires
angle_commonandangle_util.It does not depend on any Chromium browser code. This allows us to compile on other non-Clang platforms.
It uses rapidjson to read and write JSON files.
Test execution is not currently deterministic in multi-process mode.
Normal Mode vs Bot Mode
The test runner has two main modes of operation: normal and bot mode.
During normal mode:
Tests are executed single-process and single-thread.
The test runner executes the GoogleTest Run function.
We use a
TestEventListenerto record test results for our output JSON file.A watchdog thread will force a fast exit if no test results get recorded after a timeout.
Crashes are handled via ANGLE's test crash handling code.
During bot mode:
Tests are run in multiple processes depending on the system processor count.
A server process records the child processes' stdout and stderr.
The server terminates a child process if there's no progress after a timeout.
The server sorts work into batches according to the back-end configuration.
This prevents driver errors from using multiple back-ends in the same process.
Batches are striped to help split up slow groups of tests.
The server passes test batches to child processes via a
gtest_filterfile.Bot mode does not work on Android or Fuchsia.
See the source code for more details: TestSuite.h and TestSuite.cpp.
Potential Areas of Improvement
Deterministic test execution.
Using sockets to communicate with test children. Similar to dEQP's test harness.
Closer integration with ANGLE's test expectations and system config libraries.
Supporting a GoogleTest-free integration.