Daniel Wagner [Wed, 29 Mar 2023 09:02:02 +0000 (11:02 +0200)]
nvme/047: Test different queue types for fabrics transports
Test if the fabrics transports are handling different queues types
correctly.
Currently, only TCP and RDMA from the fabric transport family support
this feature, so limit the test to these two.
We also issue some I/O to make sure that not just the plain connect
works. For this we have to use a file system which supports direct I/O
and hence we use a device backend.
Shin'ichiro Kawasaki [Wed, 1 Mar 2023 08:03:01 +0000 (17:03 +0900)]
src/Makefile: fix number sign handling in macro
GNU make version 4.3 introduced a backward-incompatible change. The
number sign '#' now should not have preceding backslash in a macro [1].
To make macros with number signs work regardless of make versions,
assign the number sign to a variable.
Ming Lei [Fri, 24 Feb 2023 12:45:02 +0000 (20:45 +0800)]
block/033: add test to cover gendisk leak
So far only sync ublk removal is supported, and the device's
last reference is dropped in gendisk's ->free_disk(), so it
can be used to test gendisk leak issue.
Signed-off-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Ming Lei [Fri, 24 Feb 2023 12:45:01 +0000 (20:45 +0800)]
src: add mini ublk source code
Prepare for adding ublk related test:
1) ublk delete is sync removal, this way is convenient to
blkg/queue/disk instance leak issue
2) mini ublk has two builtin target(null, loop), and loop IO is
handled by io_uring, so we can use ublk to cover part of io_uring
workloads
3) not like loop/nbd, ublk won't pre-allocate/add disk, and always
add/delete disk dynamically, this way may cover disk plug & unplug
tests
4) ublk specific test given people starts to use it, so better to
let blktest cover ublk related tests
Add mini ublk source for test purpose only, which is easy to use:
./miniublk add -t {null|loop} [-q nr_queues] [-d depth] [-n dev_id]
default: nr_queues=2(max 4), depth=128(max 128), dev_id=-1(auto allocation)
-t loop -f backing_file
-t null
./miniublk del [-n dev_id] -a
-a delete all devices, -n delete specified device
./miniublk list [-n dev_id] -a
-a list all devices, -n list specified device, default -a
miniublk depends on liburing 2.2, adds HAVE_LIBURING for checking if
liburing 2.2 exists; also add HAVE_UBLK_HEADER for checking ublk kernel
UAPI header exits. If either of two dependencies can't be met, simply
ignore miniublk target.
Also v6.0 is the 1st linux kernel release with ublk.
Signed-off-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Shin'ichiro Kawasaki [Mon, 13 Feb 2023 02:00:08 +0000 (11:00 +0900)]
check, common/rc: support normal user privilege
To run commands with normal user privilege, add a new config variable
NORMAL_USER and two helper functions _run_user and _require_normal_user.
The user name specified to NORMAL_USER is used to run the commands
specified to _run_user. The test cases which require NORMAL_USER shall
call _require_normal_user to ensure the NORMAL_USER is valid.
Ming Lei [Wed, 8 Feb 2023 01:02:35 +0000 (09:02 +0800)]
block/032: add test to cover umount one deleted disk
disk can be disappear any time because of error handling, when
it is usually being mounted. Make sure umount can be done successfully
after disk deleting is done from error handling.
Hannes Reinecke [Mon, 6 Feb 2023 14:51:42 +0000 (15:51 +0100)]
Update tests for discovery log page changes
With TP8013 the discovery log includes now a record for the
discovery subsystem itself, so we need to update the blktests
to be aware of the new discovery log page layout.
Bart Van Assche [Thu, 2 Feb 2023 18:20:39 +0000 (10:20 -0800)]
src/discontiguous-io.cpp: Fix the build
Fix the following build error:
g++ -O2 -std=c++11 -Wall -Wextra -Wshadow -Wno-sign-compare -Werror -DHAVE_LINUX_BLKZONED_H -o discontiguous-io discontiguous-io.cpp
discontiguous-io.cpp: In function ‘void dumphex(std::ostream&, const void*, size_t)’:
discontiguous-io.cpp:92:24: error: ‘uintptr_t’ was not declared in this scope
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bart Van Assche [Wed, 1 Feb 2023 20:31:45 +0000 (12:31 -0800)]
tests/block/007: Rework I/O polling
Linux kernel commit a614dd228035 ("block: don't allow writing to the poll
queue attribute") makes writes into /sys/block/*/queue/io_poll a no-op.
Rework test block/007 such that it no longer uses that attribute.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Hannes Reinecke [Tue, 30 Aug 2022 12:36:55 +0000 (14:36 +0200)]
nvme: ignore error messages when running tests
There are subtle differences in the way fc is creating associations,
causing the error messages from 'nvme connect' to be different than
on other transports. As we'll get notified anyway when 'nvme connect'
fails there is not point is specifying the error message in the response
files, so just suppress error messages here.
Shin'ichiro Kawasaki [Thu, 26 Jan 2023 10:59:15 +0000 (19:59 +0900)]
Merge pull request #107 from bvanassche/shellcheck
Fix multiple shellcheck warnings
This avoids warnings shellcheck version 0.9.0 reports. The warnings SC2004, SC2319 and SC2320 are addressed. It also addresses the warning 2119 so that "make check" command runs shellcheck without an exception.
Shin'ichiro Kawasaki [Wed, 30 Nov 2022 02:40:12 +0000 (11:40 +0900)]
block/017: extend IO inflight duration
The test case block/017 often fails on slow test systems. When it runs
on QEMU and kernel with LOCKDEP, it fails around 50% by chance with
error message as follows:
The test case issues one read and one write to a null_blk device, and
checks that inflight counters reports correct numbers of inflight IOs.
To keep IOs inflight during test, it prepares null_blk device with
completion_nsec parameter 0.5 second. However, when test system is slow,
inflight counter check takes long time and the read completes before the
check. Hence the failure.
To avoid the failure, extend the inflight duration of IOs. Prepare a
null_blk device without completion_nsec parameter and measure time to
check the inflight counters. Prepare null_blk device again specifying
completion_nsec parameter 0.5 seconds plus the measured time of inflight
counter check.
Alan Adamson [Wed, 16 Nov 2022 22:39:45 +0000 (14:39 -0800)]
tests/nvme/039: Remove passthrough command tests
Commit d7ac8dca938c ("nvme: quiet user passthrough command errors")
disabled error logging for passthrough commands so the associated
tests should be removed.
When an error logging opt-in mechanism for passthrough commands is
provided, the tests can be added back.
Yi Zhang [Wed, 2 Nov 2022 02:57:02 +0000 (10:57 +0800)]
nvme/012,013,035: change fio I/O size and move size definition place
Change fio I/O size of nvme/012,013,035 from 950m to 900m, since recent change
increased the xfs log size and it caused fio failure with I/O size 950m.
Also add size parameter to _run_fio_verify_io. This allows to move the fio I/O
size definition from common/xfs to the test case, so that device size and fio
I/O size are both defined at single place.
The commit 8017ea524367 ("common/rc: ensure modules are loadable in
_have_modules()") introduced a helper function _module_file_exists()
which assumes module files have extension ".ko". However, the assumption
is not true when module files are compressed. In this case, extensions
of modules files have abbreviations of compression algorithm such as
".ko.xz",".ko.gz" or ".ko.zstd". This results in module file existence
check failure and unexpected test skips.
Fix this by changing module file search condition to cover module file
extensions with the compression algorithm abbreviations.
Fixes: 8017ea524367 ("common/rc: ensure modules are loadable in _have_modules()") Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Link: https://github.com/osandov/blktests/issues/101
Kernel commit 8fe4ce5836e9 ("scsi: core: Fix a use-after-free"; v6.0-rc5)
fixes a kernel crash triggered by RDMA hot-unplug. This test triggers
RDMA hot-unplug and also triggers a kernel crash without the
aforementioned kernel commit.
Cc: Li Zhijian <lizhijian@fujitsu.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Once I thought explicit nbd module load in nbd/rc is required due to the
commit 06a0ba866d90 ("common/rc: avoid module load in _have_driver()").
However, it was not a good solution and _have_driver() was modified
again to load module. Hence, revert explicit nbd module load in nbd/rc.
check,common/rc: load module in _have_driver() and unload after test
The commit 06a0ba866d90 ("common/rc: avoid module load in
_have_driver()") removed module load from _have_driver(). However, it
was pointed out no module load in _have_driver() is confusing and adds
complexity [1]. It requires explicit module loads and unloads in number
of test cases. The module unloads must be checked if unload is safe or
not. Also module load error must be handled. To avoid these complexity,
a new helper function would be required, but it will be look like the
_have_driver() with module load.
Then revert back the feature to load module in _have_driver(). To
address the issue that the commit 06a0ba866d90 tried to fix, record the
modules loaded by _have_driver() in MODULES_TO_UNLOAD array. Unload
the recorded modules after each test case processing completed. This
avoids the side-effect by the modules loaded by _have_driver().
Shin'ichiro Kawasaki [Tue, 23 Aug 2022 00:11:53 +0000 (09:11 +0900)]
common,tests: replace _have_modules() with _have_module()
The helper functions _have_modules() and _have_driver() have similar
roles, but they take different number of arguments. The former takes
multiple module names and the latter takes single module name. To make
their usage consistent, modify _have_modules() to _have_module() to take
single argument. This improves readability by checking one module per
line.
Shin'ichiro Kawasaki [Tue, 23 Aug 2022 00:11:50 +0000 (09:11 +0900)]
common/rc: ensure modules are loadable in _have_modules()
The commit e9645877fbf0 ("common: add a helper if a driver is
available") introduced the helper function _have_driver() to check the
driver or module is available no matter whether it is a loadable module
or built-in module. It was assumed that _have_modules() whould check
that specified modules are loadable and not built-in.
However, the function _have_modules() returns true even if the specified
modules are built-in and not loadable. This causes failures of some test
cases on test system with built-in modules such as nbd/004. It also
means that _have_modules() and _have_driver() have same functionality.
To avoid the unexpected failures, fix _have_modules() to return false
when the specified modules are built-in. Check if loadable module file
exists by searching the module file path. If the module file does not
exist, return false. Also add comments to describe the difference
between _have_driver() and _have_modules().
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Shin'ichiro Kawasaki [Tue, 23 Aug 2022 00:11:49 +0000 (09:11 +0900)]
nbd/rc: load nbd module explicitly
After the commit "common/rc: avoid module load in _have_driver()",
_have_driver() no longer loads specified module. However, nbd test cases
and _have_nbd_netlink() function assume that the module is loaded by
calling _have_driver(). This causes test case failures and unexpected
skips. To fix them, load and unload modules explicitly in functions
_start_nbd_server*(), _stop_nbd_server*() and _have_nbd_netlink().
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Shin'ichiro Kawasaki [Tue, 23 Aug 2022 00:11:48 +0000 (09:11 +0900)]
common/rc: avoid module load in _have_driver()
The helper function _have_driver() checks availability of the specified
driver, or module, regardless whether it is loadable or not. When the
driver is loadable, it loads the module for checking, but does not
unload it. This makes following test cases fail.
Such failure happens when nvmeof-mp test group is executed after nvme
test group with tcp transport. _have_driver() for tcp transport loads
nvmet and nvmet-tcp modules. nvmeof-mp test group tries to unload the
nvmet module but it fails because of dependency to the nvmet-tcp module.
To avoid the failure, do not load module in _have_driver() using -n
dry run option of the modprobe command. While at it, fix a minor problem
of modname '-' replacement. Currently, only the first '-' in modname is
replaced with '_'. Replace all '-'s.
Fixes: e9645877fbf0 ("common: add a helper if a driver is available") Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Shin'ichiro Kawasaki [Mon, 8 Aug 2022 01:44:07 +0000 (10:44 +0900)]
zbd/009: check mkfs.btrfs version
mkfs.btrfs versions from 5.17 to 5.18.x fail to format zoned block
devices without option '-m single' [1]. Skip the test case when
mkfs.btrfs has the versions.
Yi Zhang [Mon, 8 Aug 2022 10:36:23 +0000 (18:36 +0800)]
src/mount_clear_sock.c: fix compiling error
<linux/mount.h> and <sys/mount.h> are known pairs of headers that conflict
See https://sourceware.org/glibc/wiki/Synchronizing_Headers
$ make
make -C src all
make[1]: Entering directory '/root/blktests/src'
cc -O2 -Wall -Wshadow -DHAVE_LINUX_BLKZONED_H -o mount_clear_sock mount_clear_sock.c
In file included from /usr/include/linux/fs.h:19,
from mount_clear_sock.c:15:
/usr/include/linux/mount.h:95:6: error: redeclaration of ‘enum fsconfig_command’
95 | enum fsconfig_command {
| ^~~~~~~~~~~~~~~~
In file included from mount_clear_sock.c:11:
/usr/include/sys/mount.h:189:6: note: originally defined here
189 | enum fsconfig_command
| ^~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:96:9: error: redeclaration of enumerator ‘FSCONFIG_SET_FLAG’
96 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */
| ^~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:191:3: note: previous definition of ‘FSCONFIG_SET_FLAG’ with type ‘enum fsconfig_command’
191 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */
| ^~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:97:9: error: redeclaration of enumerator ‘FSCONFIG_SET_STRING’
97 | FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */
| ^~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:193:3: note: previous definition of ‘FSCONFIG_SET_STRING’ with type ‘enum fsconfig_command’
193 | FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */
| ^~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:98:9: error: redeclaration of enumerator ‘FSCONFIG_SET_BINARY’
98 | FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */
| ^~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:195:3: note: previous definition of ‘FSCONFIG_SET_BINARY’ with type ‘enum fsconfig_command’
195 | FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */
| ^~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:99:9: error: redeclaration of enumerator ‘FSCONFIG_SET_PATH’
99 | FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */
| ^~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:197:3: note: previous definition of ‘FSCONFIG_SET_PATH’ with type ‘enum fsconfig_command’
197 | FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */
| ^~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:100:9: error: redeclaration of enumerator ‘FSCONFIG_SET_PATH_EMPTY’
100 | FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:199:3: note: previous definition of ‘FSCONFIG_SET_PATH_EMPTY’ with type ‘enum fsconfig_command’
199 | FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:101:9: error: redeclaration of enumerator ‘FSCONFIG_SET_FD’
101 | FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */
| ^~~~~~~~~~~~~~~
/usr/include/sys/mount.h:201:3: note: previous definition of ‘FSCONFIG_SET_FD’ with type ‘enum fsconfig_command’
201 | FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */
| ^~~~~~~~~~~~~~~
/usr/include/linux/mount.h:102:9: error: redeclaration of enumerator ‘FSCONFIG_CMD_CREATE’
102 | FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */
| ^~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:203:3: note: previous definition of ‘FSCONFIG_CMD_CREATE’ with type ‘enum fsconfig_command’
203 | FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */
| ^~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:103:9: error: redeclaration of enumerator ‘FSCONFIG_CMD_RECONFIGURE’
103 | FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/mount.h:205:3: note: previous definition of ‘FSCONFIG_CMD_RECONFIGURE’ with type ‘enum fsconfig_command’
205 | FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/linux/mount.h:129:8: error: redefinition of ‘struct mount_attr’
129 | struct mount_attr {
| ^~~~~~~~~~
/usr/include/sys/mount.h:161:8: note: originally defined here
161 | struct mount_attr
| ^~~~~~~~~~
Signed-off-by: Yi Zhang <yi.zhang@redhat.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
The test case nvme/040 performs I/O to a nvmf device file. However, it
specifies wrong path to the device file then the I/O is done to a
regular file. Hence fix the path.
The helper function _offline_cpu() sets a value to RESTORE_CPUS_ONLINE.
However, the commit bd6b882b2650 ("block/008: check CPU offline failure
due to many IRQs") put _offline_cpu() call in sub-shell, then the set
value to RESTORE_CPUS_ONLINE no longer affects function caller's
environment. This resulted in offlined CPUs not restored by _cleanup()
when the test case block/008 calls only _offline_cpu() and does not call
_online_cpu().
To fix the issue, avoid _offline_cpu() call in sub-shell. Use file
redirect to get output of _offline_cpu() instead of sub-shell execution.
common/cpuhotplug: allow _offline_cpu() call in sub-shell
The helper function _offline_cpu() sets a value to RESTORE_CPUS_ONLINE.
However, the commit bd6b882b2650 ("block/008: check CPU offline failure
due to many IRQs") put _offline_cpu() call in sub-shell, then the set
value to RESTORE_CPUS_ONLINE no longer affects function caller's
environment. This resulted in off-lined CPUs not restored by _cleanup()
when the test case block/008 calls only _offline_cpu() and does not call
_online_cpu().
To fix the issue, set RESTORE_CPUS_ONLINE in _have_cpu_hotplug() in
place of _offline_cpu(). _have_cpu_hotplug() is less likely to be called
in sub-shell. In same manner, do not set RESTORE_CPUS_ONLINE in
_online_cpu() either. Check that RESTORE_CPUS_ONLINE is set in
_offline_cpu() to avoid unexpected CPUs left off-lined. This check also
avoids a shellcheck warning.
Fixes: bd6b882b2650 ("block/008: check CPU offline failure due to many IRQs") Reported-by: Yi Zhang <yi.zhang@redhat.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
The "new" script adds script files for a new test case to the specified
test group. However, this file addition fails when the user specifies
non-existing new test group name as the target test group. The failure
happens because the "new" script assumes the target test group directory
has at least one test case, but this is not true when a new group is
created. Fix this by checking the existence of the test cases in the
target test group.
Fixes: b1e29e775872 ("Create test name from most recently used test number") Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
The commit 5c2012764cbc (common, tests: Print multiple skip reasons)
changed the variable SKIP_REASON to the array SKIP_REASONS. The commit e9828f1646cd ("nvme/rc: Fixup SKIP_REASON usage") changed SKIP_REASON
usage from variable to array, but did not change the name. Just add 'S'
to fix it.
Hannes Reinecke [Mon, 22 Nov 2021 15:22:25 +0000 (16:22 +0100)]
nvme/rc: add more arguments to _nvme_connect_subsys()
Add optional arguments for setting 'hostnqn', 'hostid', 'hostkey',
and 'ctrlkey' to _nvme_connect_subsys() to make it usable for
testing nvme in-band authentication.
Alan Adamson [Tue, 5 Jul 2022 20:56:31 +0000 (13:56 -0700)]
tests/nvme: Set clear_ids for passthru targets
This allows to connect to passthru targets when the client and target
are on the same host.
Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
[Shin'ichiro: replaced single bracket with double brackets] Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Some test cases or test groups have rather large number of test
run requirements and then they may have multiple skip reasons. However,
blktests can report only single skip reason. To know all of the skip
reasons, we need to repeat skip reason resolution and blktests run.
This is a troublesome work.
In this patch, we add skip reasons to SKIP_REASONS array, then all of
the skip reasons will be printed by iterating SKIP_REASONS at one shot
run.
Most of the works are done by following script:
sed -i 's/SKIP_REASON/SKIP_REASONS/' $(git ls-files)
git grep -h 'SKIP_REASONS=' | awk -F'SKIP_REASONS=' '{print $2}' | sort | uniq |
while read -r r
do
s="SKIP_REASONS=$r"
f=$(git grep -l "$s")
sed -i "s@$s@SKIP_REASONS+=($r)@" $f
done
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Shin'ichiro Kawasaki [Fri, 3 Jun 2022 08:31:15 +0000 (17:31 +0900)]
block/007: support fallback device
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.
Yi Zhang [Thu, 30 Jun 2022 09:56:25 +0000 (17:56 +0800)]
common/multipath-over-rdma: skip NO-CARRIER NIC when start_soft_rdma
The rxe/siw driver will be bind to NO-CARRIER interface which lead
nvmeof-mp/001 failed.
For example, nvmeof-mp/001 with two NICs, if will output
count_devices(): 1 <> 2 when the second NIC has NO-CARRIER
Signed-off-by: Yi Zhang <yi.zhang@redhat.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Xiao Yang [Mon, 27 Jun 2022 07:32:49 +0000 (15:32 +0800)]
blktests: Add _have_kernel_config_file() and _check_kernel_option()
The helper function _have_kernel_option() sets SKIP_REASON when the
specified kernel config option is not set. Sometimes this SKIP_REASON
update is not desired and it is unset after _have_kernel_option() calls.
This unset is not straight-forward and confusing.
To avoid the unset operation, introduce two new helper functions:
1) _have_kernel_config_file() which sets SKIP_REASON when neither
/boot/config* nor /proc/config.gz is available.
2) _check_kernel_option() which doesn't set SKIP_RESAON when
the specified kernel option is not defined.
Also re-implement _have_kernel_option() with the new helper functions.
When SKIP_REASON update is not desired, call _check_kernel_option() in
place of _have_kernel_option().
Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
[Shin'ichiro: added change purpose in the commit message] Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Xiao Yang [Fri, 24 Jun 2022 07:50:23 +0000 (15:50 +0800)]
nvmeof-mp/rc: Avoid skipping tests due to the expected SKIP_REASON
In _have_kernel_option(), SKIP_REASON = "kernel option NVME_MULTIPATH
has not been enabled" is expected but all nvmeof-mp tests are skipped
due to the SKIP_REASON. For example:
-----------------------------------------------------
./check nvmeof-mp/001
nvmeof-mp/*** [not run]
kernel option NVME_MULTIPATH has not been enabled
-----------------------------------------------------
Li Zhijian [Wed, 15 Jun 2022 07:07:39 +0000 (15:07 +0800)]
common/rc: don't unset previous SKIP_REASON in _have_kernel_option()
unset previous SKIP_REASON could cause a false failure.
nvme/033 => nvme0n1 (create and connect to an NVMeOF target with a passthru controller) [failed]
runtime 2.383s ... 0.376s
--- tests/nvme/033.out 2022-06-08 08:46:27.956692453 +0000
+++ /home/lizhijian/blktests/results/nvme0n1/nvme/033.out.bad 2022-06-15 06:32:31.131001276 +0000
@@ -1,3 +1,8 @@
Running nvme/033
-NQN:blktests-subsystem-1 disconnected 1 controller(s)
+tests/nvme/rc: line 181: nvme: command not found
+tests/nvme/033: line 19: nvme: command not found
+tests/nvme/033: line 20: nvme: command not found
+tests/nvme/033: line 19: nvme: command not found
+tests/nvme/033: line 20: nvme: command not found
...
(Run 'diff -u tests/nvme/033.out /home/lizhijian/blktests/results/nvme0n1/nvme/033.out.bad' to see the entire diff)
Shin'ichiro Kawasaki [Thu, 16 Jun 2022 04:12:14 +0000 (13:12 +0900)]
check: ensure to suppress job status output
Unexpected job status output by wait commands was observed on openSUSE
15.3 and it made some test cases fail. To avoid the job status output
during test case runs, ensure to turn off job control monitor in sub-
shell for test case runs.
Michael Schaller [Wed, 15 Jun 2022 05:57:18 +0000 (07:57 +0200)]
loop: Add test to setup GPT and ESP on raw disk image
Add test for setting up a raw disk image with a GPT and ESP.
This is a regression test for commit b9684a71fca7
("block, loop: support partitions without scanning").
Signed-off-by: Michael Schaller <misch@google.com>
Bart Van Assche [Sun, 27 Mar 2022 15:18:41 +0000 (08:18 -0700)]
Introduce the _io_schedulers() function
The functionality for retrieving the I/O schedulers supported by a request
queue occurs multiple times. Hence introduce a function for retrieving the
supported I/O schedulers.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Shin'ichiro Kawasaki [Fri, 10 Jun 2022 12:15:18 +0000 (21:15 +0900)]
nvme/039: avoid module loads for various transport types
The test case nvme/039 does not depend on nvme transport type and does
not require modules for the transport types. The _nvme_requires call in
requires() loads the modules and those modules are left unloaded after
the test case run. This causes failures of following nvmeof-mp test runs
with message:
modprobe: FATAL: Module nvmet is in use.
To avoid the unnecessary module loads, remove _nvme_requires call.
Instead, just check existence of nvme command.
Fixes: 9accb5f86670 ("tests/nvme: add tests for error logging") Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Alan Adamson <alan.adamson@oracle.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>