From: Michael Jeanson Date: Tue, 17 Oct 2017 18:50:48 +0000 (-0400) Subject: Fix: return proper exit code on test failure X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=a08bc0f8e6569a276a4d19741b4feb465572def5;p=deliverable%2Fbarectf.git Fix: return proper exit code on test failure Signed-off-by: Michael Jeanson --- diff --git a/tests/test.bash b/tests/test.bash index cc50e71..ec3f492 100755 --- a/tests/test.bash +++ b/tests/test.bash @@ -42,20 +42,19 @@ test_dirs=( bats_bin="$(pwd)/bats/bin/bats" rc=0 -if [ -z ${CC+x} ]; then +if [ -z "${CC+x}" ]; then # default to gcc export CC=gcc fi -for d in ${test_dirs[@]}; do - pushd $d - $bats_bin $@ . - popd - +for d in "${test_dirs[@]}"; do + pushd "$d" + $bats_bin "${@}" . if [ $? -ne 0 ]; then # latch error, but continue other tests rc=1 fi + popd done exit $rc