Skip to content
Snippets Groups Projects
Commit 85c4ef6a authored by Simon Rose's avatar Simon Rose
Browse files

Fixed shellcheck/shfmt

parent db51cca1
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@ function test_require {
shift
expected=$1
shift
args=$@
args=("$@")
if [ "$required" = "-" ]; then
req_str="$MODULENAME"
......@@ -62,7 +62,7 @@ function test_require {
echo "Running test case:"
echo "Requested: $required"
echo "Expected: $expected"
echo "Installed: $args"
echo "Installed: ${args[*]}"
echo "============================================================"
required=${required//+/\\+}
......@@ -70,7 +70,7 @@ function test_require {
clean_vers
install_vers $args
install_vers "${args[@]}"
echo "=========================================="
echo "Running iocsh.bash -l cellMods -r $req_str"
......@@ -101,7 +101,7 @@ function format_output {
shift
expected=$1
shift
versions=$@
versions=$*
if [ "$result" = "0" ]; then
result_str="\033[32mpassed\033[0m"
......@@ -109,7 +109,7 @@ function format_output {
result_str="\033[31mfailed\033[0m"
fi
printf "Test: %s\n" "$result_str"
printf "Test: %b\n" "$result_str"
printf "requested: %-20s expected: %-20s\n" "$requested" "$expected"
printf "Given versions: %s\n" "$versions"
printf "============================================================\n"
......@@ -155,19 +155,24 @@ source "$ENV_SRC" &>/dev/null
show_header
# TODO: Fix these silly shellcheck disables here.
failed_tests=0
if [ -n "$COMMAND" ]; then
# shellcheck disable=2086
test_require $COMMAND &>>"$LOGFILE"
result=$?
[ "$result" = 0 ] || ((failed_tests++))
# shellcheck disable=2086
format_output $result $COMMAND
fi
if [ -f "$TESTFILE" ]; then
while read -r line; do
# shellcheck disable=2086
test_require $line &>>"$LOGFILE"
result=$?
[ "$result" = 0 ] || ((failed_tests++))
# shellcheck disable=2086
format_output $result $line
done < <(sed -e 's/[[:space:]]*#.*//; /^[[:space:]]*$/d' "$TESTFILE")
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment