Re: [PATCH 4/9] Suppress shellcheck complaints about global variables

2018-06-25 Thread Johannes Thumshirn
Looks good,
Reviewed-by: Johannes Thumshirn 
-- 
Johannes Thumshirn  Storage
jthumsh...@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


[PATCH 4/9] Suppress shellcheck complaints about global variables

2018-06-19 Thread 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 
---
 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 .
 
+. 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 .
 
+. 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 .
 
+. 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 .
 
+. 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 .
 
+. 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 .
 
+. common/shellcheck
+
 _have_scsi_generic() {
_have_module sg
 }
diff --git a/common/shellcheck b/common/shellcheck
new file mode 100644
index ..1ec759976dd7
--- /dev/null
+++ b/common/shellcheck
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+# Suppress shellcheck complaints about