From cd86518f4b51e3ec7751df6762de35e983fb3717 Mon Sep 17 00:00:00 2001 From: Neil Hemingway Date: Tue, 19 May 2015 17:00:58 +0100 Subject: [PATCH] Add a rough and ready indication of which tests failed --- tests.sh | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/tests.sh b/tests.sh index 7107f28..f18937a 100755 --- a/tests.sh +++ b/tests.sh @@ -1,8 +1,31 @@ #!/bin/bash -for f in test/test_*.tcl -do - if [ 'tclsh' == "$1" ] ; then tclsh "$f"; - elif [ 'jtcl' == "$1" ] ; then jtcl "$f"; + +function run_test() { + if [ 'tclsh' == "$1" ] ; then tclsh "$2"; + elif [ 'jtcl' == "$1" ] ; then jtcl "$2"; else echo "Usage: ./tests.sh [jtcl|tclsh]"; exit 1; fi +} + +failures=() + +for file in test/test_*.tcl +do + run_test "$1" "$file" + if [ $? -gt 0 ] ; then + failures+=($file) + fi done + +echo "Test Summary" +echo "============" +if [ ${#failures[@]} -gt 0 ] ; then + echo ${#failures[@]} " tests failed:" + for failure in ${failures[@]} ; do + echo " ${failure}" + done + exit ${#failures[@]} +else + echo "All tests successful" + exit 0 +fi