Skip to contentSkip to conversation

ublk/rc: prefer to rublk over miniublk

PATCH In review Ming Lei 2 participants 2 messages Nov 11, 2023 – Nov 13, 2023

Subsystems (2)
lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH v2 1/1 ublk/rc: prefer to rublk over miniublk

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

---
V2:
- fix 'make check' warning, by taking Shinichiro's delta change
- rublk v0.1.3 fixes loop block size issue reported recently from Akinobu

 Makefile             |  2 +-
 README.md            |  1 +
 src/rublk_wrapper.sh | 31 +++++++++++++++++++++++++++++++
 tests/ublk/rc        |  6 +++++-
 4 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100755 src/rublk_wrapper.sh
Makefile +1 -1
index 4bed1da..43f2ab0 100644
@@ -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 .
 
README.md +1 -0
index b6445d6..09fbb1e 100644
@@ -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
src/rublk_wrapper.sh new file +31 -0
new file mode 100755
index 0000000..2e79a01
@@ -0,0 +1,31 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2023 Ming Lei <[email protected]>
+#
+# 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[@]}"
tests/ublk/rc +5 -1
index c553296..5fbf861 100644
@@ -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
Signature · 1 line
2.41.0