tree: f4cf4eeafd3a77a5ab51b9c780116272e3eab9eb
  1. finders/
  2. utils/
  3. .vpython3
  4. __init__.py
  5. autotest_test.py
  6. DIR_METADATA
  7. filters.py
  8. main.py
  9. OWNERS
  10. PRESUBMIT.py
  11. README.md
  12. test_executor.py
autotest/README.md

Autotest

The script eliminates the manual overhead of finding which build target contains a specific test. Whether you provide a filename, a directory, or just a test case name, the script:

  1. Resolves the input into concrete file paths.
  2. Identifies the correct GN build targets.
  3. Compiles the targets using AutoNinja.
  4. Executes the tests with the appropriate filters.

Usage & Examples

In the case when the Current Working Directory (CWD) is not the build directory or the environment variable export CHROMIUM_OUTPUT_DIR is not set, the script requires a build directory specified via -C.

Common Commands

  • Run a specific file: autotest.py base/pickle_unittest.cc
  • Run all tests in a directory: autotest.py -C out/Default base/strings/
  • Search and run by test name: autotest.py -C out/Default StringUtilTest.IsStringUTF8
  • Run tests modified in your current Git branch: autotest.py -C out/Default --run-changed
  • Run tests related to modified files in your current Git branch: autotest.py -C out/Default --run-related
  • Run a specific line (useful for editor integration): autotest.py -C out/Default --line 42 base/pickle_unittest.cc

To see other command line flags run with --help


Pro Tips

  • Passthrough Arguments: Any arguments not recognized by autotest.py are passed directly to the underlying test runner.
  • Performance: If you are working in a large repository within COG, it is recommended to use -r if cs is available to avoid slow local disk I/O.