From: Theodore Ts'o Date: Tue, 7 Jun 2016 14:47:20 +0000 (-0400) Subject: tests: teach test_script the --failed option X-Git-Tag: v1.43.1~8 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=ded919125a9e4a89d856984e1bfa21f70a8092dd;p=tools%2Fe2fsprogs.git 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 --- diff --git a/tests/test_script.in b/tests/test_script.in index 41ad104..9959e30 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