Fix update test script

Remove EXIT trap handler because it seems to occasionally capture exit
code from something that is not an update test resulting in error
state even though all update tests were successful.
This commit is contained in:
Sven Klemm 2018-12-29 16:35:07 +01:00 committed by Sven Klemm
parent fc425398f2
commit 43eb4ffba6

View File

@ -19,6 +19,8 @@ FAILED_TEST=
KEEP_TEMP_DIRS=false KEEP_TEMP_DIRS=false
TEST_UPDATE_FROM_TAGS_EXTRA_ARGS= TEST_UPDATE_FROM_TAGS_EXTRA_ARGS=
FAIL_COUNT=0
# Declare a hash table to keep test names keyed by pid # Declare a hash table to keep test names keyed by pid
declare -A tests declare -A tests
@ -37,23 +39,6 @@ do
esac esac
done done
cleanup() {
local exit_code="$?"
set +e # do not exit immediately on failure
echo "Waiting for remaining tests to finish..."
wait
if [ -f ${TEST_TMPDIR}/${FAILED_TEST}.log ]; then
echo "###### Failed test log below #####"
cat ${TEST_TMPDIR}/${FAILED_TEST}.log
fi
if [ "$KEEP_TEMP_DIRS" = "false" ]; then
echo "Cleaning up temporary directory"
rm -rf ${TEST_TMPDIR}
fi
echo "exit code is $exit_code"
return $exit_code
}
kill_all_tests() { kill_all_tests() {
local exit_code="$?" local exit_code="$?"
set +e # do not exit immediately on failure set +e # do not exit immediately on failure
@ -63,7 +48,6 @@ kill_all_tests() {
} }
trap kill_all_tests INT HUP trap kill_all_tests INT HUP
trap cleanup EXIT
if [ -z "${TEST_VERSION}" ]; then if [ -z "${TEST_VERSION}" ]; then
echo "No TEST_VERSION specified" echo "No TEST_VERSION specified"
@ -100,9 +84,18 @@ do
echo "Test ${tests[$pid]} (pid $pid) exited with code $exit_code" echo "Test ${tests[$pid]} (pid $pid) exited with code $exit_code"
if [ $exit_code -ne 0 ]; then if [ $exit_code -ne 0 ]; then
FAIL_COUNT=$((FAIL_COUNT + 1))
FAILED_TEST=${tests[$pid]} FAILED_TEST=${tests[$pid]}
kill_all_tests if [ -f ${TEST_TMPDIR}/${FAILED_TEST}.log ]; then
exit $exit_code echo "###### Failed test log below #####"
cat ${TEST_TMPDIR}/${FAILED_TEST}.log
fi
fi fi
$(exit $exit_code)
done done
if [ "$KEEP_TEMP_DIRS" = "false" ]; then
echo "Cleaning up temporary directory"
rm -rf ${TEST_TMPDIR}
fi
exit $FAIL_COUNT