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>
Christoph Hellwig [Tue, 7 Jun 2022 12:47:28 +0000 (14:47 +0200)]
common/null_blk: allow _configure_null_blk with built-in null_blk
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.
Also try to load the null_blk module in _configure_null_blk as
_init_null_blk is optional now and we thus can't rely on the module
to be loaded.
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Xiao Yang [Sat, 4 Jun 2022 16:06:38 +0000 (00:06 +0800)]
nvme/033: Remove volatile output
The output of _nvme_discover() will be changed according to
${nvme_trtype} and the number of NICs. For example: nvme/033
with nvme_trtype=tcp and two NICs got the following error:
------------------------------------------------
Running nvme/033
-Discovery Log Number of Records 1, Generation counter X
+Discovery Log Number of Records 2, Generation counter X
=====Discovery Log Entry 0======
-trtype: loop
+trtype: tcp
+subnqn: nqn.2014-08.org.nvmexpress.discovery
+=====Discovery Log Entry 1======
+trtype: tcp
subnqn: blktests-subsystem-1
NQN:blktests-subsystem-1 disconnected 1 controller(s)
Test complete
------------------------------------------------
Christoph Hellwig [Wed, 1 Jun 2022 06:48:37 +0000 (08:48 +0200)]
nvme: don't require the nvme drivers to be built in
Use _have_driver instead of _have_modules to check for the availability
of the nvme drivers, and don't bother checking at all for drivers that
are pulled in as dependencies.
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Xiao Yang [Sat, 21 May 2022 12:30:20 +0000 (20:30 +0800)]
nvmeof-mp/001: Set expected count properly
The number of block devices will increase according
to the number of RDMA-capable NICs.
For example, nvmeof-mp/001 with two RDMA-capable NICs
got the following error:
-------------------------------------
Configured NVMe target driver
-count_devices(): 1 <> 1
+count_devices(): 2 <> 1
Passed
-------------------------------------
Set expected count properly by calculating the number
of RDMA-capable NICs.
Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com> Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Xiao Yang [Wed, 18 May 2022 06:44:17 +0000 (14:44 +0800)]
srp/011: Avoid $dev becoming invalid during test
$dev will become invalid when log_out has been done
and fio doesn't run yet. In this case subsequent fio
throws the following error:
-------------------------------------
From diff -u 011.out 011.out.bad
Configured SRP target driver
-Passed
From 011.full:
fio: looks like your file system does not support direct=1/buffered=0
fio: destination does not support O_DIRECT
run_fio exit code: 1
-------------------------------------
This issue happens randomly.
Try to fix the issue by holding $dev before test.
Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com> Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Shin'ichiro Kawasaki [Wed, 25 May 2022 02:04:24 +0000 (11:04 +0900)]
CONTIRIBUTING, README: transfer maintainer role
To offload blktests maintenance overhead from Omar, I volunteer to take
the blktests maintainer role. Replace Omar's name and e-mail address in
CONTRIBUTING.md with mine. Also note his original authorship in
README.md.
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Alan Adamson [Mon, 16 May 2022 22:55:39 +0000 (15:55 -0700)]
tests/nvme: add tests for error logging
Test nvme error logging by injecting errors. Kernel must have FAULT_INJECTION
and FAULT_INJECTION_DEBUG_FS configured to use error injector. Tests can be
run with or without NVME_VERBOSE_ERRORS configured.
Test for commit bd83fe6f2cd2 ("nvme: add verbose error logging").
Li Zhijian [Tue, 17 May 2022 06:22:35 +0000 (14:22 +0800)]
tests/nvme/rc: Fix possible endless loop
A failed connection will cause the later endless loop, so we should return
directly in such case.
344 _nvmet_passthru_target_connect() {
345 local trtype=$1
346 local subsys_name=$2
347
348 _nvme_connect_subsys "${trtype}" "${subsys_name}" || return
349 nsdev=$(_find_nvme_passthru_loop_dev "${subsys_name}")
350
351 # The following tests can race with the creation
352 # of the device so ensure the block device exists
353 # before continuing
354 while [ ! -b "${nsdev}" ]; do sleep 1; done <<< endless loop
355
356 echo "${nsdev}"
357 }
Shin'ichiro Kawasaki [Wed, 30 Mar 2022 01:32:15 +0000 (10:32 +0900)]
scsi/003: remove unnecessary out file
The test case scsi/003 was removed with the commit 5e803ca0ae99 ("Remove
partition rereading tests for reverted fixes"), but its out file was
left. Remove it.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Shin'ichiro Kawasaki [Wed, 30 Mar 2022 01:32:14 +0000 (10:32 +0900)]
scsi/006: skip cache types which disable read cache for SATA drives
The test case scsi/006 sets four cache types to test target SCSI
devices. Two cache types out of the four, "none" and "write back, no
read (daft)" disable read cache. However, these two types do not work
for SATA drives since SAT specification requires Disable Read Cache is
always set to zero in the caching mode page. It results in invalid
argument error and the test case failure.
To avoid the failure, skip the cache types which disable read cache if
the test devices are SATA drives. To check the device, add a helper
function _test_dev_is_sata in scsi/rc.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Shin'ichiro Kawasaki [Wed, 30 Mar 2022 01:32:12 +0000 (10:32 +0900)]
block/027, scsi/004: whitelist scsi_debug test cases for zoned mode
Define CAN_BE_ZONED=1 in block/027 and scsi/004. These test cases can be
executed in zoned mode without problem against scsi_debug devices in
zoned mode.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Shin'ichiro Kawasaki [Wed, 30 Mar 2022 01:32:11 +0000 (10:32 +0900)]
common/scsi_debug: prepare scsi_debug in zoned mode
To allow running tests using scsi_debug device with the zoned mode
disabled (current setup) as well as enabled, modify the _init_scsi_debug
helper function. When RUN_FOR_ZONED is set, specify zbc=host-managed
parameter to scsi_debug module so that the scsi_debug devices are
prepared in zoned mode.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Shin'ichiro Kawasaki [Wed, 30 Mar 2022 01:32:10 +0000 (10:32 +0900)]
zbd/008: check no stale page cache after BLKRESETZONE ioctl
Run two processes which repeat data read and BLKRESETZONE ioctl, and
check that the race does not leave stale page cache. This allows to
catch the bug fixed with the commit e5113505904e ("block: Discard page
cache of # zone reset target range").
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Alan Adamson [Thu, 31 Mar 2022 21:45:26 +0000 (14:45 -0700)]
nvme tests should use nvme_trtype when setting up passthru target
No matter what was passed in with nvme_trtype, the target was being
set up with trtype as "loop". This caused several passthru tests
to fail when testing tcp or rdma.
Shin'ichiro Kawasaki [Fri, 28 Jan 2022 09:45:12 +0000 (18:45 +0900)]
block/008: check CPU offline failure due to many IRQs
When systems have more IRQs than a single CPU can handle, the test case
block/008 fails with kernel message such as,
"CPU 31 has 111 vectors, 90 available. Cannot disable CPU"
The failure cause is that the test case offlined too many CPUs and the
left online CPU can not hold all of the required IRQ vectors. To avoid
this failure, check error message of CPU offline. If CPU offline failure
cause is IRQ vector resource shortage, do not handle it as a failure.
Also keep the actual number of CPUs which can be offlined without the
failure and use this number for the test.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Bart Van Assche [Mon, 23 Aug 2021 18:10:31 +0000 (11:10 -0700)]
tests/srp/012: Fix the displayed test status
The _have_* scripts set the SKIP_REASON variable. That variable controls
whether the status [passed] or [not run] is displayed. This patch causes
the status [passed] to be displayed instead of [not run] if legacy dm
support is not available.
Fixes: 0a2cbbd1874d ("srp and nvmeof-mp: Check whether legacy dm is supported") Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bart Van Assche [Tue, 16 Nov 2021 18:22:49 +0000 (10:22 -0800)]
Fix multiple shellcheck warnings
The latest version of shellcheck reports the following warnings:
check:307:9: warning: Quote arguments to unset so they're not glob expanded. [SC2184]
check:505:10: warning: Quote arguments to unset so they're not glob expanded. [SC2184]
check:506:10: warning: Quote arguments to unset so they're not glob expanded. [SC2184]
check:539:11: warning: Quote arguments to unset so they're not glob expanded. [SC2184]
new:102:19: note: Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. [SC2295]
common/rc:272:37: warning: -ne treats this as an arithmetic expression. Use != to compare as string (or expand explicitly with $((expr))). [SC2309]
tests/block/008:65:10: warning: Quote arguments to unset so they're not glob expanded. [SC2184]
tests/block/008:71:10: warning: Quote arguments to unset so they're not glob expanded. [SC2184]
This patch fixes the above warnings.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Ming Lei [Mon, 30 Aug 2021 02:38:44 +0000 (10:38 +0800)]
block/001: don't exit test with pending async scan
We have to run scan and delete together, otherwise pending async
may prevent scsi_debug from being unloaded, and cause failure of
'modprobe: FATAL: Module scsi_debug is in use.'
Fix the issue by always running both scan and delete together.
Fixes: f3bcd8c ("block/001: wait until device is added") Reported-by: Yi Zhang <yi.zhang@redhat.com> Signed-off-by: Ming Lei <ming.lei@redhat.com>
Jon Derrick [Tue, 24 Aug 2021 18:46:42 +0000 (12:46 -0600)]
Create test name from most recently used test number
The 'new' script can inadvertently use a test name that was removed, ex
nvme/001, which may create confusion if identically-named tests exist
among different versions. Instead, generate a test name at the numerical
tail end of the test group.
Signed-off-by: Jon Derrick <jonathan.derrick@linux.dev>