A common use-case is to want to re-run failed tests from a trybot locally.
It would be great if the test runner had a copy & pastable message at the end saying "to re-run only failed tests, run: BLAH"
Tests can take filter flags from a file via --gtest-filter-file
They can also take them directly via --test-filter
some docs: https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#running-a-subset-of-the-tests
If the number of failed tests is really long, then it's not really practical to use --test-filter, but using a file would work. However, this doesn't actually address running tests from a bot locally.... But OTOH, if a lot of tests failed, maybe you only want to run the first N failing ones locally anyways!
Example message:
3 tests failed.
To re-run failing tests:
out/Debug/bin/run_foo_tests $EXISTING_FLAGS_MINUS_FILTER_ARGS --test-filter "org.chromium.chrome.FooTest#bar:org.chromium.chrome.FooTest#baz:org.chromium.chrome.FooTest#zaz"
Or, for a longer list:
To re-run the first 20 failing tests:
out/Debug/bin/run_foo_tests $EXISTING_FLAGS_MINUS_FILTER_ARGS --test-filter-file <(cat <<EOF
org.chromium.chrome.FooTest#bar
org.chromium.chrome.FooTest#baz
org.chromium.chrome.FooTest#zaz
... 17 more...
EOF
)
^^ $EXISTING_FLAGS_MINUS_FILTER_ARGS will need to be extracted from sys.argv.
Comment 1 by agrieve@chromium.org
, Jan 14