summaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-02-11 11:14:10 -0500
committerTavian Barnes <tavianator@tavianator.com>2017-02-11 11:14:10 -0500
commit56561ac76421f0898eebc76b3d0722e95014433c (patch)
tree27a2cdf0c2a97b5aa7f51bf71676e4fd6f88283d /tests.sh
parentb30e1f47363f9b378c5860182ca570d66687488f (diff)
downloadbfs-56561ac76421f0898eebc76b3d0722e95014433c.tar.xz
tests: Print the count of passing and failing tests
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh27
1 files changed, 14 insertions, 13 deletions
diff --git a/tests.sh b/tests.sh
index f2eb26d..f991823 100755
--- a/tests.sh
+++ b/tests.sh
@@ -1039,7 +1039,8 @@ function test_precedence() {
bfs_diff basic \( -name foo -type d -o -name bar -a -type f \) -print , \! -empty -type f -print
}
-result=0
+passed=0
+failed=0
for test in ${!run_*}; do
test=${test#run_}
@@ -1053,22 +1054,22 @@ for test in ${!run_*}; do
("$test" "$dir")
status=$?
- if [ $status -ne 0 ]; then
+ if [ $status -eq 0 ]; then
+ ((++passed))
+ else
+ ((++failed))
echo "$test failed!"
- result=$status
fi
done
-if [ $result -eq 0 ]; then
- status=passed
-else
- status=failed
-fi
-
if [ -t 1 ]; then
- printf '\r\033[Jtests %s\n' "$status"
-else
- echo "tests $status"
+ printf '\r\033[J'
fi
-exit $result
+if [ $passed -gt 0 ]; then
+ echo "tests passed: $passed"
+fi
+if [ $failed -gt 0 ]; then
+ echo "tests failed: $failed"
+ exit 1
+fi