* [PATCH 0/9] blktests: Re-enable shellcheck warnings
@ 2018-06-19 20:23 Bart Van Assche
2018-06-19 20:23 ` [PATCH 1/9] common/rc: Fix _have_tracepoint() Bart Van Assche
` (9 more replies)
0 siblings, 10 replies; 20+ messages in thread
From: Bart Van Assche @ 2018-06-19 20:23 UTC (permalink / raw)
To: Omar Sandoval; +Cc: linux-block, Bart Van Assche
Hello Omar,
Since I noticed that several useful shellcheck warnings are suppressed in the
blktests project, I came up with this patch series that reenables all
shellcheck warnings and also suppresses false positive shellcheck reports. It
would be appreciated if you could have a look at this patch series.
Thanks,
Bart.
Bart Van Assche (9):
common/rc: Fix _have_tracepoint()
Annotate include statements in shell scripts where the source file is
a variable
check, tests/meta/012: Use array["index"] instead of array[index]
Suppress shellcheck complaints about global variables
check: Avoid that shellcheck complains that $FULL appears unused
Multiple tests: remove unused and undefined variables
Avoid passing tests/block/002 arguments to _init_scsi_debug
check: Suppress a shellcheck warning about the DMESG_FILTER
initialization
Makefile: Do not suppress useful shellcheck warnings
Makefile | 15 +-------------
check | 53 ++++++++++++++++++++++++++---------------------
common/cpuhotplug | 2 ++
common/fio | 2 ++
common/iopoll | 2 ++
common/loop | 1 +
common/nbd | 2 ++
common/nvme | 2 ++
common/rc | 2 ++
common/scsi | 2 ++
common/scsi_debug | 3 +++
common/shellcheck | 4 ++++
new | 1 +
tests/block/001 | 1 +
tests/block/002 | 3 ++-
tests/block/003 | 2 ++
tests/block/004 | 2 ++
tests/block/005 | 2 ++
tests/block/006 | 2 ++
tests/block/007 | 1 +
tests/block/009 | 1 +
tests/block/010 | 2 ++
tests/block/011 | 2 ++
tests/block/012 | 2 ++
tests/block/013 | 2 ++
tests/block/014 | 2 ++
tests/block/015 | 2 ++
tests/block/016 | 2 ++
tests/block/017 | 2 ++
tests/block/018 | 2 ++
tests/block/019 | 2 ++
tests/block/020 | 2 ++
tests/block/021 | 2 ++
tests/loop/001 | 2 ++
tests/loop/003 | 5 ++---
tests/loop/005 | 2 ++
tests/meta/001 | 2 ++
tests/meta/002 | 2 ++
tests/meta/003 | 2 ++
tests/meta/004 | 2 ++
tests/meta/005 | 2 ++
tests/meta/006 | 2 ++
tests/meta/007 | 2 ++
tests/meta/008 | 2 ++
tests/meta/009 | 2 ++
tests/meta/010 | 2 ++
tests/meta/011 | 2 ++
tests/meta/012 | 6 ++++--
tests/nbd/001 | 2 ++
tests/nbd/002 | 2 ++
tests/nvme/001 | 2 ++
tests/nvme/002 | 2 ++
tests/nvme/003 | 2 ++
tests/nvme/004 | 2 ++
tests/nvme/005 | 2 ++
tests/nvme/006 | 2 ++
tests/nvme/007 | 2 ++
tests/nvme/008 | 2 ++
tests/nvme/009 | 2 ++
tests/nvme/010 | 5 +++--
tests/nvme/011 | 5 +++--
tests/nvme/012 | 3 ++-
tests/nvme/013 | 3 ++-
tests/scsi/001 | 2 ++
tests/scsi/002 | 2 ++
tests/scsi/003 | 2 ++
tests/scsi/004 | 1 +
67 files changed, 161 insertions(+), 50 deletions(-)
create mode 100644 common/shellcheck
--
2.17.1
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 1/9] common/rc: Fix _have_tracepoint() 2018-06-19 20:23 [PATCH 0/9] blktests: Re-enable shellcheck warnings Bart Van Assche @ 2018-06-19 20:23 ` Bart Van Assche 2018-06-25 9:07 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 2/9] Annotate include statements in shell scripts where the source file is a variable Bart Van Assche ` (8 subsequent siblings) 9 siblings, 1 reply; 20+ messages in thread From: Bart Van Assche @ 2018-06-19 20:23 UTC (permalink / raw) To: Omar Sandoval; +Cc: linux-block, Bart Van Assche Make sure that _have_tracepoint() uses the argument passed to that function instead of using an undefined variable. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> --- common/rc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/rc b/common/rc index 7f1728025364..7592400dda82 100644 --- a/common/rc +++ b/common/rc @@ -112,6 +112,8 @@ _have_tracefs() { } _have_tracepoint() { + local event=$1 + if [[ ! -d /sys/kernel/debug/tracing/events/${event} ]]; then SKIP_REASON="tracepoint ${event} does not exist" return 1 -- 2.17.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 1/9] common/rc: Fix _have_tracepoint() 2018-06-19 20:23 ` [PATCH 1/9] common/rc: Fix _have_tracepoint() Bart Van Assche @ 2018-06-25 9:07 ` Johannes Thumshirn 0 siblings, 0 replies; 20+ messages in thread From: Johannes Thumshirn @ 2018-06-25 9:07 UTC (permalink / raw) To: Bart Van Assche; +Cc: Omar Sandoval, linux-block Looks good, Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/9] Annotate include statements in shell scripts where the source file is a variable 2018-06-19 20:23 [PATCH 0/9] blktests: Re-enable shellcheck warnings Bart Van Assche 2018-06-19 20:23 ` [PATCH 1/9] common/rc: Fix _have_tracepoint() Bart Van Assche @ 2018-06-19 20:23 ` Bart Van Assche 2018-06-25 9:08 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 3/9] check, tests/meta/012: Use array["index"] instead of array[index] Bart Van Assche ` (7 subsequent siblings) 9 siblings, 1 reply; 20+ messages in thread From: Bart Van Assche @ 2018-06-19 20:23 UTC (permalink / raw) To: Omar Sandoval; +Cc: linux-block, Bart Van Assche This causes shellcheck to stop complaining about these include statements. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> --- check | 3 +++ 1 file changed, 3 insertions(+) diff --git a/check b/check index 4baa8dde2436..5e1ba7bc8401 100755 --- a/check +++ b/check @@ -23,6 +23,7 @@ _found_test() { unset DESCRIPTION QUICK TIMED requires device_requires test test_device + # shellcheck disable=SC1090 if ! . "tests/${test_name}"; then return 1 fi @@ -392,6 +393,7 @@ _run_test() { CHECK_DMESG=1 DMESG_FILTER=cat + # shellcheck disable=SC1090 . "tests/${TEST_NAME}" if declare -fF test >/dev/null; then @@ -432,6 +434,7 @@ _run_group() { local tests=("$@") local group="${tests[0]%/*}" + # shellcheck disable=SC1090 . "tests/${group}/group" if declare -fF group_requires >/dev/null && ! group_requires; then -- 2.17.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 2/9] Annotate include statements in shell scripts where the source file is a variable 2018-06-19 20:23 ` [PATCH 2/9] Annotate include statements in shell scripts where the source file is a variable Bart Van Assche @ 2018-06-25 9:08 ` Johannes Thumshirn 0 siblings, 0 replies; 20+ messages in thread From: Johannes Thumshirn @ 2018-06-25 9:08 UTC (permalink / raw) To: Bart Van Assche; +Cc: Omar Sandoval, linux-block Looks good, Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 3/9] check, tests/meta/012: Use array["index"] instead of array[index] 2018-06-19 20:23 [PATCH 0/9] blktests: Re-enable shellcheck warnings Bart Van Assche 2018-06-19 20:23 ` [PATCH 1/9] common/rc: Fix _have_tracepoint() Bart Van Assche 2018-06-19 20:23 ` [PATCH 2/9] Annotate include statements in shell scripts where the source file is a variable Bart Van Assche @ 2018-06-19 20:23 ` Bart Van Assche 2018-06-25 9:09 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 4/9] Suppress shellcheck complaints about global variables Bart Van Assche ` (6 subsequent siblings) 9 siblings, 1 reply; 20+ messages in thread From: Bart Van Assche @ 2018-06-19 20:23 UTC (permalink / raw) To: Omar Sandoval; +Cc: linux-block, Bart Van Assche This causes shellcheck to stop complaining about these array element accesses. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> --- check | 46 +++++++++++++++++++++++----------------------- tests/meta/012 | 4 ++-- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/check b/check index 5e1ba7bc8401..5f53fa105f72 100755 --- a/check +++ b/check @@ -156,11 +156,11 @@ declare -A TEST_RUN _read_last_test_run() { local seqres="${RESULTS_DIR}/${TEST_NAME}" - LAST_TEST_RUN[date]="" - LAST_TEST_RUN[status]="" - LAST_TEST_RUN[reason]="" - LAST_TEST_RUN[exit_status]="" - LAST_TEST_RUN[runtime]="" + LAST_TEST_RUN["date"]="" + LAST_TEST_RUN["status"]="" + LAST_TEST_RUN["reason"]="" + LAST_TEST_RUN["exit_status"]="" + LAST_TEST_RUN["runtime"]="" if [[ ! -e $seqres ]]; then return @@ -247,9 +247,9 @@ _output_test_run() { fi if [[ -v TEST_DEV ]]; then - _output_status "$TEST_NAME => $(basename "$TEST_DEV")" "${TEST_RUN[status]}ed" + _output_status "$TEST_NAME => $(basename "$TEST_DEV")" "${TEST_RUN["status"]}ed" else - _output_status "$TEST_NAME" "${TEST_RUN[status]}ed" + _output_status "$TEST_NAME" "${TEST_RUN["status"]}ed" fi ( @@ -306,14 +306,14 @@ _call_test() { _read_last_test_run _output_last_test_run - TEST_RUN[date]="$(date "+%F %T")" + TEST_RUN["date"]="$(date "+%F %T")" mkdir -p "$(dirname "$seqres")" # Remove leftovers from last time. rm -f "${seqres}" "${seqres}."* if [[ -w /dev/kmsg ]]; then - local dmesg_marker="run blktests $TEST_NAME at ${TEST_RUN[date]}" + local dmesg_marker="run blktests $TEST_NAME at ${TEST_RUN["date"]}" echo "$dmesg_marker" >> /dev/kmsg else local dmesg_marker="" @@ -328,35 +328,35 @@ _call_test() { TIMEFORMAT="%Rs" pushd . >/dev/null || return { time "$test_func" >"${seqres}.out" 2>&1; } 2>"${seqres}.runtime" - TEST_RUN[exit_status]=$? + TEST_RUN["exit_status"]=$? popd >/dev/null || return - TEST_RUN[runtime]="$(cat "${seqres}.runtime")" + TEST_RUN["runtime"]="$(cat "${seqres}.runtime")" rm -f "${seqres}.runtime" _cleanup if ! diff "tests/${TEST_NAME}.out" "${seqres}.out" >/dev/null; then mv "${seqres}.out" "${seqres}.out.bad" - TEST_RUN[status]=fail - TEST_RUN[reason]=output - elif [[ ${TEST_RUN[exit_status]} -ne 0 ]]; then - TEST_RUN[status]=fail - TEST_RUN[reason]="exit" + TEST_RUN["status"]=fail + TEST_RUN["reason"]=output + elif [[ ${TEST_RUN["exit_status"]} -ne 0 ]]; then + TEST_RUN["status"]=fail + TEST_RUN["reason"]="exit" elif ! _check_dmesg "$dmesg_marker"; then - TEST_RUN[status]=fail - TEST_RUN[reason]=dmesg + TEST_RUN["status"]=fail + TEST_RUN["reason"]=dmesg else - TEST_RUN[status]=pass + TEST_RUN["status"]=pass fi rm -f "${seqres}.out" _write_test_run _output_test_run - if [[ ${TEST_RUN[status]} = pass ]]; then + if [[ ${TEST_RUN["status"]} = pass ]]; then return 0 else - case "${TEST_RUN[reason]}" in + case "${TEST_RUN["reason"]}" in output) diff -u "tests/${TEST_NAME}.out" "${seqres}.out.bad" | awk " { @@ -369,7 +369,7 @@ _call_test() { }" ;; exit) - echo " exited with status ${TEST_RUN[exit_status]}" + echo " exited with status ${TEST_RUN["exit_status"]}" ;; dmesg) echo " something found in dmesg:" @@ -432,7 +432,7 @@ _run_test() { _run_group() { local tests=("$@") - local group="${tests[0]%/*}" + local group="${tests["0"]%/*}" # shellcheck disable=SC1090 . "tests/${group}/group" diff --git a/tests/meta/012 b/tests/meta/012 index fcf8fbdde2aa..ab8c2a73eaa5 100755 --- a/tests/meta/012 +++ b/tests/meta/012 @@ -22,8 +22,8 @@ DESCRIPTION="record pid and random junk" test() { echo "Running ${TEST_NAME}" sleep 1 - TEST_RUN[pid]=$$ - TEST_RUN[random]="$(od -N $((4 * (RANDOM % 4))) -An -vtx1 /dev/urandom | tr -d ' \n')" + TEST_RUN["pid"]=$$ + TEST_RUN["random"]="$(od -N $((4 * (RANDOM % 4))) -An -vtx1 /dev/urandom | tr -d ' \n')" TEST_RUN[$$]=hello echo "Test complete" } -- 2.17.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 3/9] check, tests/meta/012: Use array["index"] instead of array[index] 2018-06-19 20:23 ` [PATCH 3/9] check, tests/meta/012: Use array["index"] instead of array[index] Bart Van Assche @ 2018-06-25 9:09 ` Johannes Thumshirn 0 siblings, 0 replies; 20+ messages in thread From: Johannes Thumshirn @ 2018-06-25 9:09 UTC (permalink / raw) To: Bart Van Assche; +Cc: Omar Sandoval, linux-block Looks good, Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 4/9] Suppress shellcheck complaints about global variables 2018-06-19 20:23 [PATCH 0/9] blktests: Re-enable shellcheck warnings Bart Van Assche ` (2 preceding siblings ...) 2018-06-19 20:23 ` [PATCH 3/9] check, tests/meta/012: Use array["index"] instead of array[index] Bart Van Assche @ 2018-06-19 20:23 ` Bart Van Assche 2018-06-25 9:09 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 5/9] check: Avoid that shellcheck complains that $FULL appears unused Bart Van Assche ` (5 subsequent siblings) 9 siblings, 1 reply; 20+ messages in thread From: Bart Van Assche @ 2018-06-19 20:23 UTC (permalink / raw) To: Omar Sandoval; +Cc: linux-block, Bart Van Assche Add a new file common/shellcheck and include it in all test scripts that use global variables. The file common/shellcheck contains a statement that stops shellcheck to complain about global variables: echo "$CHECK_DMESG ${CPUS_ONLINE_SAVED[*]} $DESCRIPTION $DMESG_FILTER $FIO_PERF_FIELDS $FIO_PERF_PREFIX $RESTORE_CPUS_ONLINE $QUICK $SKIP_REASON ${TEST_RUN[*]} $TIMED" >/dev/null Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> --- common/cpuhotplug | 2 ++ common/fio | 2 ++ common/iopoll | 2 ++ common/loop | 1 + common/nbd | 2 ++ common/nvme | 2 ++ common/scsi | 2 ++ common/shellcheck | 4 ++++ new | 1 + tests/block/001 | 1 + tests/block/002 | 1 + tests/block/003 | 2 ++ tests/block/004 | 2 ++ tests/block/005 | 2 ++ tests/block/006 | 2 ++ tests/block/007 | 1 + tests/block/009 | 1 + tests/block/010 | 2 ++ tests/block/011 | 2 ++ tests/block/012 | 2 ++ tests/block/013 | 2 ++ tests/block/014 | 2 ++ tests/block/015 | 2 ++ tests/block/016 | 2 ++ tests/block/017 | 2 ++ tests/block/018 | 2 ++ tests/block/019 | 2 ++ tests/block/020 | 2 ++ tests/block/021 | 2 ++ tests/loop/001 | 2 ++ tests/loop/003 | 2 ++ tests/loop/005 | 2 ++ tests/meta/001 | 2 ++ tests/meta/002 | 2 ++ tests/meta/003 | 2 ++ tests/meta/004 | 2 ++ tests/meta/005 | 2 ++ tests/meta/006 | 2 ++ tests/meta/007 | 2 ++ tests/meta/008 | 2 ++ tests/meta/009 | 2 ++ tests/meta/010 | 2 ++ tests/meta/011 | 2 ++ tests/meta/012 | 2 ++ tests/nbd/001 | 2 ++ tests/nbd/002 | 2 ++ tests/nvme/001 | 2 ++ tests/nvme/002 | 2 ++ tests/nvme/003 | 2 ++ tests/nvme/004 | 2 ++ tests/nvme/005 | 2 ++ tests/nvme/006 | 2 ++ tests/nvme/007 | 2 ++ tests/nvme/008 | 2 ++ tests/nvme/009 | 2 ++ tests/nvme/010 | 2 ++ tests/nvme/011 | 2 ++ tests/nvme/012 | 2 ++ tests/nvme/013 | 2 ++ tests/scsi/001 | 2 ++ tests/scsi/002 | 2 ++ tests/scsi/003 | 2 ++ tests/scsi/004 | 1 + 63 files changed, 121 insertions(+) create mode 100644 common/shellcheck diff --git a/common/cpuhotplug b/common/cpuhotplug index 70b284f7b7aa..9f43615a8f64 100644 --- a/common/cpuhotplug +++ b/common/cpuhotplug @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + # Also initializes the ALL_CPUS and HOTPLUGGABLE_CPUS arrays. _have_cpu_hotplug() { ALL_CPUS=() diff --git a/common/fio b/common/fio index 0f93632c0382..949796810a0c 100644 --- a/common/fio +++ b/common/fio @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + _have_fio() { if ! _have_program fio; then return 1 diff --git a/common/iopoll b/common/iopoll index affdd4332dc2..10ebd16923ad 100644 --- a/common/iopoll +++ b/common/iopoll @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + _have_fio_with_poll() { if ! _have_fio; then return 1 diff --git a/common/loop b/common/loop index 16cc3212a028..28071840ed9b 100644 --- a/common/loop +++ b/common/loop @@ -17,6 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck _have_loop_set_block_size() { src/loblksize "$(losetup -f)" 512 &>/dev/null diff --git a/common/nbd b/common/nbd index 320f456e0bd8..2e0186482989 100644 --- a/common/nbd +++ b/common/nbd @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + _have_nbd() { if ! _have_module nbd; then return 1 diff --git a/common/nvme b/common/nvme index 044d7fe94c65..0060f3e29573 100644 --- a/common/nvme +++ b/common/nvme @@ -19,6 +19,8 @@ NVMET_CFS="/sys/kernel/config/nvmet/" +. common/shellcheck + _test_dev_is_nvme() { if ! readlink -f "$TEST_DEV_SYSFS/device" | grep -q nvme; then SKIP_REASON="$TEST_DEV is not a NVMe device" diff --git a/common/scsi b/common/scsi index d9fcc0e15909..eb5a3ddc708f 100644 --- a/common/scsi +++ b/common/scsi @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + _have_scsi_generic() { _have_module sg } diff --git a/common/shellcheck b/common/shellcheck new file mode 100644 index 000000000000..1ec759976dd7 --- /dev/null +++ b/common/shellcheck @@ -0,0 +1,4 @@ +#!/bin/bash + +# Suppress shellcheck complaints about global variables used in test scripts. +echo "$CHECK_DMESG ${CPUS_ONLINE_SAVED[*]} $DESCRIPTION $DMESG_FILTER $FIO_PERF_FIELDS $FIO_PERF_PREFIX $RESTORE_CPUS_ONLINE $QUICK $SKIP_REASON ${TEST_RUN[*]} $TIMED" >/dev/null diff --git a/new b/new index 923d6b737986..d8a0ad34b8df 100755 --- a/new +++ b/new @@ -18,6 +18,7 @@ set -e . common/rc +. common/shellcheck prompt_yes_no() { if [[ $2 =~ ^[Yy] ]]; then diff --git a/tests/block/001 b/tests/block/001 index 7411a0cf04f6..8016265d11e3 100755 --- a/tests/block/001 +++ b/tests/block/001 @@ -20,6 +20,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. . common/scsi_debug +. common/shellcheck DESCRIPTION="stress device hotplugging" TIMED=1 diff --git a/tests/block/002 b/tests/block/002 index 57b4f8984095..32a0f818b95b 100755 --- a/tests/block/002 +++ b/tests/block/002 @@ -19,6 +19,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. . common/scsi_debug +. common/shellcheck DESCRIPTION="remove a device while running blktrace" QUICK=1 diff --git a/tests/block/003 b/tests/block/003 index 87e30a36e8c2..e73e4fc60fbe 100755 --- a/tests/block/003 +++ b/tests/block/003 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="run various discard sizes" TIMED=1 diff --git a/tests/block/004 b/tests/block/004 index 754d30260d63..59e157b1c337 100755 --- a/tests/block/004 +++ b/tests/block/004 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="run lots of flushes" TIMED=1 diff --git a/tests/block/005 b/tests/block/005 index fae59272f90b..2e6dd38cc931 100755 --- a/tests/block/005 +++ b/tests/block/005 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="switch schedulers while doing IO" TIMED=1 diff --git a/tests/block/006 b/tests/block/006 index 0a472935a481..be4b6c7560b3 100755 --- a/tests/block/006 +++ b/tests/block/006 @@ -20,6 +20,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="run null-blk in blocking mode" TIMED=1 diff --git a/tests/block/007 b/tests/block/007 index e35649ad96cd..15709fffd4fd 100755 --- a/tests/block/007 +++ b/tests/block/007 @@ -18,6 +18,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. . common/iopoll +. common/shellcheck DESCRIPTION="test classic and hybrid IO polling" TIMED=1 diff --git a/tests/block/009 b/tests/block/009 index cbeeb70701fa..7d6afe9694eb 100755 --- a/tests/block/009 +++ b/tests/block/009 @@ -22,6 +22,7 @@ DESCRIPTION="check page-cache coherency after BLKDISCARD" . common/scsi_debug +. common/shellcheck requires() { _have_scsi_debug && _have_program xfs_io diff --git a/tests/block/010 b/tests/block/010 index 97891d229c0f..bbe714101aee 100644 --- a/tests/block/010 +++ b/tests/block/010 @@ -20,6 +20,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="run I/O on null_blk with shared and non-shared tags" TIMED=1 diff --git a/tests/block/011 b/tests/block/011 index 24614420461e..ab02f90f2069 100755 --- a/tests/block/011 +++ b/tests/block/011 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="disable PCI device while doing I/O" TIMED=1 diff --git a/tests/block/012 b/tests/block/012 index baabdd68b655..2c1b761ba063 100755 --- a/tests/block/012 +++ b/tests/block/012 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="check that a read-only block device fails writes" TIMED=1 diff --git a/tests/block/013 b/tests/block/013 index 415b34dcc5ef..8f386313cd2b 100755 --- a/tests/block/013 +++ b/tests/block/013 @@ -23,6 +23,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="try BLKRRPART on a mounted device" QUICK=1 diff --git a/tests/block/014 b/tests/block/014 index 882a9b9f5015..f5503ee9683c 100755 --- a/tests/block/014 +++ b/tests/block/014 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="run null-blk with timeout injection configured" requires() { diff --git a/tests/block/015 b/tests/block/015 index b236a6d36bf8..0c9daa6be13e 100755 --- a/tests/block/015 +++ b/tests/block/015 @@ -18,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="run null-blk on different schedulers with requeue injection configured" QUICK=1 diff --git a/tests/block/016 b/tests/block/016 index 6ccfe98f54ce..5a1ff33c34fb 100755 --- a/tests/block/016 +++ b/tests/block/016 @@ -19,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="send a signal to a process waiting on a frozen queue" QUICK=1 diff --git a/tests/block/017 b/tests/block/017 index 436a8f336155..e9ca282750ba 100755 --- a/tests/block/017 +++ b/tests/block/017 @@ -19,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="do I/O and check the inflight counter" QUICK=1 diff --git a/tests/block/018 b/tests/block/018 index 548f1baeaf59..21421b869c18 100755 --- a/tests/block/018 +++ b/tests/block/018 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="do I/O and check iostats times" QUICK=1 diff --git a/tests/block/019 b/tests/block/019 index 00830d02b67a..f099d9392688 100755 --- a/tests/block/019 +++ b/tests/block/019 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="break PCI link device while doing I/O" QUICK=1 diff --git a/tests/block/020 b/tests/block/020 index 36140136369b..7db1b5a0d422 100755 --- a/tests/block/020 +++ b/tests/block/020 @@ -19,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="run null-blk on different schedulers with only one hardware tag" QUICK=1 diff --git a/tests/block/021 b/tests/block/021 index 74fa709a8e04..df5dc9b101ba 100755 --- a/tests/block/021 +++ b/tests/block/021 @@ -19,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="read/write nr_requests on null-blk with different schedulers" QUICK=1 diff --git a/tests/loop/001 b/tests/loop/001 index 1f009bdd1439..83103dc5e9c9 100755 --- a/tests/loop/001 +++ b/tests/loop/001 @@ -18,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="scan loop device partitions" QUICK=1 diff --git a/tests/loop/003 b/tests/loop/003 index fe4e2e1ed19b..353d4fcfa33c 100755 --- a/tests/loop/003 +++ b/tests/loop/003 @@ -18,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="time opening and closing an unbound loop device" QUICK=1 diff --git a/tests/loop/005 b/tests/loop/005 index b57ddb3d6f1a..d00f4bd06f73 100755 --- a/tests/loop/005 +++ b/tests/loop/005 @@ -19,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="call LOOP_GET_STATUS{,64} with a NULL arg" QUICK=1 diff --git a/tests/meta/001 b/tests/meta/001 index 454fb22554a3..d5b8c0665f7b 100755 --- a/tests/meta/001 +++ b/tests/meta/001 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="do nothing" test() { diff --git a/tests/meta/002 b/tests/meta/002 index 5a2cd53f2318..50cdd5a3487c 100755 --- a/tests/meta/002 +++ b/tests/meta/002 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="do nothing" test_device() { diff --git a/tests/meta/003 b/tests/meta/003 index eb79bca15ffb..e07e01efd697 100755 --- a/tests/meta/003 +++ b/tests/meta/003 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="exit with non-zero status" test() { diff --git a/tests/meta/004 b/tests/meta/004 index bafe6c5e8da8..37d0e4649d56 100755 --- a/tests/meta/004 +++ b/tests/meta/004 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="exit with non-zero status" test_device() { diff --git a/tests/meta/005 b/tests/meta/005 index c9909c64c022..1a4018af2d21 100755 --- a/tests/meta/005 +++ b/tests/meta/005 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="produce bad output" test() { diff --git a/tests/meta/006 b/tests/meta/006 index 9d28bdce01d8..4d0786177555 100755 --- a/tests/meta/006 +++ b/tests/meta/006 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="produce lots of bad output" test() { diff --git a/tests/meta/007 b/tests/meta/007 index 2516796a333d..13acfdb8ef42 100755 --- a/tests/meta/007 +++ b/tests/meta/007 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="skip in requires()" requires() { diff --git a/tests/meta/008 b/tests/meta/008 index 5d24669b290e..acea355c4d91 100755 --- a/tests/meta/008 +++ b/tests/meta/008 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="skip in device_requires()" device_requires() { diff --git a/tests/meta/009 b/tests/meta/009 index abeb56e6ad4f..989ce8ccf053 100755 --- a/tests/meta/009 +++ b/tests/meta/009 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="check dmesg" requires() { diff --git a/tests/meta/010 b/tests/meta/010 index c179dad3d7c7..1e7e9da7d3fa 100755 --- a/tests/meta/010 +++ b/tests/meta/010 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="disable check dmesg" CHECK_DMESG=0 diff --git a/tests/meta/011 b/tests/meta/011 index 010ba4b142b8..df1f7e584622 100755 --- a/tests/meta/011 +++ b/tests/meta/011 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="filter dmesg" DMESG_FILTER="grep -v BUG" diff --git a/tests/meta/012 b/tests/meta/012 index ab8c2a73eaa5..ecc1db296f32 100755 --- a/tests/meta/012 +++ b/tests/meta/012 @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="record pid and random junk" test() { diff --git a/tests/nbd/001 b/tests/nbd/001 index 73ccaec1305a..cee62412599a 100644 --- a/tests/nbd/001 +++ b/tests/nbd/001 @@ -18,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="resize a connected nbd device" QUICK=1 diff --git a/tests/nbd/002 b/tests/nbd/002 index c06c94631aab..6d6b3cddf1c6 100644 --- a/tests/nbd/002 +++ b/tests/nbd/002 @@ -24,6 +24,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="tests on partition handling for an nbd device" QUICK=1 diff --git a/tests/nvme/001 b/tests/nvme/001 index 0b5f241efcce..ada60f3b2270 100755 --- a/tests/nvme/001 +++ b/tests/nvme/001 @@ -18,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="enable nvme_setup_nvm_cmd tracepoint and submit I/O to the device" QUICK=1 diff --git a/tests/nvme/002 b/tests/nvme/002 index 786505e22256..59474f7d7574 100755 --- a/tests/nvme/002 +++ b/tests/nvme/002 @@ -18,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="create many subsystems and test discovery" requires() { diff --git a/tests/nvme/003 b/tests/nvme/003 index 96341309baf6..9b168cb48278 100755 --- a/tests/nvme/003 +++ b/tests/nvme/003 @@ -18,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="test if we're sending keep-alives to a discovery controller" QUICK=1 diff --git a/tests/nvme/004 b/tests/nvme/004 index ad268e2eec83..9d087266bfa1 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -19,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="test nvme and nvmet UUID NS descriptors" QUICK=1 diff --git a/tests/nvme/005 b/tests/nvme/005 index f993019aa1d4..5c582bc38707 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -18,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="reset local loopback target" QUICK=1 diff --git a/tests/nvme/006 b/tests/nvme/006 index ecf0c334ae8b..ebdd50f61ff3 100755 --- a/tests/nvme/006 +++ b/tests/nvme/006 @@ -20,6 +20,8 @@ # Author: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> # +. common/shellcheck + DESCRIPTION="create an NVMeOF target with a block device-backed ns" QUICK=1 diff --git a/tests/nvme/007 b/tests/nvme/007 index 02633131b868..138bfead51bb 100755 --- a/tests/nvme/007 +++ b/tests/nvme/007 @@ -20,6 +20,8 @@ # Author: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> # +. common/shellcheck + DESCRIPTION="create an NVMeOF target with a file-backed ns" QUICK=1 diff --git a/tests/nvme/008 b/tests/nvme/008 index dd62b25c5335..3b69809bb8fa 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -20,6 +20,8 @@ # Author: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> # +. common/shellcheck + DESCRIPTION="create an NVMeOF host with a block device-backed ns" QUICK=1 diff --git a/tests/nvme/009 b/tests/nvme/009 index 0372788fef39..311e8171ca70 100755 --- a/tests/nvme/009 +++ b/tests/nvme/009 @@ -20,6 +20,8 @@ # Author: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> # +. common/shellcheck + DESCRIPTION="create an NVMeOF host with a file-backed ns" QUICK=1 diff --git a/tests/nvme/010 b/tests/nvme/010 index 9b31167c4988..956c6597a374 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -20,6 +20,8 @@ # Author: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> # +. common/shellcheck + DESCRIPTION="run data verification fio job on NVMeOF block device-backed ns" TIMED=1 diff --git a/tests/nvme/011 b/tests/nvme/011 index 6cd20fa26855..872a99af4f8c 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -20,6 +20,8 @@ # Author: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> # +. common/shellcheck + DESCRIPTION="run data verification fio job on NVMeOF file-backed ns" TIMED=1 diff --git a/tests/nvme/012 b/tests/nvme/012 index 255101101a18..8f632b30734d 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -20,6 +20,8 @@ # Author: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> # +. common/shellcheck + DESCRIPTION="run mkfs and data verification fio job on NVMeOF block device-backed ns" TIMED=1 diff --git a/tests/nvme/013 b/tests/nvme/013 index 4bb49fa8f966..0ccb083b175b 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -20,6 +20,8 @@ # Author: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> # +. common/shellcheck + DESCRIPTION="run mkfs and data verification fio job on NVMeOF file-backed ns" TIMED=1 diff --git a/tests/scsi/001 b/tests/scsi/001 index 17fc0880e654..08ad78489e0f 100755 --- a/tests/scsi/001 +++ b/tests/scsi/001 @@ -18,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="try triggering a kernel GPF with 0 byte SG reads" QUICK=1 diff --git a/tests/scsi/002 b/tests/scsi/002 index da2d0cc77aa0..ce037f0bbe79 100755 --- a/tests/scsi/002 +++ b/tests/scsi/002 @@ -18,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="perfom a SG_DXFER_FROM_DEV from the /dev/sg read-write interface" QUICK=1 diff --git a/tests/scsi/003 b/tests/scsi/003 index 81015f02f6b3..8c08cbdfe6a5 100755 --- a/tests/scsi/003 +++ b/tests/scsi/003 @@ -18,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +. common/shellcheck + DESCRIPTION="ensure re-reading the partition table keeps its read-only flag" QUICK=1 diff --git a/tests/scsi/004 b/tests/scsi/004 index 8c61d1e438f3..8bebb18d2554 100755 --- a/tests/scsi/004 +++ b/tests/scsi/004 @@ -26,6 +26,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. . common/scsi_debug +. common/shellcheck DESCRIPTION="ensure repeated TASK SET FULL results in EIO on timing out command" -- 2.17.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 4/9] Suppress shellcheck complaints about global variables 2018-06-19 20:23 ` [PATCH 4/9] Suppress shellcheck complaints about global variables Bart Van Assche @ 2018-06-25 9:09 ` Johannes Thumshirn 0 siblings, 0 replies; 20+ messages in thread From: Johannes Thumshirn @ 2018-06-25 9:09 UTC (permalink / raw) To: Bart Van Assche; +Cc: Omar Sandoval, linux-block Looks good, Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 5/9] check: Avoid that shellcheck complains that $FULL appears unused 2018-06-19 20:23 [PATCH 0/9] blktests: Re-enable shellcheck warnings Bart Van Assche ` (3 preceding siblings ...) 2018-06-19 20:23 ` [PATCH 4/9] Suppress shellcheck complaints about global variables Bart Van Assche @ 2018-06-19 20:23 ` Bart Van Assche 2018-06-25 9:10 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 6/9] Multiple tests: remove unused and undefined variables Bart Van Assche ` (4 subsequent siblings) 9 siblings, 1 reply; 20+ messages in thread From: Bart Van Assche @ 2018-06-19 20:23 UTC (permalink / raw) To: Omar Sandoval; +Cc: linux-block, Bart Van Assche $FULL is a global variable. Avoid that shellcheck complains about it. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> --- check | 2 ++ 1 file changed, 2 insertions(+) diff --git a/check b/check index 5f53fa105f72..f1feb96b293e 100755 --- a/check +++ b/check @@ -301,6 +301,8 @@ _call_test() { local test_func="$1" local seqres="${RESULTS_DIR}/${TEST_NAME}" FULL="${seqres}.full" + # Avoid that shellcheck complains that $FULL appears unused. + echo "$FULL" >/dev/null declare -A TEST_DEV_QUEUE_SAVED _read_last_test_run -- 2.17.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 5/9] check: Avoid that shellcheck complains that $FULL appears unused 2018-06-19 20:23 ` [PATCH 5/9] check: Avoid that shellcheck complains that $FULL appears unused Bart Van Assche @ 2018-06-25 9:10 ` Johannes Thumshirn 0 siblings, 0 replies; 20+ messages in thread From: Johannes Thumshirn @ 2018-06-25 9:10 UTC (permalink / raw) To: Bart Van Assche; +Cc: Omar Sandoval, linux-block Looks good, Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 6/9] Multiple tests: remove unused and undefined variables 2018-06-19 20:23 [PATCH 0/9] blktests: Re-enable shellcheck warnings Bart Van Assche ` (4 preceding siblings ...) 2018-06-19 20:23 ` [PATCH 5/9] check: Avoid that shellcheck complains that $FULL appears unused Bart Van Assche @ 2018-06-19 20:23 ` Bart Van Assche 2018-06-25 9:13 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 7/9] Avoid passing tests/block/002 arguments to _init_scsi_debug Bart Van Assche ` (3 subsequent siblings) 9 siblings, 1 reply; 20+ messages in thread From: Bart Van Assche @ 2018-06-19 20:23 UTC (permalink / raw) To: Omar Sandoval; +Cc: linux-block, Bart Van Assche, Chaitanya Kulkarni Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> --- tests/loop/003 | 3 --- tests/nvme/010 | 3 +-- tests/nvme/011 | 3 +-- tests/nvme/012 | 1 - tests/nvme/013 | 1 - 5 files changed, 2 insertions(+), 9 deletions(-) diff --git a/tests/loop/003 b/tests/loop/003 index 353d4fcfa33c..6f6fa8d18ebe 100755 --- a/tests/loop/003 +++ b/tests/loop/003 @@ -28,11 +28,8 @@ requires() { } test() { - local loop_dev echo "Running ${TEST_NAME}" - loop_dev="$(losetup -f)" - # In a subshell so TIMEFORMAT doesn't get clobbered. ( TIMEFORMAT="Test took %0R seconds" diff --git a/tests/nvme/010 b/tests/nvme/010 index 956c6597a374..b6849dbad375 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -38,7 +38,6 @@ test() { modprobe nvme-loop local port - local ret=0 local nvmedev local loop_dev local file_path="${TMPDIR}/img" @@ -70,7 +69,7 @@ test() { losetup -d "${loop_dev}" rm "${file_path}" - rm -f local*verify*state "${fio_out}" + rm -f local*verify*state modprobe -r nvme_loop modprobe -r nvmet diff --git a/tests/nvme/011 b/tests/nvme/011 index 872a99af4f8c..f26eb155809c 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -37,7 +37,6 @@ test() { modprobe nvme-loop local port - local ret=0 local nvmedev local file_path local file_path="${TMPDIR}/img" @@ -65,7 +64,7 @@ test() { _remove_nvmet_port "${port}" rm "${file_path}" - rm -f local-write-and-verify*state "${fio_out}" + rm -f local-write-and-verify*state modprobe -r nvme_loop modprobe -r nvmet diff --git a/tests/nvme/012 b/tests/nvme/012 index 8f632b30734d..e570793dd5db 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -38,7 +38,6 @@ test() { modprobe nvme-loop local port - local ret=0 local nvmedev local loop_dev local mount_dir="/mnt/blktests" diff --git a/tests/nvme/013 b/tests/nvme/013 index 0ccb083b175b..247fe9f252fa 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -38,7 +38,6 @@ test() { modprobe nvme-loop local port - local ret=0 local nvmedev local mount_dir="/mnt/blktests/" local file_path="${TMPDIR}/img" -- 2.17.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 6/9] Multiple tests: remove unused and undefined variables 2018-06-19 20:23 ` [PATCH 6/9] Multiple tests: remove unused and undefined variables Bart Van Assche @ 2018-06-25 9:13 ` Johannes Thumshirn 0 siblings, 0 replies; 20+ messages in thread From: Johannes Thumshirn @ 2018-06-25 9:13 UTC (permalink / raw) To: Bart Van Assche; +Cc: Omar Sandoval, linux-block, Chaitanya Kulkarni Looks good, Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 7/9] Avoid passing tests/block/002 arguments to _init_scsi_debug 2018-06-19 20:23 [PATCH 0/9] blktests: Re-enable shellcheck warnings Bart Van Assche ` (5 preceding siblings ...) 2018-06-19 20:23 ` [PATCH 6/9] Multiple tests: remove unused and undefined variables Bart Van Assche @ 2018-06-19 20:23 ` Bart Van Assche 2018-06-25 9:16 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 8/9] check: Suppress a shellcheck warning about the DMESG_FILTER initialization Bart Van Assche ` (2 subsequent siblings) 9 siblings, 1 reply; 20+ messages in thread From: Bart Van Assche @ 2018-06-19 20:23 UTC (permalink / raw) To: Omar Sandoval; +Cc: linux-block, Bart Van Assche This patch avoids that shellcheck reports the following: tests/block/002:34:7: note: Use _init_scsi_debug "$@" if function's $1 should mean script's $1. [SC2119] Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> --- common/scsi_debug | 3 +++ tests/block/002 | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/common/scsi_debug b/common/scsi_debug index e26e85637369..d8e6b71899a3 100644 --- a/common/scsi_debug +++ b/common/scsi_debug @@ -21,7 +21,10 @@ _have_scsi_debug() { _have_module scsi_debug } +# The _init_scsi_debug() argument list is passed to modprobe scsi_debug. "--" +# is filtered out from the start of the argument list. _init_scsi_debug() { + [ "$1" = "--" ] && shift if ! modprobe -r scsi_debug || ! modprobe scsi_debug "$@"; then return 1 fi diff --git a/tests/block/002 b/tests/block/002 index 32a0f818b95b..10e3f157c018 100755 --- a/tests/block/002 +++ b/tests/block/002 @@ -31,7 +31,7 @@ requires() { test() { echo "Running ${TEST_NAME}" - if ! _init_scsi_debug; then + if ! _init_scsi_debug --; then return 1 fi -- 2.17.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 7/9] Avoid passing tests/block/002 arguments to _init_scsi_debug 2018-06-19 20:23 ` [PATCH 7/9] Avoid passing tests/block/002 arguments to _init_scsi_debug Bart Van Assche @ 2018-06-25 9:16 ` Johannes Thumshirn 0 siblings, 0 replies; 20+ messages in thread From: Johannes Thumshirn @ 2018-06-25 9:16 UTC (permalink / raw) To: Bart Van Assche; +Cc: Omar Sandoval, linux-block Looks good, Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 8/9] check: Suppress a shellcheck warning about the DMESG_FILTER initialization 2018-06-19 20:23 [PATCH 0/9] blktests: Re-enable shellcheck warnings Bart Van Assche ` (6 preceding siblings ...) 2018-06-19 20:23 ` [PATCH 7/9] Avoid passing tests/block/002 arguments to _init_scsi_debug Bart Van Assche @ 2018-06-19 20:23 ` Bart Van Assche 2018-06-25 9:16 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 9/9] Makefile: Do not suppress useful shellcheck warnings Bart Van Assche 2018-06-25 19:48 ` [PATCH 0/9] blktests: Re-enable " Omar Sandoval 9 siblings, 1 reply; 20+ messages in thread From: Bart Van Assche @ 2018-06-19 20:23 UTC (permalink / raw) To: Omar Sandoval; +Cc: linux-block, Bart Van Assche Avoid that shellcheck reports the following: check:396:2: warning: Use var=$(command) to assign output (or quote to assign string). [SC2209] Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> --- check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check b/check index f1feb96b293e..e7439e163884 100755 --- a/check +++ b/check @@ -393,7 +393,7 @@ _call_test() { _run_test() { TEST_NAME="$1" CHECK_DMESG=1 - DMESG_FILTER=cat + DMESG_FILTER="cat" # shellcheck disable=SC1090 . "tests/${TEST_NAME}" -- 2.17.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 8/9] check: Suppress a shellcheck warning about the DMESG_FILTER initialization 2018-06-19 20:23 ` [PATCH 8/9] check: Suppress a shellcheck warning about the DMESG_FILTER initialization Bart Van Assche @ 2018-06-25 9:16 ` Johannes Thumshirn 0 siblings, 0 replies; 20+ messages in thread From: Johannes Thumshirn @ 2018-06-25 9:16 UTC (permalink / raw) To: Bart Van Assche; +Cc: Omar Sandoval, linux-block Looks good, Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 9/9] Makefile: Do not suppress useful shellcheck warnings 2018-06-19 20:23 [PATCH 0/9] blktests: Re-enable shellcheck warnings Bart Van Assche ` (7 preceding siblings ...) 2018-06-19 20:23 ` [PATCH 8/9] check: Suppress a shellcheck warning about the DMESG_FILTER initialization Bart Van Assche @ 2018-06-19 20:23 ` Bart Van Assche 2018-06-25 9:16 ` Johannes Thumshirn 2018-06-25 19:48 ` [PATCH 0/9] blktests: Re-enable " Omar Sandoval 9 siblings, 1 reply; 20+ messages in thread From: Bart Van Assche @ 2018-06-19 20:23 UTC (permalink / raw) To: Omar Sandoval; +Cc: linux-block, Bart Van Assche All the shellcheck warnings that are currently suppressed are useful. Additionally, it is easy to avoid false positives for the currently suppressed categories of shellcheck warnings. Hence stop suppressing shellcheck warnings. See also commit 17a59e0dc212 ("Fix all shellcheck warnings"). Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> --- Makefile | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 14ba8341dae5..c4bffa2d3f32 100644 --- a/Makefile +++ b/Makefile @@ -4,21 +4,8 @@ all: clean: $(MAKE) -C src clean -# SC1090: "Can't follow non-constant source". We use variable sources all over -# the place. -# SC2034: "VARIABLE appears unused". All test scripts use this for the test -# metadata, and many helper functions define global variables. -# SC2119: "Use foo "$@" if function's $1 should mean script's $1". False -# positives on helpers like _init_scsi_debug. -# SC2154: "VARIABLE is referenced but not assigned". False positives on -# TEST_RUN[foo]=bar. -# 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 - check: - shellcheck -x -e $(SHELLCHECK_EXCLUDE) -f gcc check new common/* tests/*/[0-9]*[0-9] + shellcheck -x -f gcc check new common/* tests/*/[0-9]*[0-9] ! grep TODO tests/*/[0-9]*[0-9] .PHONY: all check -- 2.17.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 9/9] Makefile: Do not suppress useful shellcheck warnings 2018-06-19 20:23 ` [PATCH 9/9] Makefile: Do not suppress useful shellcheck warnings Bart Van Assche @ 2018-06-25 9:16 ` Johannes Thumshirn 0 siblings, 0 replies; 20+ messages in thread From: Johannes Thumshirn @ 2018-06-25 9:16 UTC (permalink / raw) To: Bart Van Assche; +Cc: Omar Sandoval, linux-block Looks good, Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/9] blktests: Re-enable shellcheck warnings 2018-06-19 20:23 [PATCH 0/9] blktests: Re-enable shellcheck warnings Bart Van Assche ` (8 preceding siblings ...) 2018-06-19 20:23 ` [PATCH 9/9] Makefile: Do not suppress useful shellcheck warnings Bart Van Assche @ 2018-06-25 19:48 ` Omar Sandoval 9 siblings, 0 replies; 20+ messages in thread From: Omar Sandoval @ 2018-06-25 19:48 UTC (permalink / raw) To: Bart Van Assche; +Cc: Omar Sandoval, linux-block On Tue, Jun 19, 2018 at 01:23:44PM -0700, Bart Van Assche wrote: > Hello Omar, > > Since I noticed that several useful shellcheck warnings are suppressed in the > blktests project, I came up with this patch series that reenables all > shellcheck warnings and also suppresses false positive shellcheck reports. It > would be appreciated if you could have a look at this patch series. > > Thanks, > > Bart. > Bart Van Assche (9): > common/rc: Fix _have_tracepoint() > Annotate include statements in shell scripts where the source file is > a variable > check, tests/meta/012: Use array["index"] instead of array[index] Applied these. > Suppress shellcheck complaints about global variables > check: Avoid that shellcheck complains that $FULL appears unused These are definitely useful warnings that would be good to reenable, but I'm not a huge fan of this fix. Adding boilerplate for the sake of appeasing the linter is... meh. I think what we can do is make the tests/foo/group and common/rc sourcing explicit and put the workaround stuff in common/rc. Still boilerplate but it at least appears to serve a real purpose. I'll work on that. > Multiple tests: remove unused and undefined variables Applied this one. > Avoid passing tests/block/002 arguments to _init_scsi_debug This warning is stupid, I'd prefer to keep it disabled. > check: Suppress a shellcheck warning about the DMESG_FILTER > initialization This warning is also pretty pointless, but the fix is so trivial that I applied it anyways. > Makefile: Do not suppress useful shellcheck warnings Of course, I had to replace this patch since I kept some of the warnings in. Thanks for the cleanup! > Makefile | 15 +------------- > check | 53 ++++++++++++++++++++++++++--------------------- > common/cpuhotplug | 2 ++ > common/fio | 2 ++ > common/iopoll | 2 ++ > common/loop | 1 + > common/nbd | 2 ++ > common/nvme | 2 ++ > common/rc | 2 ++ > common/scsi | 2 ++ > common/scsi_debug | 3 +++ > common/shellcheck | 4 ++++ > new | 1 + > tests/block/001 | 1 + > tests/block/002 | 3 ++- > tests/block/003 | 2 ++ > tests/block/004 | 2 ++ > tests/block/005 | 2 ++ > tests/block/006 | 2 ++ > tests/block/007 | 1 + > tests/block/009 | 1 + > tests/block/010 | 2 ++ > tests/block/011 | 2 ++ > tests/block/012 | 2 ++ > tests/block/013 | 2 ++ > tests/block/014 | 2 ++ > tests/block/015 | 2 ++ > tests/block/016 | 2 ++ > tests/block/017 | 2 ++ > tests/block/018 | 2 ++ > tests/block/019 | 2 ++ > tests/block/020 | 2 ++ > tests/block/021 | 2 ++ > tests/loop/001 | 2 ++ > tests/loop/003 | 5 ++--- > tests/loop/005 | 2 ++ > tests/meta/001 | 2 ++ > tests/meta/002 | 2 ++ > tests/meta/003 | 2 ++ > tests/meta/004 | 2 ++ > tests/meta/005 | 2 ++ > tests/meta/006 | 2 ++ > tests/meta/007 | 2 ++ > tests/meta/008 | 2 ++ > tests/meta/009 | 2 ++ > tests/meta/010 | 2 ++ > tests/meta/011 | 2 ++ > tests/meta/012 | 6 ++++-- > tests/nbd/001 | 2 ++ > tests/nbd/002 | 2 ++ > tests/nvme/001 | 2 ++ > tests/nvme/002 | 2 ++ > tests/nvme/003 | 2 ++ > tests/nvme/004 | 2 ++ > tests/nvme/005 | 2 ++ > tests/nvme/006 | 2 ++ > tests/nvme/007 | 2 ++ > tests/nvme/008 | 2 ++ > tests/nvme/009 | 2 ++ > tests/nvme/010 | 5 +++-- > tests/nvme/011 | 5 +++-- > tests/nvme/012 | 3 ++- > tests/nvme/013 | 3 ++- > tests/scsi/001 | 2 ++ > tests/scsi/002 | 2 ++ > tests/scsi/003 | 2 ++ > tests/scsi/004 | 1 + > 67 files changed, 161 insertions(+), 50 deletions(-) > create mode 100644 common/shellcheck > > -- > 2.17.1 > ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2018-06-25 19:49 UTC | newest] Thread overview: 20+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-06-19 20:23 [PATCH 0/9] blktests: Re-enable shellcheck warnings Bart Van Assche 2018-06-19 20:23 ` [PATCH 1/9] common/rc: Fix _have_tracepoint() Bart Van Assche 2018-06-25 9:07 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 2/9] Annotate include statements in shell scripts where the source file is a variable Bart Van Assche 2018-06-25 9:08 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 3/9] check, tests/meta/012: Use array["index"] instead of array[index] Bart Van Assche 2018-06-25 9:09 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 4/9] Suppress shellcheck complaints about global variables Bart Van Assche 2018-06-25 9:09 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 5/9] check: Avoid that shellcheck complains that $FULL appears unused Bart Van Assche 2018-06-25 9:10 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 6/9] Multiple tests: remove unused and undefined variables Bart Van Assche 2018-06-25 9:13 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 7/9] Avoid passing tests/block/002 arguments to _init_scsi_debug Bart Van Assche 2018-06-25 9:16 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 8/9] check: Suppress a shellcheck warning about the DMESG_FILTER initialization Bart Van Assche 2018-06-25 9:16 ` Johannes Thumshirn 2018-06-19 20:23 ` [PATCH 9/9] Makefile: Do not suppress useful shellcheck warnings Bart Van Assche 2018-06-25 9:16 ` Johannes Thumshirn 2018-06-25 19:48 ` [PATCH 0/9] blktests: Re-enable " Omar Sandoval
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).