count global number of tests

This commit is contained in:
grimhilt 2023-10-28 15:45:06 +02:00
parent d34b9bab5e
commit 0c925bc4f4

View File

@ -15,18 +15,28 @@ fi
nb_tests=0 nb_tests=0
nb_success=0 nb_success=0
for test in $TESTS; do for test in $TESTS; do
nb_tests=$((nb_tests + 1)) #nb_tests=$((nb_tests + 1))
# run file # run file
$test tmp_stderr=$(mktemp)
nb_tests_tmp=$($test 2>"$tmp_stderr")
exit_code=$? exit_code=$?
capture_stderr=$(<"$tmp_stderr")
[ "$capture_stderr" != "" ] && echo -e "$capture_stderr"
rm $tmp_stderr
# add nb_tests from executed test_suite to global nb_test
[ "$nb_tests_tmp" != "" ] &&
[ $nb_tests_tmp -gt 0 ] &&
nb_tests=$((nb_tests + nb_tests_tmp))
if [ $exit_code -eq 0 ]; then if [ $exit_code -eq 0 ]; then
nb_success=$((nb_success + 1)) nb_success=$((nb_success + nb_tests_tmp))
elif [ $exit_code -eq 4 ]; then elif [ $exit_code -eq 4 ]; then
# not executable found, not need to try other tests # not executable (nextsync) found, not need to try other tests
exit 1 exit 1
else else
nb_success=$((nb_success + nb_tests_tmp - 1))
echo "$test failed with exit code $exit_code" echo "$test failed with exit code $exit_code"
fi fi
done; done;