]> granicus.if.org Git - zfs/commitdiff
Split argument list, satisfy shellcheck SC2086
authorRyan Moeller <ryan@freqlabs.com>
Mon, 26 Aug 2019 01:30:39 +0000 (21:30 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 26 Aug 2019 01:30:39 +0000 (18:30 -0700)
Split the arguments for ${TEST_RUNNER} across multiple lines for
clarity. Also added quotes in the message to match the invoked command.

Unquoted variables in argument lists are subject to splitting. In this
particular case we can't quote the variable because it is an optional
argument. Use the method suggested in the description linked below,
instead.

The technique is to use an unquoted variable with an alternate value.

https://github.com/koalaman/shellcheck/wiki/SC2086

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Giuseppe Di Natale <guss80@gmail.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9212

scripts/zfs-tests.sh

index 7c5286ba70ff3eb657066382c6b7a9386f662be2..ce766e23982390ad6b30bacf5521dd693c7870b0 100755 (executable)
@@ -31,7 +31,7 @@ fi
 
 PROG=zfs-tests.sh
 VERBOSE="no"
-QUIET=
+QUIET=""
 CLEANUP="yes"
 CLEANUPALL="no"
 LOOPBACK="yes"
@@ -307,7 +307,7 @@ while getopts 'hvqxkfScn:d:s:r:?t:T:u:I:' OPTION; do
                VERBOSE="yes"
                ;;
        q)
-               QUIET="-q"
+               QUIET="yes"
                ;;
        x)
                CLEANUPALL="yes"
@@ -602,10 +602,17 @@ REPORT_FILE=$(mktemp -u -t zts-report.XXXX -p "$FILEDIR")
 #
 # Run all the tests as specified.
 #
-msg "${TEST_RUNNER} ${QUIET} -c ${RUNFILE} -T ${TAGS} -i ${STF_SUITE}" \
-    "-I ${ITERATIONS}"
-${TEST_RUNNER} ${QUIET} -c "${RUNFILE}" -T "${TAGS}" -i "${STF_SUITE}" \
-    -I "${ITERATIONS}" 2>&1 | tee "$RESULTS_FILE"
+msg "${TEST_RUNNER} ${QUIET:+-q}" \
+    "-c \"${RUNFILE}\"" \
+    "-T \"${TAGS}\"" \
+    "-i \"${STF_SUITE}\"" \
+    "-I \"${ITERATIONS}\""
+${TEST_RUNNER} ${QUIET:+-q} \
+    -c "${RUNFILE}" \
+    -T "${TAGS}" \
+    -i "${STF_SUITE}" \
+    -I "${ITERATIONS}" \
+    2>&1 | tee "$RESULTS_FILE"
 
 #
 # Analyze the results.