mirror of
https://github.com/ovh/debian-cis.git
synced 2024-11-22 21:47:02 +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
1a75cbfe76
commit
497e1d2095
@ -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[@]}
|
||||||
|
@ -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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user