From a08bc0f8e6569a276a4d19741b4feb465572def5 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 17 Oct 2017 14:50:48 -0400 Subject: [PATCH] Fix: return proper exit code on test failure Signed-off-by: Michael Jeanson --- tests/test.bash | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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 -- 2.34.1