From ac8884ab98ca07ffef046235701790cde46c0cf0 2024-09-09 22:21:31 From: Branko Majic Date: 2024-09-09 22:21:31 Subject: [PATCH] MAR-218: Fix some minor issues for the test runner script: - No need to use the $ variable syntax for arithmetic operations. - Use correct form when printing the list of roles (@ -> *). - Fix missing quote when assembling the list of roles. --- diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 867955d753129e7c39e5dcd78e3a7f372c14a02a..aa067d132196cda81fee9a7e79b0dc2bb64c22c8 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -97,7 +97,7 @@ EOF # Set-up colours for message printing if we're not piping and terminal is # capable of outputting the colors. _color_terminal=$(tput colors 2>&1) -if [[ -t 1 ]] && (( ${_color_terminal} > 0 )); then +if [[ -t 1 ]] && (( _color_terminal > 0 )); then _text_bold=$(tput bold) _text_white=$(tput setaf 7) _text_blue=$(tput setaf 6) @@ -174,7 +174,7 @@ while getopts "rl:qdvh" opt; do esac done i=$OPTIND -shift $(($i-1)) +shift $(( i-1 )) # Test if the necessary binaries are available. if ! type molecule > /dev/null 2>&1; then @@ -211,7 +211,7 @@ if [[ $1 == "all" ]]; then done else while [[ -n $1 ]]; do - roles+=($1) + roles+=("$1") shift 1 done fi @@ -238,13 +238,13 @@ done # Output some helpful info, and ensure we can actually run tests against # something. -info "Testing requested for roles: ${roles[@]}" -[[ ${#roles_to_skip[@]} != 0 ]] && info "The following roles will not be tested: ${roles_to_skip[@]}" +info "Testing requested for roles: ${roles[*]}" +[[ ${#roles_to_skip[@]} != 0 ]] && info "The following roles will not be tested: ${roles_to_skip[*]}" if [[ ${#roles_to_test[@]} == 0 ]]; then error "No roles can be tested." exit $ERROR_NO_ROLES fi -info "The following roles will be tested: ${roles_to_test[@]}" +info "The following roles will be tested: ${roles_to_test[*]}" # Prepare directory for storing reports. if [[ $report == 1 ]]; then