From 5965a851517cdff192dff490a5836798607cecc9 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 5 Apr 2014 10:39:38 -0400 Subject: [PATCH] - Bug TW-1296 - TW-1296 make test/run_all exit with non-zero code if a test fail (thanks to Jakub Wilk). --- ChangeLog | 2 ++ test/run_all.in | 7 +++++-- test/test.cpp | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3837ff8ba..6f8e16982 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,6 +37,8 @@ Bugs - TW-1282 incorrect URLs in man task-sync (thanks to Jeremiah Marks). - TW-1288 Added missing locking for task modifications (thanks to Kosta H, Ralph Bean, Adam Coddington). +- TW-1296 make test/run_all exit with non-zero code if a test fail (thanks to + Jakub Wilk). - #1511 sync init crashes if client certification file is empty or invalid (thanks to Marton Suranyi). - #1508 Show command highlight configuration (thanks to Nicolas Appriou). diff --git a/test/run_all.in b/test/run_all.in index 25ac62f44..204b8fd96 100755 --- a/test/run_all.in +++ b/test/run_all.in @@ -1,5 +1,6 @@ #! /bin/sh +rc=0 if [ x"$1" = x"--verbose" ]; then for i in ${TESTBLOB} @@ -9,9 +10,10 @@ then while read LINE do echo "$LINE" - done < test.log + done < test.log || rc=1 rm test.log done + exit $rc else date > all.log @@ -37,7 +39,7 @@ else COUNT=`expr $COUNT + 1` fi - $i >> all.log 2>&1 + $i >> all.log 2>&1 || rc=1 done if [ $BAR -eq 1 ]; then @@ -53,4 +55,5 @@ else printf "Fail: %5d\n" `grep -c '^not' all.log` printf "Skipped: %5d\n" `grep -c '^skip' all.log` printf "Runtime: %5d seconds\n" $RUNTIME + exit $rc fi diff --git a/test/test.cpp b/test/test.cpp index 718df542b..07234e20c 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include /////////////////////////////////////////////////////////////////////////////// @@ -84,6 +85,7 @@ UnitTest::~UnitTest () << " skipped. " << std::setprecision (3) << percentPassed << "% passed.\n"; + exit (_failed > 0); } ///////////////////////////////////////////////////////////////////////////////