[PATCH blktests 02/13] common/null_blk: allow _configure_null_blk with built-in null_blk

Christoph Hellwig
2022-06-03T04:56:09Z

Test that do use _configure_null_blk already configure do not actually
require a built-in null_blk driver. Relax the check in _have_null_blk
to just require a driver instead of a module, and instead set a skip
reason instead of failing in _init_null_blk when null_blk is built-in
or otherwise not available.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
common/null_blk | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/null_blk b/common/null_blk
index 6611db0..381f6b8 100644
--- a/common/null_blk
+++ b/common/null_blk
@@ -4,8 +4,10 @@
#
# null_blk helper functions.

+. common/shellcheck
+
_have_null_blk() {
- _have_modules null_blk
+ _have_driver null_blk
}

_remove_null_blk_devices() {
@@ -22,6 +24,7 @@ _init_null_blk() {
if (( RUN_FOR_ZONED )); then zoned="zoned=1"; fi

if ! modprobe -r null_blk || ! modprobe null_blk "$@" "${zoned}" ; then
+ SKIP_REASON="requires modular null_blk"
return 1
fi

--
2.30.2