testsuite: show the number of failures after a test run

Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Dan Fandrich 2010-08-29 04:47:03 +02:00 committed by Denys Vlasenko
parent 91234b9be0
commit 140ac91fe1
4 changed files with 21 additions and 2 deletions

View File

@ -1,6 +1,8 @@
#!/bin/sh #!/bin/sh
# Used by both gunzip and bunzip2 tests # Used by both gunzip and bunzip2 tests
FAILCOUNT=0
if test "${0##*/}" = "gunzip.tests"; then if test "${0##*/}" = "gunzip.tests"; then
unpack=gunzip unpack=gunzip
ext=gz ext=gz
@ -473,6 +475,7 @@ check() {
echo "PASS: $1" echo "PASS: $1"
else else
echo "FAIL: $1" echo "FAIL: $1"
FAILCOUNT=$((FAILCOUNT + 1))
fi fi
} }
@ -520,5 +523,8 @@ if test "${0##*/}" = "bunzip2.tests"; then
echo "PASS: $unpack: test bz2 file" echo "PASS: $unpack: test bz2 file"
else else
echo "FAIL: $unpack: test bz2 file" echo "FAIL: $unpack: test bz2 file"
FAILCOUNT=$((FAILCOUNT + 1))
fi fi
fi fi
exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))

View File

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
FAILCOUNT=0
ext=bz2 ext=bz2
bb="busybox " bb="busybox "
@ -35,6 +37,7 @@ check() {
echo "PASS: $1" echo "PASS: $1"
else else
echo "FAIL: $1" echo "FAIL: $1"
FAILCOUNT=$((FAILCOUNT + 1))
fi fi
} }
@ -47,3 +50,5 @@ prep; check "bzcat: dont delete src" "${bb}bzcat t2.bz2; test -f t2.bz2 && echo
) )
rm -rf testdir rm -rf testdir
exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))

View File

@ -29,3 +29,5 @@ testing "readlink -f on a wierd dir" "readlink -f $TESTDIR/../$TESTFILE" "$PWD/$
# clean up # clean up
rm -r "$TESTLINK" "$TESTDIR" rm -r "$TESTLINK" "$TESTDIR"
exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))

View File

@ -4,6 +4,8 @@
. ./testing.sh . ./testing.sh
total_failed=0
# Run one old-style test. # Run one old-style test.
# Tests are stored in applet/testcase shell scripts. # Tests are stored in applet/testcase shell scripts.
# They are run using "sh -x -e applet/testcase". # They are run using "sh -x -e applet/testcase".
@ -73,6 +75,7 @@ run_oldstyle_applet_tests()
*.r[0-9]*) continue ;; # svn-produced junk *.r[0-9]*) continue ;; # svn-produced junk
esac esac
run_applet_testcase "$applet" "$testcase" || status=1 run_applet_testcase "$applet" "$testcase" || status=1
total_failed=$((total_failed + status))
done done
return $status return $status
} }
@ -150,7 +153,10 @@ for applet in $applets; do
fi fi
# echo "Running test $tsdir/$applet.tests" # echo "Running test $tsdir/$applet.tests"
PATH="$LINKSDIR:$tsdir:$bindir:$PATH" \ PATH="$LINKSDIR:$tsdir:$bindir:$PATH" \
"$tsdir/$applet.tests" || status=1 "$tsdir/$applet.tests"
rc=$?
total_failed=$((total_failed + rc))
test $rc -ne 0 && status=1
fi fi
done done
@ -158,6 +164,6 @@ done
#rm -rf "$LINKSDIR" #rm -rf "$LINKSDIR"
if [ $status -ne 0 ] && [ x"$VERBOSE" = x ]; then if [ $status -ne 0 ] && [ x"$VERBOSE" = x ]; then
echo "Failures detected, running with -v (verbose) will give more info" echo "$total_failed failure(s) detected; running with -v (verbose) will give more info"
fi fi
exit $status exit $status