diff options
author | David Kalnischkies <david@kalnischkies.de> | 2014-01-17 01:02:47 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2014-01-17 01:02:47 +0100 |
commit | 0954c58eeb07f5c3c6e6385e0547924a4917c21d (patch) | |
tree | a99b929bf657feb3ac1bbd898ce179ae83f51343 /test/integration/run-tests | |
parent | 77a45bebc9168b396334630ef109c1d48ddaf930 (diff) |
improve stdout/stderr usage correctness in test framework
Also adds a friendly note about how many tests were run/passed so that
the end of the testrun isn't all that negative by just showing fails.
(It now tells us that we have 111 tests at the moment!)
Git-Dch: Ignore
Diffstat (limited to 'test/integration/run-tests')
-rwxr-xr-x | test/integration/run-tests | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/test/integration/run-tests b/test/integration/run-tests index 7316016e2..881c1c56b 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -2,6 +2,9 @@ set -e FAIL=0 +PASS=0 +ALL=0 + FAILED_TESTS="" DIR=$(readlink -f $(dirname $0)) if [ "$1" = "-q" ]; then @@ -29,18 +32,23 @@ for testcase in $(run-parts --list $DIR | grep '/test-'); do echo "${CTEST}Run Testcase ${CHIGH}$(basename ${testcase})${CRESET}" fi if ! ${testcase}; then - FAIL=$((FAIL+1)) - FAILED_TESTS="$FAILED_TESTS $(basename $testcase)" - echo "$(basename $testcase) ... FAIL" - fi + FAIL=$((FAIL+1)) + FAILED_TESTS="$FAILED_TESTS $(basename $testcase)" + echo >&2 "$(basename $testcase) ... FAIL" + else + PASS=$((PASS+1)) + fi + ALL=$((ALL+1)) if [ "$MSGLEVEL" -le 2 ]; then echo fi done -echo "failures: $FAIL" -if [ -n "$FAILED_TESTS" ]; then - echo "Failed tests: $FAILED_TESTS"; +echo >&2 "Statistics: $ALL tests were run: $PASS successfully and $FAIL failed" +if [ -n "$FAILED_TESTS" ]; then + echo >&2 "Failed tests: $FAILED_TESTS" +else + echo >&2 'All tests seem to have been run successfully. What could possibly go wrong?' fi # ensure we don't overflow exit $((FAIL <= 255 ? FAIL : 255)) |