@@ -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=()
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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"
@@ -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
}
new file mode 100644
@@ -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
@@ -18,6 +18,7 @@
set -e
. common/rc
+. common/shellcheck
prompt_yes_no() {
if [[ $2 =~ ^[Yy] ]]; then
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -22,6 +22,7 @@
DESCRIPTION="check page-cache coherency after BLKDISCARD"
. common/scsi_debug
+. common/shellcheck
requires() {
_have_scsi_debug && _have_program xfs_io
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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() {
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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
@@ -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"
@@ -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() {
@@ -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
@@ -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
@@ -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
@@ -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() {
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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"
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