diff options
Diffstat (limited to 'src/templating/dotest.sh')
-rwxr-xr-x | src/templating/dotest.sh | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/templating/dotest.sh b/src/templating/dotest.sh index 99ff8b201..32f575c2e 100755 --- a/src/templating/dotest.sh +++ b/src/templating/dotest.sh @@ -1,20 +1,26 @@ #!/bin/sh -mustach=${mustach:-../mustach} -echo starting test -if test "$NOVALGRIND" = 1 +# Exit, with error message (hard failure) +exit_fail() { + echo " FAIL: " "$@" >&2 + exit 1 +} + +mustach="${mustach:-../mustach}" +echo "starting test" +if ! valgrind --version 2> /dev/null then - $mustach "$@" > resu.last + $mustach "$@" > resu.last || exit_fail "ERROR! mustach command failed ($?)!" else - valgrind $mustach "$@" > resu.last 2> vg.last + valgrind $mustach "$@" > resu.last 2> vg.last || exit_fail "ERROR! valgrind + mustach command failed ($?)!" sed -i 's:^==[0-9]*== ::' vg.last - awk '/^ *total heap usage: .* allocs, .* frees,.*/{if($$4-$$6)exit(1)}' vg.last || echo "ERROR! Alloc/Free issue" + awk '/^ *total heap usage: .* allocs, .* frees,.*/{if($$4-$$6)exit(1)}' vg.last || exit_fail "ERROR! Alloc/Free issue" fi if diff -w resu.ref resu.last then echo "result ok" else - echo "ERROR! Result differs" + exit_fail "ERROR! Result differs" fi echo - +exit 0 |