agents/skills/conditional_testing/SKILL.md
This skill documents how to use conditional testing to optimize the testing workflow in V8.
Running the full V8 test suite can be time-consuming. Conditional testing saves time and resources by checking if tests are actually needed. It will build and/or run tests only if:
d8 executable is missing or out of date relative to modified source files
(detected via git diff and git ls-files).d8 executable is newer than the last successful test run.For regular users, conditional testing is enabled by default when executing
a full test suite (e.g. check).
gm.py x64.release.check
If nothing has changed, it will silently exit without rebuilding or re-running
tests. If only test files changed, it will re-run the tests without building. If
you explicitly request a subset of tests (e.g.,
gm.py x64.release mjsunit/foo), the tests will run unconditionally.
For automated agents, you can use the --ensure-tests-ran flag without
specifying a target configuration. This will automatically detect the most
recently built configuration in out/ and run the tests (if needed) for that
specific configuration.
tools/dev/gm.py --ensure-tests-ran
git diff origin/main and
git ls-files --others to efficiently find files modified in the worktree.test/ and
tools/ directories) are modified since d8 was last built, a build is
triggered.d8 with a cached
timestamp in <outdir>/last_test_run. If d8 is newer, tests are run.test/ directory is newer than
last_test_run, tests are run.<outdir>/last_test_run file timestamp.gm.py --ensure-tests-ran for background checking.d8 or remove the
last_test_run file.