public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: linux-block@vger.kernel.org, Ming Lei <ming.lei@redhat.com>
Subject: [PATCH blktests] ublk/rc: prefer to rublk over miniublk
Date: Mon,  6 Nov 2023 08:35:23 +0800	[thread overview]
Message-ID: <20231106003523.1923694-1-ming.lei@redhat.com> (raw)

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>
---
 README.md            |  1 +
 src/rublk_wrapper.sh | 31 +++++++++++++++++++++++++++++++
 tests/ublk/rc        |  6 +++++-
 3 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100755 src/rublk_wrapper.sh

diff --git a/README.md b/README.md
index b6445d6..313a3cc 100644
--- 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.2 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
index 0000000..803743e
--- /dev/null
+++ b/src/rublk_wrapper.sh
@@ -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
diff --git a/tests/ublk/rc b/tests/ublk/rc
index c553296..5fbf861 100644
--- a/tests/ublk/rc
+++ b/tests/ublk/rc
@@ -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
-- 
2.41.0


             reply	other threads:[~2023-11-06  0:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06  0:35 Ming Lei [this message]
2023-11-07  5:28 ` [PATCH blktests] ublk/rc: prefer to rublk over miniublk Shinichiro Kawasaki
2023-11-08  9:07   ` Ming Lei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231106003523.1923694-1-ming.lei@redhat.com \
    --to=ming.lei@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox