summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2013-03-18 11:38:19 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2013-03-18 11:38:19 +0100
commitf91bd741d223395cc3b1a609459e7d7226916e86 (patch)
tree51d11956294706a4aacb45ecb9271e4c047a1e7b /test
parent8c1dd12cb53ce141d8ade2c8abc619dcfa7f37a1 (diff)
report failures via exit and ensure we don't overflow
Diffstat (limited to 'test')
-rw-r--r--test/integration/framework11
-rwxr-xr-xtest/integration/run-tests3
2 files changed, 10 insertions, 4 deletions
diff --git a/test/integration/framework b/test/integration/framework
index 883b65bba..cdaa20627 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -1,6 +1,6 @@
#!/bin/sh -- # no runable script, just for vi
-TESTFAILURES="no"
+TESTFAILURES=0
# we all like colorful messages
if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null && \
@@ -38,7 +38,7 @@ msgtest() {
}
msgpass() { echo "${CPASS}PASS${CNORMAL}" >&2; }
msgskip() { echo "${CWARNING}SKIP${CNORMAL}" >&2; }
-msgfail() { echo "${CFAIL}FAIL${CNORMAL}" >&2; TESTFAILURES="yes"; }
+msgfail() { echo "${CFAIL}FAIL${CNORMAL}" >&2; TESTFAILURES=$((TESTFAILURES+1)); }
# enable / disable Debugging
MSGLEVEL=${MSGLEVEL:-3}
@@ -116,7 +116,12 @@ gdb() {
}
exitwithstatus() {
- [ "$TESTFAILURES" = "yes" ] && exit 1 || exit 0;
+ # error if we about to overflow, but ...
+ # "255 failures ought to be enough for everybody"
+ if [ $TESTFAILURES -gt 255 ]; then
+ msgdie "Total failure count $TESTFAILURES too big"
+ fi
+ exit $((TESTFAILURES <= 255 ? TESTFAILURES : 255));
}
addtrap() {
diff --git a/test/integration/run-tests b/test/integration/run-tests
index 75f2ad662..18474b20f 100755
--- a/test/integration/run-tests
+++ b/test/integration/run-tests
@@ -37,4 +37,5 @@ for testcase in $(run-parts --list $DIR | grep '/test-'); do
done
echo "failures: $FAIL"
-exit $FAIL
+# ensure we don't overflow
+exit $((FAIL <= 255 ? FAIL : 255))