]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
Fix some shellcheck warnings
authorOmar Sandoval <osandov@fb.com>
Fri, 6 Apr 2018 23:40:35 +0000 (16:40 -0700)
committerOmar Sandoval <osandov@fb.com>
Fri, 6 Apr 2018 23:40:35 +0000 (16:40 -0700)
Signed-off-by: Omar Sandoval <osandov@fb.com>
Makefile
check
tests/nvme/001

index 8f2c7628b28daafc4ce8ee0b8223cadc34224e84..e78d6c8445264a79c7e7ebc3181ec8cd11aa39ee 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,10 @@ clean:
 # positives on helpers like _init_scsi_debug.
 # SC2154: "VARIABLE is referenced but not assigned". False positives on
 # TEST_RUN[foo]=bar.
-SHELLCHECK_EXCLUDE := SC1090,SC2034,SC2119,SC2154
+# SC2209: "Use var=$(command) to assign output (or quote to assign string)".
+# Warns about DMESG_FILTER=cat, which is not going to confuse anyone who knows
+# how to write shell scripts.
+SHELLCHECK_EXCLUDE := SC1090,SC2034,SC2119,SC2154,SC2209
 
 shellcheck:
        shellcheck -x -e $(SHELLCHECK_EXCLUDE) -f gcc check new common/* tests/*/[0-9]*[0-9]
diff --git a/check b/check
index 95d269a7598dd8e1ddaa20ade5a5bc76da3ee1c4..118b1d18deea0ef09f7f695a033e69e012490f11 100755 (executable)
--- a/check
+++ b/check
@@ -320,10 +320,10 @@ _call_test() {
        fi
 
        TIMEFORMAT="%Rs"
-       pushd . >/dev/null
+       pushd . >/dev/null || return
        { time "$test_func" >"${seqres}.out" 2>&1; } 2>"${seqres}.runtime"
        TEST_RUN[exit_status]=$?
-       popd >/dev/null
+       popd >/dev/null || return
        TEST_RUN[runtime]="$(cat "${seqres}.runtime")"
        rm -f "${seqres}.runtime"
 
@@ -335,7 +335,7 @@ _call_test() {
                TEST_RUN[reason]=output
        elif [[ ${TEST_RUN[exit_status]} -ne 0 ]]; then
                TEST_RUN[status]=fail
-               TEST_RUN[reason]=exit
+               TEST_RUN[reason]="exit"
        elif ! _check_dmesg "$dmesg_marker"; then
                TEST_RUN[status]=fail
                TEST_RUN[reason]=dmesg
index 16f4e8f3498172a703382f58c9b59948a7dd41eb..1cea485add752cc7ba83aa51f7c2071a2d0f072a 100755 (executable)
@@ -27,13 +27,13 @@ requires() {
 }
 
 filter_trace() {
-       sed -r -e  "s/dd-[0-9]+/dd-XXX/" \
-               -e "s/\[[0-9]+\]/[XXX]/" \
-               -e "s/\.{4}\s+/....    /" \
-               -e "s/[0-9]+\.[0-9]+/X.XXXXXX/" \
-               -e "s/qid=[0-9-]+/qid=X/" \
-               -e "s/nsid=[0-9-]+/nsid=X/" \
-               -e "s/cmdid=[0-9-]+/cmdid=X/"
+       sed -r -e  's/dd-[0-9]+/dd-XXX/' \
+               -e 's/\[[0-9]+\]/[XXX]/' \
+               -e 's/\.{4}\s+/....    /' \
+               -e 's/[0-9]+\.[0-9]+/X.XXXXXX/' \
+               -e 's/qid=[0-9-]+/qid=X/' \
+               -e 's/nsid=[0-9-]+/nsid=X/' \
+               -e 's/cmdid=[0-9-]+/cmdid=X/'
 }
 
 test_device() {