diff options
author | Damien Martin-Guillerez <dmarting@google.com> | 2015-09-23 09:32:36 +0000 |
---|---|---|
committer | Lukacs Berki <lberki@google.com> | 2015-09-23 10:32:56 +0000 |
commit | 446b6c904c1edea2928000c407b4578b7dbe9aa0 (patch) | |
tree | 5d359b9a5a734ba259f63ab49f877c1ffa3b4dd7 /src | |
parent | 89eefd710afb7428bff331a9ae4c2e84d2a21624 (diff) |
Do not fail when the test argument do not match any test
Bazel test environment set -eu and when giving an argument
to the test suite, the for loop matching for test to run
was returning an error, resulting in the whole test to fails.
--
MOS_MIGRATED_REVID=103727268
Diffstat (limited to 'src')
-rw-r--r-- | src/test/shell/unittest.bash | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/test/shell/unittest.bash b/src/test/shell/unittest.bash index 82aeb5dfa2..940f1217a5 100644 --- a/src/test/shell/unittest.bash +++ b/src/test/shell/unittest.bash @@ -103,7 +103,14 @@ TESTS=() # A subset or "working set" of test # default, all tests called test_* are # run. if [ $# -gt 0 ]; then - TESTS=($(for i in $@; do echo $i; done | grep ^test_)) + # Legacy behavior is to ignore missing regexp, but with errexit + # the following line fails without || true. + # TODO(dmarting): maybe we should revisit the way of selecting + # test with that framework (use Bazel's environment variable instead). + TESTS=($(for i in $@; do echo $i; done | grep ^test_ || true)) + if (( ${#TESTS[@]} == 0 )); then + echo "WARNING: Arguments do not specifies tests!" >&2 + fi fi TEST_verbose=true # Whether or not to be verbose. A |