]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
ublk/rc: prefer to rublk over miniublk
authorMing Lei <ming.lei@redhat.com>
Sat, 11 Nov 2023 11:42:53 +0000 (19:42 +0800)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Mon, 13 Nov 2023 02:53:45 +0000 (11:53 +0900)
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@redhat.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Makefile
README.md
src/rublk_wrapper.sh [new file with mode: 0755]
tests/ublk/rc

index 4bed1dac4e1022f55c215dab5ee1c3f99dd9bbda..43f2ab0b4f370ec8d1c6ce9d752154953dbfd8a5 100644 (file)
--- 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 .
 
index b6445d6c1a6f0c491b5d81771abec9671348c738..09fbb1e8ed8cf14be0155e26489da402701773b3 100644 (file)
--- a/README.md
+++ b/README.md
@@ -26,6 +26,7 @@ Some tests require the following:
 - multipath-tools (Debian, openSUSE, Arch Linux) or device-mapper-multipath
   (Fedora)
 - dmsetup (Debian) or device-mapper (Fedora, openSUSE, Arch Linux)
+- rublk (`cargo install --version=^0.1 rublk`) for ublk test
 
 Build blktests with `make`. Optionally, install it to a known location with
 `make install` (`/usr/local/blktests` by default, but this can be changed by
diff --git a/src/rublk_wrapper.sh b/src/rublk_wrapper.sh
new file mode 100755 (executable)
index 0000000..2e79a01
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2023 Ming Lei <ming.lei@redhat.com>
+#
+# rublk wrapper for adapting miniublk's command line
+
+PARA=()
+ACT=$1
+for arg in "$@"; do
+       if [ "$arg" = "-t" ]; then
+               continue
+       fi
+
+       if [ "$ACT" = "recover" ]; then
+               if [ "$arg" = "loop" ] || [ "$arg" = "null" ]; then
+                       continue;
+               fi
+
+               if [ -f "$arg" ]; then
+                       continue
+               fi
+
+               if [ "$arg" = "-f" ]; then
+                       continue
+               fi
+               PARA+=("$arg")
+       else
+               PARA+=("$arg")
+       fi
+done
+rublk "${PARA[@]}"
index c553296c5083e2dcd38c9aa1c125df1f1eb8fe3d..5fbf8613ee8501047291338dffe046a0e2440d77 100644 (file)
@@ -14,4 +14,8 @@ group_requires() {
        _have_fio
 }
 
-export UBLK_PROG="src/miniublk"
+if which rublk > /dev/null 2>&1; then
+       export UBLK_PROG="src/rublk_wrapper.sh"
+else
+       export UBLK_PROG="src/miniublk"
+fi