Skip to content

Commit 216a578

Browse files
committed
Streamline reduce_tests.sh a bit
Swaps from multidelta that makes things more difficult without giving any new features to singledelta Adds a stub showing how to test for a target output string instead of test success
1 parent 7c79bb4 commit 216a578

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

tools/reduce_tests.sh

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
#!/bin/bash
22

3-
# A helper script to use multidelta to reduce to a minimal set of tests to
4-
# reproduce a failure.
3+
# A helper script to use delta/singledelta to reduce to a minimal set of
4+
# tests to reproduce a failure.
55
# Sometimes the tests interact in unexpected ways, so you need to run two
66
# or three tests in order to cause the failure to occur. It's tiresome to
77
# determine a minimal subset of tests by hand; this script automates it.
88

99
# I think https://github.com/DRMacIver/structureshrink would be better than
10-
# multidelta for this; multidelta requires strange workarounds. But
11-
# multidelta is readily available in most distributions' packages, so using
12-
# that.
10+
# delta for this; delta requires strange workarounds. But delta is readily
11+
# available in most distributions' packages, so using that.
1312

1413
set -ue
1514

16-
if ! which multidelta &>/dev/null
15+
if ! which singledelta &>/dev/null
1716
then
18-
echo "multidelta not found. Please install it to use this script" >&2
17+
echo "singledelta not found. Please install it to use this script" >&2
1918
exit 1
2019
fi
2120

@@ -60,8 +59,7 @@ export REDUCE_TESTS_TEST_EXE=$test_exe
6059

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

6765
# vim:tw=0

tools/reduce_tests_helper.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@
55
set -uex
66

77
# Disallow empty test list
8-
if [ ! -s "$multidelta_all_files" ]
8+
if [ ! -s "$1" ]
99
then
1010
exit 1
1111
fi
1212

13+
# return 0 iff the expected error is emitted
14+
15+
# If you have a test string to watch for, add it here and comment out the later check for test success.
16+
#"$REDUCE_TESTS_TEST_EXE" -d yes --rng-seed "$rng_seed" \
17+
# $REDUCE_TESTS_EXTRA_OPTS \
18+
# -f <(tr -d '{}' < <(cat $1)) 2>&1 | tee -a reduce_tests.log | grep -q '../tests/monster_test.cpp:1008: FAILED:'
19+
20+
1321
if "$REDUCE_TESTS_TEST_EXE" -d yes --abort --rng-seed "$rng_seed" \
1422
$REDUCE_TESTS_EXTRA_OPTS \
1523
-f <(tr -d '{}' < "$multidelta_all_files")

0 commit comments

Comments
 (0)