From ded919125a9e4a89d856984e1bfa21f70a8092dd Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 7 Jun 2016 10:47:20 -0400 Subject: [PATCH] tests: teach test_script the --failed option Teach test_script the --failed option, which asks it to rerun the tests that had previously failed. Signed-off-by: Theodore Ts'o --- tests/test_script.in | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/tests/test_script.in b/tests/test_script.in index 41ad104b..9959e308 100644 --- a/tests/test_script.in +++ b/tests/test_script.in @@ -5,24 +5,44 @@ case "$1" in --valgrind) export USE_VALGRIND="valgrind -q --sim-hints=lax-ioctls" - shift; + shift ;; --valgrind-leakcheck) export USE_VALGRIND="valgrind --sim-hints=lax-ioctls --leak-check=full --show-reachable=yes --log-file=/tmp/valgrind-%p.log" - shift; + shift + ;; + --failed) + DO_FAILED=yes + shift ;; esac -if test "$1"x = x ; then - TESTS=`ls -d $SRCDIR/[a-zA-Z]_*` -else - TESTS= - for i; do - case $i in +TESTS= + +if test -n "$DO_FAILED"; then + FAILED=$(find . -maxdepth 1 -name \*.failed) + if test -z "$FAILED" ; then + echo " " + echo "No (more) failed tests!" + echo " " + fi + for fname in $FAILED ; do + TESTS="$TESTS $SRCDIR/${fname%%.failed}" + done +fi + +for i; do + case $i in [a-zA-Z]) TESTS="$TESTS $SRCDIR/${i}_*" ;; *) TESTS="$TESTS $SRCDIR/$i" ;; - esac - done + esac +done + +if test "$TESTS"x = x ; then + if test -n "DO_FAILED"; then + exit 0 + fi + TESTS=`ls -d $SRCDIR/[a-zA-Z]_*` fi for test_dir in $TESTS; do