diff mbox series

[blktests] block/007: support fallback device

Message ID 20220629073244.941432-1-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series [blktests] block/007: support fallback device | expand

Commit Message

Shin'ichiro Kawasaki June 29, 2022, 7:32 a.m. UTC
The test case block/007 requires TEST_DEVS which support IO polling.
To allow test case executed without such devices, fallback to a null_blk
device when TEST_DEVS is empty.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/block/007 | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/tests/block/007 b/tests/block/007
index a8fe998..0cb0888 100755
--- a/tests/block/007
+++ b/tests/block/007
@@ -6,6 +6,7 @@ 
 
 . tests/block/rc
 . common/iopoll
+. common/null_blk
 
 DESCRIPTION="test classic and hybrid IO polling"
 TIMED=1
@@ -19,6 +20,17 @@  device_requires() {
 		_require_test_dev_supports_io_poll_delay
 }
 
+fallback_device() {
+	if ! _configure_null_blk nullb1 power=1; then
+		return 1
+	fi
+	echo /dev/nullb1
+}
+
+cleanup_fallback_device() {
+	_exit_null_blk
+}
+
 run_fio_job() {
 	if _test_dev_is_rotational; then
 		size="32m"