diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-03-28 15:43:47 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-03-28 15:43:47 +0000 |
commit | 42ab86520e08d8b598f46b7a4754b2730e55f173 (patch) | |
tree | 357298d999b5882955daff11c61f488ef8b94cee | |
parent | 25a6ca0dd4866d9b8e6cf140b119e1c434859719 (diff) |
make sure we exit based on test failure rather than always exiting with 0
-rwxr-xr-x | shell/hush_test/run-all | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/shell/hush_test/run-all b/shell/hush_test/run-all index b79af2f67..b5db79f6c 100755 --- a/shell/hush_test/run-all +++ b/shell/hush_test/run-all @@ -25,6 +25,7 @@ do_test() test -d "$1" || return 0 # echo Running tests in directory "$1" ( + tret=0 cd "$1" || { echo "cannot cd $1!"; exit 1; } for x in run-*; do test -f "$x" || continue @@ -48,26 +49,31 @@ do_test() { "$THIS_SH" "./$x" >"$name.xx" 2>&1 diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail" - } && echo "$1/$x: ok" || echo "$1/$x: fail" + } && echo "$1/$x: ok" || { echo "$1/$x: fail"; ((tret+=1)); } done + exit ${tret} ) } # Main part of this script # Usage: run-all [directories] +ret=0 + if [ $# -lt 1 ]; then # All sub directories modules=`ls -d hush-*` for module in $modules; do - do_test $module + do_test $module || ret=1 done else while [ $# -ge 1 ]; do if [ -d $1 ]; then - do_test $1 + do_test $1 || ret=1 fi shift done fi + +exit ${ret} |