tools: tests: don't mix string and array
authorKent Gibson <warthog618@gmail.com>
Mon, 3 Jun 2024 11:56:21 +0000 (19:56 +0800)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 3 Jun 2024 12:02:35 +0000 (14:02 +0200)
Fix shellcheck SC2145[1] - argument mixes string and array.

Separate the command from the array of arguments to avoid mixing.

[1] https://www.shellcheck.net/wiki/SC2145

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240603115628.102616-2-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
tools/gpio-tools-test.bash

index 521556c24be4f1dbd22953b84fcbec0e28b33768..34ea744b1b5ffcce05e1030629a25c102245effb 100755 (executable)
@@ -174,18 +174,24 @@ gpiosim_cleanup() {
 run_tool() {
        # Executables to test are expected to be in the same directory as the
        # testing script.
-       output=$(timeout 10s $SOURCE_DIR/"$@" 2>&1)
+       cmd=$1
+       shift
+       output=$(timeout 10s "$SOURCE_DIR/$cmd" "$@" 2>&1)
        status=$?
 }
 
 dut_run() {
-       coproc timeout 10s $SOURCE_DIR/"$@" 2>&1
+       cmd=$1
+       shift
+       coproc timeout 10s "$SOURCE_DIR/$cmd" "$@" 2>&1
        DUT_PID=$COPROC_PID
        read -t1 -n1 -u ${COPROC[0]} DUT_FIRST_CHAR
 }
 
 dut_run_redirect() {
-       coproc timeout 10s $SOURCE_DIR/"$@" > $SHUNIT_TMPDIR/$DUT_OUTPUT 2>&1
+       cmd=$1
+       shift
+       coproc timeout 10s "$SOURCE_DIR/$cmd" "$@" > "$SHUNIT_TMPDIR/$DUT_OUTPUT" 2>&1
        DUT_PID=$COPROC_PID
        # give the process time to spin up
        # FIXME - find a better solution