testsuite: show the number of failures after a test run
authorDan Fandrich <dan@coneharvesters.com>
Sun, 29 Aug 2010 02:47:03 +0000 (04:47 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 29 Aug 2010 02:47:03 +0000 (04:47 +0200)
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
testsuite/bunzip2.tests
testsuite/bzcat.tests
testsuite/readlink.tests
testsuite/runtest

index 734acbb75f6c64857e65aa391c069a1ae5889cc4..827aee867d6dd511f3a8e3334f669eb876239a6d 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 # Used by both gunzip and bunzip2 tests
 
+FAILCOUNT=0
+
 if test "${0##*/}" = "gunzip.tests"; then
     unpack=gunzip
     ext=gz
@@ -473,6 +475,7 @@ check() {
        echo "PASS: $1"
     else
        echo "FAIL: $1"
+       FAILCOUNT=$((FAILCOUNT + 1))
     fi
 }
 
@@ -520,5 +523,8 @@ if test "${0##*/}" = "bunzip2.tests"; then
        echo "PASS: $unpack: test bz2 file"
     else
        echo "FAIL: $unpack: test bz2 file"
+       FAILCOUNT=$((FAILCOUNT + 1))
     fi
 fi
+
+exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))
index 78d74f22995a218ef1829b2ebdc621d7dce3b765..5b4f3f4b317c2644f658c94823e2ccb89e3cd4e6 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+FAILCOUNT=0
+
 ext=bz2
 
 bb="busybox "
@@ -35,6 +37,7 @@ check() {
        echo "PASS: $1"
     else
        echo "FAIL: $1"
+       FAILCOUNT=$((FAILCOUNT + 1))
     fi
 }
 
@@ -47,3 +50,5 @@ prep; check "bzcat: dont delete src" "${bb}bzcat t2.bz2; test -f t2.bz2 && echo
 
 )
 rm -rf testdir
+
+exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))
index 73163b0778da915c47a2b79b9c67765dc3a714c7..c7fc8adf008d390c0e52071ae0506d574e630a8d 100755 (executable)
@@ -29,3 +29,5 @@ testing "readlink -f on a wierd dir" "readlink -f $TESTDIR/../$TESTFILE" "$PWD/$
 
 # clean up
 rm -r "$TESTLINK" "$TESTDIR"
+
+exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))
index c300233cd025ccd256d77927d75e15a509650ba1..9a4fccbbf89cb38714129cf346893ab0754bed1f 100755 (executable)
@@ -4,6 +4,8 @@
 
 . ./testing.sh
 
+total_failed=0
+
 # Run one old-style test.
 # Tests are stored in applet/testcase shell scripts.
 # They are run using "sh -x -e applet/testcase".
@@ -73,6 +75,7 @@ run_oldstyle_applet_tests()
                        *.r[0-9]*) continue ;; # svn-produced junk
                esac
                run_applet_testcase "$applet" "$testcase" || status=1
+               total_failed=$((total_failed + status))
        done
        return $status
 }
@@ -150,7 +153,10 @@ for applet in $applets; do
                fi
 #              echo "Running test $tsdir/$applet.tests"
                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
 done
 
@@ -158,6 +164,6 @@ done
 #rm -rf "$LINKSDIR"
 
 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
 exit $status