mirror of
https://github.com/ovh/debian-cis.git
synced 2024-11-25 15:01:22 +01:00
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:
parent
2dd753e5e7
commit
aa3983c6d0
@ -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[@]}
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user