Skip to content

Commit

Permalink
Merge pull request #40358 from jbytheway/generalize_reduce_tests
Browse files Browse the repository at this point in the history
Generalize reduce_tests tool
  • Loading branch information
ZhilkinSerg authored May 9, 2020
2 parents 442916a + 2b3f1e7 commit 37a0602
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
26 changes: 25 additions & 1 deletion tools/reduce_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,36 @@ shift

export REDUCE_TESTS_EXTRA_OPTS="$*"

# Figure out which test executable to use
test_exe=

for potential_test_exe in ./tests/cata_test ./cata_test ./cata_test-tiles
do
if [ -x "$potential_test_exe" ]
then
if [ -z "$test_exe" -o "$potential_test_exe" -nt "$test_exe" ]
then
test_exe=$potential_test_exe
fi
fi
done

if [ -z "$test_exe" ]
then
echo "You don't seem to have compiled any test executable" >&2
exit 1
else
printf "Using test executable '%s'\n" "$test_exe"
fi

export REDUCE_TESTS_TEST_EXE=$test_exe

# For some reason the following cata_test command returns 140, rather than 0 (success).
# Not sure why.

# We have to add braces around the lines to avoid topformflat messing up the file.
# The braces are removed again inside our helper script.
./tests/cata_test --list-test-names-only '~[.]' | \
"$test_exe" --list-test-names-only '~[.]' | \
grep '[^ ]' | sed 's/.*/{&}/' > list_of_tests || true
multidelta tools/reduce_tests_helper.sh list_of_tests

Expand Down
2 changes: 1 addition & 1 deletion tools/reduce_tests_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ then
exit 1
fi

if ./tests/cata_test -d yes --abort --rng-seed "$rng_seed" \
if "$REDUCE_TESTS_TEST_EXE" -d yes --abort --rng-seed "$rng_seed" \
$REDUCE_TESTS_EXTRA_OPTS \
-f <(tr -d '{}' < "$multidelta_all_files")
then
Expand Down

0 comments on commit 37a0602

Please sign in to comment.