From 497e1d2095e9d5a5ad94a634c02ad44871b498fe Mon Sep 17 00:00:00 2001 From: Charles Herlin Date: Wed, 30 Jan 2019 11:06:49 +0100 Subject: [PATCH] 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 --- tests/launch_tests.sh | 5 +++++ tests/lib.sh | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/tests/launch_tests.sh b/tests/launch_tests.sh index 326d239..5793841 100755 --- a/tests/launch_tests.sh +++ b/tests/launch_tests.sh @@ -26,6 +26,7 @@ tests_list="" testno=0 testcount=0 +dismiss_test=0 dismiss_count=0 nbfailedret=0 nbfailedgrep=0 @@ -71,6 +72,7 @@ clear_registered_tests() { unset REGISTERED_TESTS declare -a REGISTERED_TESTS dismiss_count=0 + dismiss_test=0 } # Generates a formated test name @@ -84,6 +86,9 @@ make_usecase_name() { # Plays the registered test suite play_registered_tests() { + if [ "$dismiss_test" -eq 1 ]; then + return + fi usecase_name=$1 if [[ "${REGISTERED_TESTS[*]}" ]]; then export numtest=${#REGISTERED_TESTS[@]} diff --git a/tests/lib.sh b/tests/lib.sh index 32b9e42..ac07c71 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -66,6 +66,10 @@ contain() fi } +dismiss_test() { + dismiss_test=1 +} + # test is expected to fail (for instance on blank system) # then the test wont be taken into account for test suite success dismiss_count_for_test() {