Re: [PATCH 7/9] Avoid passing tests/block/002 arguments to _init_scsi_debug

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 7/9] Avoid passing tests/block/002 arguments to _init_scsi_debug

2018-06-19 Thread 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 
---
 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