Return a successful test run as a non-zero exit status

This commit is contained in:
Fabio Manganiello 2021-02-24 19:58:24 +01:00
parent b7f56d8dcc
commit 110ab8abfb

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
BASE_DIR=$(pwd) BASE_DIR="$(pwd)"
VENV_DIR="$BASE_DIR/venv" VENV_DIR="$BASE_DIR/venv"
REPO_DIR="$BASE_DIR/repo" REPO_DIR="$BASE_DIR/repo"
TEST_LOG="$BASE_DIR/test.log" TEST_LOG="$BASE_DIR/test.log"
@ -33,7 +33,8 @@ run_tests() {
check_test_results() { check_test_results() {
grep -e '^FAILED' "$TEST_LOG" >/dev/null grep -e '^FAILED' "$TEST_LOG" >/dev/null
if [[ $? == 0 ]]; then ret=$?
if [[ $ret == 0 ]]; then
echo "------------------" echo "------------------"
echo "Some tests failed!" echo "Some tests failed!"
echo "------------------" echo "------------------"
@ -41,6 +42,8 @@ check_test_results() {
else else
echo "All tests passed" echo "All tests passed"
fi fi
return $ret
} }
######## ########
@ -51,6 +54,10 @@ cleanup
prepare_venv prepare_venv
install_repo install_repo
run_tests run_tests
check_test_results
cleanup check_test_results
tests_passed=$?
cleanup
exit $tests_passed