FIX: add way of completely skipping test that bugged with jessie

Tests are stored in a bash indexed array.
Bash on debian8 does not support arrays declaration and if there was no
registered tests, the array variable was seen as undefined.
With this way of completely dismissing the test suite, the problem is
fixed
This commit is contained in:
Charles Herlin 2019-01-30 11:06:49 +01:00
parent 2dd753e5e7
commit aa3983c6d0
2 changed files with 9 additions and 0 deletions

View File

@ -26,6 +26,7 @@ tests_list=""
testno=0 testno=0
testcount=0 testcount=0
dismiss_test=0
dismiss_count=0 dismiss_count=0
nbfailedret=0 nbfailedret=0
nbfailedgrep=0 nbfailedgrep=0
@ -71,6 +72,7 @@ clear_registered_tests() {
unset REGISTERED_TESTS unset REGISTERED_TESTS
declare -a REGISTERED_TESTS declare -a REGISTERED_TESTS
dismiss_count=0 dismiss_count=0
dismiss_test=0
} }
# Generates a formated test name # Generates a formated test name
@ -84,6 +86,9 @@ make_usecase_name() {
# Plays the registered test suite # Plays the registered test suite
play_registered_tests() { play_registered_tests() {
if [ "$dismiss_test" -eq 1 ]; then
return
fi
usecase_name=$1 usecase_name=$1
if [[ "${REGISTERED_TESTS[*]}" ]]; then if [[ "${REGISTERED_TESTS[*]}" ]]; then
export numtest=${#REGISTERED_TESTS[@]} export numtest=${#REGISTERED_TESTS[@]}

View File

@ -66,6 +66,10 @@ contain()
fi fi
} }
dismiss_test() {
dismiss_test=1
}
# test is expected to fail (for instance on blank system) # test is expected to fail (for instance on blank system)
# then the test wont be taken into account for test suite success # then the test wont be taken into account for test suite success
dismiss_count_for_test() { dismiss_count_for_test() {