@@ -35,6 +35,14 @@ _have_module() {
return 1
}
+_have_kernel_module() {
+ if modprobe -n -q "$1" || test -d "/sys/module/$1" ; then
+ return 0
+ fi
+ SKIP_REASON="$1 is not available as a module or built into the kernel"
+ return 1
+}
+
_have_module_param() {
if ! modinfo -F parm -0 "$1" | grep -q -z "^$2:"; then
SKIP_REASON="$1 module does not have parameter $2"
@@ -60,7 +68,7 @@ _have_src_program() {
}
_have_loop() {
- _have_module loop && _have_program losetup
+ _have_kernel_module loop && _have_program losetup
}
_have_blktrace() {
@@ -10,8 +10,8 @@
DESCRIPTION="create many subsystems and test discovery"
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_configfs
}
test() {
@@ -11,8 +11,8 @@ DESCRIPTION="test if we're sending keep-alives to a discovery controller"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop \
- && _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_configfs
}
test() {
@@ -12,8 +12,8 @@ DESCRIPTION="test nvme and nvmet UUID NS descriptors"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_configfs
}
test() {
@@ -11,9 +11,9 @@ DESCRIPTION="reset local loopback target"
QUICK=1
requires() {
- _have_module nvme-loop && _have_module nvmet && _have_module loop && \
- _have_configfs && _have_module nvme-core && \
- _have_module_param nvme-core multipath
+ _have_module nvme-loop && _have_module nvmet && \
+ _have_kernel_module loop && _have_configfs && \
+ _have_module nvme-core && _have_module_param nvme-core multipath
}
test() {
@@ -10,8 +10,9 @@ DESCRIPTION="create an NVMeOF target with a block device-backed ns"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_module nvmet && _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_module nvmet && \
+ _have_configfs
}
test() {
@@ -10,8 +10,9 @@ DESCRIPTION="create an NVMeOF host with a block device-backed ns"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_module nvmet && _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_module nvmet && \
+ _have_configfs
}
test() {
@@ -10,7 +10,7 @@ DESCRIPTION="run data verification fio job on NVMeOF block device-backed ns"
TIMED=1
requires() {
- _have_program nvme && _have_fio && _have_module loop && \
+ _have_program nvme && _have_fio && _have_kernel_module loop && \
_have_configfs && _have_module nvme-loop && \
_have_module nvmet
}
@@ -11,7 +11,7 @@ TIMED=1
requires() {
_have_program nvme && _have_program mkfs.xfs && _have_program fio && \
- _have_module loop && _have_module nvmet && \
+ _have_kernel_module loop && _have_module nvmet && \
_have_module nvme-loop && _have_configfs
}
@@ -10,8 +10,9 @@ DESCRIPTION="flush a NVMeOF block device-backed ns"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_module nvmet && _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_module nvmet && \
+ _have_configfs
}
test() {
@@ -10,8 +10,8 @@ DESCRIPTION="unit test for NVMe flush for file backed ns"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_configfs
}
test() {
@@ -10,8 +10,9 @@ DESCRIPTION="test NVMe DSM Discard command on NVMeOF block-device ns"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_module nvmet && _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_module nvmet && \
+ _have_configfs
}
test() {
@@ -10,8 +10,9 @@ DESCRIPTION="test NVMe list command on NVMeOF file-backed ns"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_module nvmet && _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_module nvmet && \
+ _have_configfs
}
test() {
@@ -10,8 +10,9 @@ DESCRIPTION="test NVMe reset command on NVMeOF file-backed ns"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_module nvmet && _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_module nvmet && \
+ _have_configfs
}
test() {
@@ -10,8 +10,9 @@ DESCRIPTION="test NVMe smart-log command on NVMeOF block-device ns"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_module nvmet && _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_module nvmet && \
+ _have_configfs
}
test() {
@@ -10,8 +10,9 @@ DESCRIPTION="test NVMe smart-log command on NVMeOF file-backed ns"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_module nvmet && _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_module nvmet && \
+ _have_configfs
}
test() {
@@ -10,8 +10,9 @@ DESCRIPTION="test NVMe effects-log command on NVMeOF file-backed ns"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_module nvmet && _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_module nvmet && \
+ _have_configfs
}
test() {
@@ -10,8 +10,9 @@ DESCRIPTION="test NVMe ns-descs command on NVMeOF file-backed ns"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_module nvmet && _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_module nvmet && \
+ _have_configfs
}
test() {
@@ -10,8 +10,9 @@ DESCRIPTION="test NVMe ns-rescan command on NVMeOF file-backed ns"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_module nvmet && _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_module nvmet && \
+ _have_configfs
}
test() {
@@ -10,8 +10,9 @@ DESCRIPTION="test NVMe list-subsys command on NVMeOF file-backed ns"
QUICK=1
requires() {
- _have_program nvme && _have_module nvme-loop && _have_module loop && \
- _have_module nvmet && _have_configfs
+ _have_program nvme && _have_module nvme-loop && \
+ _have_kernel_module loop && _have_module nvmet && \
+ _have_configfs
}
test() {
A number of kernel modules used by blktests must be compiled as modules, since the module needs to be loaded with specific options, or part of the test is to exercise what what happens when the kernel module is loaded. This is not true for the loop driver, so add a new bash function, _have_kernel_module which works like _have_module but will not fail if the driver is compiled directly into the kernel. Signed-off-by: Theodore Ts'o <tytso@mit.edu> --- common/rc | 10 +++++++++- tests/nvme/002 | 4 ++-- tests/nvme/003 | 4 ++-- tests/nvme/004 | 4 ++-- tests/nvme/005 | 6 +++--- tests/nvme/006 | 5 +++-- tests/nvme/008 | 5 +++-- tests/nvme/010 | 2 +- tests/nvme/012 | 2 +- tests/nvme/014 | 5 +++-- tests/nvme/015 | 4 ++-- tests/nvme/019 | 5 +++-- tests/nvme/021 | 5 +++-- tests/nvme/022 | 5 +++-- tests/nvme/023 | 5 +++-- tests/nvme/024 | 5 +++-- tests/nvme/025 | 5 +++-- tests/nvme/026 | 5 +++-- tests/nvme/027 | 5 +++-- tests/nvme/028 | 5 +++-- 20 files changed, 58 insertions(+), 38 deletions(-)