diff --git a/tests/test_versions/test.sh b/tests/test_versions/test.sh index 52f10e3be5516336af335975b1161e7ecfe13cc4..1cd68c4018fcb02839c4d81efe416bab02b5fb24 100755 --- a/tests/test_versions/test.sh +++ b/tests/test_versions/test.sh @@ -10,7 +10,7 @@ if which ack &>/dev/null; then __SEARCH_COMMAND__="ack --passthru" else echo "ack is not installed; defaulting to grep, but note that the log will be missing the IOC log" >&2 - __SEARCH_COMMAND__=grep + __SEARCH_COMMAND__="grep" fi function usage { @@ -28,11 +28,11 @@ function show_header { } function install_vers { - for ver in $@; do + for ver in "$@"; do echo "==========================================" echo "Installing local version version '$ver'" echo "==========================================" - make -C test clean cellinstall __DEBUG_VERSION=$ver __EPICS_BASE_LOCATION="$EPICS_BASE" __REQUIRE_VERSION="$REQUIRE_VER" E3_NO_TEST=true + make -C test clean cellinstall __DEBUG_VERSION="$ver" __EPICS_BASE_LOCATION="$EPICS_BASE" __REQUIRE_VERSION="$REQUIRE_VER" E3_NO_TEST=true done } @@ -65,8 +65,8 @@ function test_require { echo "Installed: $args" echo "============================================================" - required=$(sed 's/+/\\+/g' <<<$required) - expected=$(sed 's/+/\\+/g' <<<$expected) + required=${required//+/\\+} + expected=${expected//+/\\+} clean_vers @@ -90,7 +90,7 @@ function test_require { # we are looking for. If we simply cut it out then we seem to be able to more consistently # get meaningful tests. echo exit | eval iocsh.bash "$iocsh_args" | - sed -e '1h;2,$H;$!d;g' -e 's/Starting iocInit\niocRun: All initialization complete\n//' | + sed -e '1 h; 2,$ H; $! d; g' -e 's/Starting iocInit\niocRun: All initialization complete\n//' | $__SEARCH_COMMAND__ "${search_string}" } @@ -109,7 +109,7 @@ function format_output { result_str="\033[31mfailed\033[0m" fi - printf "Test: $result_str\n" + printf "Test: %s\n" "$result_str" printf "requested: %-20s expected: %-20s\n" "$requested" "$expected" printf "Given versions: %s\n" "$versions" printf "============================================================\n" @@ -150,6 +150,7 @@ if [ ! -f "$ENV_SRC" ]; then echo "setE3Env.bash not found at location $ENV_SRC" >&2 exit 1 fi +# shellcheck disable=SC1090 source "$ENV_SRC" &>/dev/null show_header