Re: [PATCH blktests] ublk/rc: prefer to rublk over miniublk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Nov 06, 2023 / 08:35, Ming Lei wrote:
> Add one wrapper script for using rublk to run ublk tests, and prefer
> to rublk because it is well implemented and more reliable.
> 
> This way has been run for months in rublk's github CI test.
> 
> https://github.com/ming1/rublk
> 
> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>

Hi Ming, it sounds good to shift from miniublk to rublk to reduce maintenance
work of src/miniublk. I tried the patch, and found a couple of points to
improve.

1) The issue that Akinobu addressed with the commit 880fb6afff2e is observed
   with rublk. I did the command lines below which were noted in his commit:

    $ modprobe -r scsi_debug
    $ modprobe scsi_debug sector_size=4096 dev_size_mb=2048
    $ mkfs.ext4 /dev/sdX
    $ mount /dev/sdX results/
    $ ./check ublk/003

  Then I observed the failure:

ublk/003 (test mounting block device exported by ublk)       [failed]
    runtime  0.529s  ...  0.465s
    --- tests/ublk/003.out      2023-09-05 10:05:11.292889193 +0900
    +++ /home/shin/Blktests/blktests/results/nodev/ublk/003.out.bad     2023-11-07 14:18:44.966654288 +0900
    @@ -1,2 +1,3 @@
     Running ublk/003
    +got , should be ext4
     Test complete

  So I guess rublk needs a similar fix as Akinobu did for miniublk.


2) I ran shellcheck for src/rublk_wrapper.sh and observed two meesages:

    src/rublk_wrapper.sh:10:12: error: Double quote array expansions to avoid re-splitting elements. [SC2068]
    src/rublk_wrapper.sh:32:7: note: Double quote to prevent globbing and word splitting. [SC2086]

I suggest to apply changes below to make the script a bit more robust.

diff --git a/Makefile b/Makefile
index 4bed1da..43f2ab0 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@ SHELLCHECK_EXCLUDE := SC2119
 
 check:
 	shellcheck -x -e $(SHELLCHECK_EXCLUDE) -f gcc check new common/* \
-		tests/*/rc tests/*/[0-9]*[0-9]
+		tests/*/rc tests/*/[0-9]*[0-9] src/*.sh
 	! grep TODO tests/*/rc tests/*/[0-9]*[0-9]
 	! find -name '*.out' -perm /u=x+g=x+o=x -printf '%p is executable\n' | grep .
 
diff --git a/src/rublk_wrapper.sh b/src/rublk_wrapper.sh
index 803743e..2e79a01 100755
--- a/src/rublk_wrapper.sh
+++ b/src/rublk_wrapper.sh
@@ -4,9 +4,9 @@
 #
 # rublk wrapper for adapting miniublk's command line
 
-PARA=""
+PARA=()
 ACT=$1
-for arg in $@; do
+for arg in "$@"; do
 	if [ "$arg" = "-t" ]; then
 		continue
 	fi
@@ -23,9 +23,9 @@ for arg in $@; do
 		if [ "$arg" = "-f" ]; then
 			continue
 		fi
-		PARA+=" $arg"
+		PARA+=("$arg")
 	else
-		PARA+=" $arg"
+		PARA+=("$arg")
 	fi
 done
-rublk $PARA
+rublk "${PARA[@]}"




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux