]> www.infradead.org Git - users/sagi/blktests.git/log
users/sagi/blktests.git
7 years agoMakefile: reenable some shellcheck warnings
Omar Sandoval [Mon, 25 Jun 2018 19:21:23 +0000 (12:21 -0700)]
Makefile: reenable some shellcheck warnings

Bart's patches fixed several shellcheck warnings which we previously
disabled. Reenable them.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agocheck: Suppress a shellcheck warning about the DMESG_FILTER initialization
Bart Van Assche [Tue, 19 Jun 2018 20:23:52 +0000 (13:23 -0700)]
check: Suppress a shellcheck warning about the DMESG_FILTER initialization

Avoid that shellcheck reports the following:

check:396:2: warning: Use var=$(command) to assign output (or quote to assign string). [SC2209]

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
7 years agoMultiple tests: remove unused and undefined variables
Bart Van Assche [Tue, 19 Jun 2018 20:23:50 +0000 (13:23 -0700)]
Multiple tests: remove unused and undefined variables

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agocheck, tests/meta/012: Use array["index"] instead of array[index]
Bart Van Assche [Tue, 19 Jun 2018 20:23:47 +0000 (13:23 -0700)]
check, tests/meta/012: Use array["index"] instead of array[index]

This causes shellcheck to stop complaining about these array element
accesses.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
7 years agoAnnotate include statements in shell scripts where the source file is a variable
Bart Van Assche [Tue, 19 Jun 2018 20:23:46 +0000 (13:23 -0700)]
Annotate include statements in shell scripts where the source file is a variable

This causes shellcheck to stop complaining about these include statements.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
7 years agocommon/rc: Fix _have_tracepoint()
Bart Van Assche [Tue, 19 Jun 2018 20:23:45 +0000 (13:23 -0700)]
common/rc: Fix _have_tracepoint()

Make sure that _have_tracepoint() uses the argument passed to that
function instead of using an undefined variable.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
7 years agocheck: add command line switch to test device drivers only
Johannes Thumshirn [Tue, 12 Jun 2018 09:57:06 +0000 (11:57 +0200)]
check: add command line switch to test device drivers only

Sometimes it's useful to only run tests which exercise a device special
driver to verify a patch for the driver doesn't introduce a regression.

Running the whole test-suite is just a waste of time in this case, so
provide a way to only run tests which have a test_device() function set
and not a test() function.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
[Omar: fix argument parsing, move check to found_test(), add documentation]
Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agocheck: fix QUICK_RUN && ! TIMEOUT check
Omar Sandoval [Mon, 25 Jun 2018 18:09:18 +0000 (11:09 -0700)]
check: fix QUICK_RUN && ! TIMEOUT check

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblktests: add NVMeOF mkfs test for file-ns
Chaitanya Kulkarni [Mon, 11 Jun 2018 09:15:50 +0000 (05:15 -0400)]
blktests: add NVMeOF mkfs test for file-ns

This adds a new test which formats the ns with file system on the host side
and runs fio data verification workload.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agoblktests: add NVMeOF mkfs test for bdev-ns
Chaitanya Kulkarni [Mon, 11 Jun 2018 09:15:49 +0000 (05:15 -0400)]
blktests: add NVMeOF mkfs test for bdev-ns

This adds a new test which formats the ns with file system on the host side
and runs fio data verification workload.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agoblktests: add NVMeOF data verification test for file-ns
Chaitanya Kulkarni [Mon, 11 Jun 2018 09:15:48 +0000 (05:15 -0400)]
blktests: add NVMeOF data verification test for file-ns

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agoblktests: add NVMeoF data verification test for bdev-ns
Chaitanya Kulkarni [Mon, 11 Jun 2018 09:15:47 +0000 (05:15 -0400)]
blktests: add NVMeoF data verification test for bdev-ns

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agoblktests: add fio data verification routine
Chaitanya Kulkarni [Mon, 11 Jun 2018 09:15:46 +0000 (05:15 -0400)]
blktests: add fio data verification routine

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agoblktests: add NVMeOF file-ns host creation
Chaitanya Kulkarni [Mon, 11 Jun 2018 09:15:45 +0000 (05:15 -0400)]
blktests: add NVMeOF file-ns host creation

This adds a new unit test to create NVMeOF target and host.
In the test we create one file backed namespace on target.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agoblktests: add NVMeOF bdev-ns host creation
Chaitanya Kulkarni [Mon, 11 Jun 2018 09:15:44 +0000 (05:15 -0400)]
blktests: add NVMeOF bdev-ns host creation

This adds a new unit test to create NVMeOF target and host.
In the test we create one block device backed namespace on target.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agoblktests: add NVMeOF file-ns target creation test
Chaitanya Kulkarni [Mon, 11 Jun 2018 09:15:43 +0000 (05:15 -0400)]
blktests: add NVMeOF file-ns target creation test

This adds a new unit test to create NVMeOF target with file
backed namespace.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agoblktests: add NVMeOF bdev-ns target creation test
Chaitanya Kulkarni [Mon, 11 Jun 2018 09:15:42 +0000 (05:15 -0400)]
blktests: add NVMeOF bdev-ns target creation test

This adds a new unit test to create NVMeOF target with block-device
backed namespace.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agoblktests: common/nvme export ns-mgmt interfaces
Chaitanya Kulkarni [Mon, 11 Jun 2018 09:15:41 +0000 (05:15 -0400)]
blktests: common/nvme export ns-mgmt interfaces

This patch modifies and exports the interfaces to create and delete ns
which can be consumed by future testcases like creation/deletion of ns.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agocheck: move TMPDIR to repo directory
Omar Sandoval [Mon, 11 Jun 2018 21:54:42 +0000 (14:54 -0700)]
check: move TMPDIR to repo directory

The new NVMeOF tests require direct I/O in TMPDIR, which obviously
doesn't work on tmpfs.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agonbd/002: fix shellcheck warning
Omar Sandoval [Mon, 11 Jun 2018 20:35:49 +0000 (13:35 -0700)]
nbd/002: fix shellcheck warning

tests/nbd/002:37:2: note: Consider using { cmd1; cmd2; } >> file instead of individual redirects. [SC2129]

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock/008: fix shellcheck warnings
Omar Sandoval [Mon, 11 Jun 2018 20:34:40 +0000 (13:34 -0700)]
block/008: fix shellcheck warnings

tests/block/008:68:10: warning: Quote arguments to unset so they're not glob expanded. [SC2184]
tests/block/008:74:10: warning: Quote arguments to unset so they're not glob expanded. [SC2184]

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock/021: test setting 'nr_requests'
Ming Lei [Sat, 2 Jun 2018 05:02:04 +0000 (13:02 +0800)]
block/021: test setting 'nr_requests'

'nr_requests' can be a bit different for 'none' scheduler,
and especially current blk-mq can only decrease this value
for 'none.'

The patch of 'blk-mq: fix read/write 'nr_requests' in case of 'none' scheduler'
has been sent out for fixing this issue.

Cc: Marco Patalano <mpatalan@redhat.com>
Cc: "Ewan D. Milne" <emilne@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
[Omar: fix description comment, clean up]
Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agonbd/002: add a partition table test
Josef Bacik [Wed, 16 May 2018 16:04:50 +0000 (12:04 -0400)]
nbd/002: add a partition table test

Partition tables are hard, add a test to make sure we create/delete them
properly.

Signed-off-by: Josef Bacik <jbacik@fb.com>
[Omar: clean up helpers, use udevadm settle instead of stat, etc.]
Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agonbd: kill the nbd.pid file on cleanup
Josef Bacik [Wed, 16 May 2018 16:03:57 +0000 (12:03 -0400)]
nbd: kill the nbd.pid file on cleanup

Just in case, we don't want this to be left laying around.

Signed-off-by: Josef Bacik <jbacik@fb.com>
7 years agonbd/001: use -L for nbd-client
Omar Sandoval [Mon, 11 Jun 2018 20:15:11 +0000 (13:15 -0700)]
nbd/001: use -L for nbd-client

Newer versions of nbd-client always use netlink, which makes the
nbdsetsize test program fail. Use the -L (-nonetlink) option to force
the ioctl interface. This means that this test can't be run with older
versions of nbd-client anymore, but, eh.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agonbd: clean up common and nbd/001
Omar Sandoval [Mon, 11 Jun 2018 18:51:37 +0000 (11:51 -0700)]
nbd: clean up common and nbd/001

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock/008: don't try to offline all CPUs if all CPUs are hotpluggable
Omar Sandoval [Mon, 11 Jun 2018 18:31:57 +0000 (11:31 -0700)]
block/008: don't try to offline all CPUs if all CPUs are hotpluggable

Chen Rong reported that if CPU0 is hotpluggable (because we booted with
cpu0_hotplug or CONFIG_BOOTPARAM_HOTPLUG_CPU0 was enabled), block/008
can try to offline all CPUs at once, which isn't allowed. Fix it by
repeatedly offlining as many CPUs as is allowed and onlining all CPUs,
instead of the previous approach of randomly onlining/offlining. This is
better than the previous approach because we won't try to online already
online CPUs and offline already offline CPUs. Closes #23.

Reported-by: Chen Rong <chenr.fnst@cn.fujitsu.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agonvme/00[234]: clean up modules after running
Chaitanya Kulkarni [Sun, 3 Jun 2018 19:01:26 +0000 (15:01 -0400)]
nvme/00[234]: clean up modules after running

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agoblock/011: don't use sysfs for device disabling
Keith Busch [Mon, 4 Jun 2018 22:51:41 +0000 (16:51 -0600)]
block/011: don't use sysfs for device disabling

The PCI sysfs interface may not be a dependable method for toggling the
PCI device state to trigger the timeouts. This patch goes directly to
the config space to make device failure occur.

Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <keith.busch@intel.com>
7 years agonvme/001: fix filter and golden output
Johannes Thumshirn [Wed, 30 May 2018 08:22:26 +0000 (10:22 +0200)]
nvme/001: fix filter and golden output

Adjust filter and golden output to consider the following:
* Normalize white space between PID and CPU#
* Nomalize flags
* Normalize slba

Fixes #21.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
[Omar: normalize spaces after PID and timestamp differently]
Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock/020: don't pass shared_tags to null_blk
Ming Lei [Wed, 30 May 2018 05:10:38 +0000 (13:10 +0800)]
block/020: don't pass shared_tags to null_blk

The issue isn't related to shared tags, and it can be triggered if
'shared_tags' is set to 0.

Remove this so that this test can run on older kernels, and to avoid
misunderstandings.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
7 years agoblock/020: test IO req allocation
Ming Lei [Tue, 22 May 2018 11:12:49 +0000 (19:12 +0800)]
block/020: test IO req allocation

IO request allocation may hang for ever if the allocation process
migrages. This test covers the request allocation code path.

The following patch can fix this issue on linus kernel:

https://marc.info/?l=linux-block&m=152671586923185&w=2

Signed-off-by: Ming Lei <ming.lei@redhat.com>
[Omar: clarify comment and description]
Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoscsi_debug: settle udev before removing scsi_debug
Omar Sandoval [Thu, 24 May 2018 00:18:57 +0000 (17:18 -0700)]
scsi_debug: settle udev before removing scsi_debug

I'm still seeing "modprobe: FATAL: Module scsi_debug is in use." errors.
At least on v4.17-rc6, this gets rid of them. Fixes GitHub issue #17.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoDocumentation: document custom config setup
Omar Sandoval [Wed, 23 May 2018 00:11:11 +0000 (17:11 -0700)]
Documentation: document custom config setup

To quote Johannes Thumshirn's patch which inspired this one: "The config
file is bash and it gets sourced, so all bash magic is doable in there
as well. Document it so others don't have to re-discover this gem as
well."

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblktests: use consistent helper returns
Chaitanya Kulkarni [Tue, 22 May 2018 07:36:11 +0000 (03:36 -0400)]
blktests: use consistent helper returns

This is a cleanup patch which uses consistent return values for helper
functions.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agoMerge pull request #20 from dublio/master
Omar Sandoval [Mon, 21 May 2018 17:20:30 +0000 (10:20 -0700)]
Merge pull request #20 from dublio/master

remove null_blk module after test finished

7 years agoblock/010: remove null_blk module after test finished
weiping zhang [Mon, 21 May 2018 14:56:38 +0000 (22:56 +0800)]
block/010: remove null_blk module after test finished

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
7 years agoblktests: use global configfs variable
Chaitanya Kulkarni [Tue, 8 May 2018 05:45:32 +0000 (01:45 -0400)]
blktests: use global configfs variable

This patch introduces a global variable to hold the
configfs nvmet path. Now we don't need repetitive
local variables to hold the path and testcases
can use the newly introduced variable if needed.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
7 years agonvme: add test for resetting the loopback controller
Johannes Thumshirn [Thu, 3 May 2018 15:00:54 +0000 (17:00 +0200)]
nvme: add test for resetting the loopback controller

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
7 years agonvme: fix counting the target port
Johannes Thumshirn [Thu, 3 May 2018 15:00:53 +0000 (17:00 +0200)]
nvme: fix counting the target port

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
7 years agonvme: move _find_nvme_loop_dev to common code
Johannes Thumshirn [Thu, 3 May 2018 15:00:52 +0000 (17:00 +0200)]
nvme: move _find_nvme_loop_dev to common code

_find_nvme_loop_dev is quite useful for all nvme test, so move it over
to common code.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
[Omar: make variables local while we're here]
Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agonvme/004: fix _find_nvme_loop_dev and cat
Omar Sandoval [Mon, 14 May 2018 19:52:38 +0000 (12:52 -0700)]
nvme/004: fix _find_nvme_loop_dev and cat

We were looking at the wrong paths. Based on a patch from Johannes
Thumshirn.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock/017: update comment now that patch is upstream
Omar Sandoval [Mon, 7 May 2018 22:01:43 +0000 (15:01 -0700)]
block/017: update comment now that patch is upstream

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agocommon/rc: fix _have_tracefs
Omar Sandoval [Fri, 27 Apr 2018 00:22:59 +0000 (17:22 -0700)]
common/rc: fix _have_tracefs

Apparently tracefs is lazily mounted, so try to stat
/sys/kernel/debug/tracing/trace before we check if it's mounted in order
to avoid false negatives.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoClarify difference between QUICK and TIMED
Omar Sandoval [Fri, 27 Apr 2018 00:12:55 +0000 (17:12 -0700)]
Clarify difference between QUICK and TIMED

Add more documentation for TIMED, make sure QUICK and TIMED can't be
combined, and fix a bug where QUICK and TIMED would leak between tests.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock/019: use explicit --runtime instead of overriding TIMEOUT
Omar Sandoval [Thu, 26 Apr 2018 23:47:47 +0000 (16:47 -0700)]
block/019: use explicit --runtime instead of overriding TIMEOUT

This is really a QUICK test, not a TIMED test. Use --runtime and
document that _run_fio can handle that.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoAdd surprise removal block test
Keith Busch [Thu, 26 Apr 2018 22:52:24 +0000 (16:52 -0600)]
Add surprise removal block test

This test is for PCI devices in a surprise remove capable slot and tests
how well the drivers and kernel handle losing the link to that device.

The test finds the PCI Express Capability register of the pci slot a block
device is in, then at offset 0x10 (the Link Control Register) writes a 1
to bit 4 (Link Disable). This occurs unbeknownst to any of the drivers,
just like a surprise removal. Drivers will find out about this through
the pcie hotplug handler, at which point it's too late to communicate
with the device, therfore testing how well we cope with the condition.

The link is reenabled at the end of the test.

Note, this is currently incompatible with NVMe Subsystems when
CONFIG_NVME_MULTIPATH since the /dev/nvme*n* names don't have a pci
parent in sysfs.

Signed-off-by: Keith Busch <keith.busch@intel.com>
7 years agoblock: add a test for iostats time spent doing I/O
Omar Sandoval [Thu, 26 Apr 2018 22:36:57 +0000 (15:36 -0700)]
block: add a test for iostats time spent doing I/O

This is to test my request timestamp rework patch series.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock/017: also check /sys/block/$dev/stat
Omar Sandoval [Thu, 26 Apr 2018 22:06:08 +0000 (15:06 -0700)]
block/017: also check /sys/block/$dev/stat

This should have the same value as /proc/diskstats.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock: add regression test for inflight counter
Omar Sandoval [Thu, 26 Apr 2018 07:18:22 +0000 (00:18 -0700)]
block: add regression test for inflight counter

This is a basic sanity check for the inflight counter, which already
turned up a bug.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoDocument that contributors should run `make check`
Omar Sandoval [Wed, 25 Apr 2018 23:09:55 +0000 (16:09 -0700)]
Document that contributors should run `make check`

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoMakefile: check for leftover TODO comments in new tests
Omar Sandoval [Wed, 25 Apr 2018 22:59:16 +0000 (15:59 -0700)]
Makefile: check for leftover TODO comments in new tests

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoMakefile: rename shellcheck target to check
Omar Sandoval [Wed, 25 Apr 2018 22:57:10 +0000 (15:57 -0700)]
Makefile: rename shellcheck target to check

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoIgnore some shellcheck warnings
Omar Sandoval [Wed, 25 Apr 2018 22:35:45 +0000 (15:35 -0700)]
Ignore some shellcheck warnings

This is the simplest way to get schedulers, and it'll always work, so
ignore the recommendation to do something fancier.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agonvme: fix _create_nvmet_port
Omar Sandoval [Wed, 25 Apr 2018 22:15:43 +0000 (15:15 -0700)]
nvme: fix _create_nvmet_port

First of all, we get a shellcheck warning:

common/nvme:32:18: note: Use find instead of ls to better handle
non-alphanumeric filenames. [SC2012]

Secondly, it's not _technically_ correct to just count the number of
ports, since there could be just one port numbered 1. Instead, find the
first free port.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agocheck: fix shellcheck warning on missing config
Omar Sandoval [Wed, 25 Apr 2018 22:08:43 +0000 (15:08 -0700)]
check: fix shellcheck warning on missing config

The config is optional, and shellcheck isn't smart enough to notice that
it's guarded by a readable test.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoUpdate comments referring to upstreamed patches
Omar Sandoval [Wed, 25 Apr 2018 16:10:23 +0000 (09:10 -0700)]
Update comments referring to upstreamed patches

We can refer to the commit ids now that they're in mainline.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agonvme: add a regression test for UUID ns descriptops
Johannes Thumshirn [Tue, 24 Apr 2018 16:12:51 +0000 (10:12 -0600)]
nvme: add a regression test for UUID ns descriptops

Add a regression test for NVMe 1.3's UUID Namespace Descriptors.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
7 years agonvme: add uuid parameter to _create_nvmet_subsystem
Johannes Thumshirn [Tue, 24 Apr 2018 16:12:50 +0000 (10:12 -0600)]
nvme: add uuid parameter to _create_nvmet_subsystem

Add an optional UUID parameter to _create_nvmet_subsystem().

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
7 years agonvme: fix counting available ports
Johannes Thumshirn [Tue, 24 Apr 2018 16:12:49 +0000 (10:12 -0600)]
nvme: fix counting available ports

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
7 years agoscsi/004: set delay in nanoseconds instead of jiffies
Omar Sandoval [Tue, 24 Apr 2018 23:09:13 +0000 (16:09 -0700)]
scsi/004: set delay in nanoseconds instead of jiffies

Steffen pointed out that "the timeout should be sufficiently larger than
scsi_debug/delay, in order not to run into the command timeout". The
delay parameter is in jiffies, so on s390 with the default HZ=100, 1000
jiffies are 10 seconds, more than the blk-mq timeout. Just use ndelay
instead.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock: add regression test for interruptible wait
Omar Sandoval [Tue, 24 Apr 2018 22:38:33 +0000 (15:38 -0700)]
block: add regression test for interruptible wait

Add a regression test for 1dc3039bc87a ("block: do not use interruptible
wait anywhere") using null-blk.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoscsi/004: set a shorter device timeout
Omar Sandoval [Thu, 19 Apr 2018 20:16:30 +0000 (13:16 -0700)]
scsi/004: set a shorter device timeout

With the default timeout, the test takes a long time to run for no good
reason.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoscsi/004: add regression test for false BLK_STS_OK with non good SAM status
Steffen Maier [Tue, 17 Apr 2018 09:03:37 +0000 (11:03 +0200)]
scsi/004: add regression test for false BLK_STS_OK with non good SAM status

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
7 years agoMerge pull request #16 from josefbacik/master
Omar Sandoval [Fri, 13 Apr 2018 20:48:44 +0000 (13:48 -0700)]
Merge pull request #16 from josefbacik/master

Add our first NBD test.

7 years agoblktests: add nbd test for online resize
Josef Bacik [Fri, 13 Apr 2018 16:07:48 +0000 (12:07 -0400)]
blktests: add nbd test for online resize

This tests resizing a connected nbd device.  We connect to the existing
10gig device, and resize it online to 1gig, and make sure lsblk and
parted (which use different size determination methods) both report the
correctly updated size.

Signed-off-by: Josef Bacik <jbacik@fb.com>
[Omar: squash commits, add note on required patches]
Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblktests: add nbd infrastructure
Josef Bacik [Fri, 13 Apr 2018 16:05:12 +0000 (12:05 -0400)]
blktests: add nbd infrastructure

NBD needs to setup a server and such, so add all the supporting helpers
so we can start building tests for nbd.

Signed-off-by: Josef Bacik <jbacik@fb.com>
[Omar: fix variable quoting]
Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoDocumentation: clarify that TEST_DEVS is optional
Omar Sandoval [Tue, 10 Apr 2018 18:13:38 +0000 (11:13 -0700)]
Documentation: clarify that TEST_DEVS is optional

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agotest/nvme/003: add test case for patch "nvme: don't send keep-alives to the discovery...
Johannes Thumshirn [Tue, 27 Mar 2018 09:21:09 +0000 (11:21 +0200)]
test/nvme/003: add test case for patch "nvme: don't send keep-alives to the discovery controller"

Add a regression test for the patch titled "nvme: don't send
keep-alives to the discovery controller".

This patch creates a local loopback nvme target and then connects to
it. If the patch is not applied we see two error messages in dmesg:
"failed nvme_keep_alive_end_io error=" from the nvme host and "nvmet:
unsupported cmd 24" from the nvme target. If the patch is applied
dmesg is quiet.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
7 years agoMerge pull request #14 from morbidrsa/nvme/002
Omar Sandoval [Sat, 7 Apr 2018 03:52:54 +0000 (20:52 -0700)]
Merge pull request #14 from morbidrsa/nvme/002

This pull adds a new test-case to the nvme test group for testing big
discovery log pages.

It is inspired by a bug triggered in the user-space 'nvme discover' with
a non Linux target which set's an non 0 MDTS (Maximum Data Transfer
Size) value causing nvme cli to fail the discovery.

There isn't a userspace fix yet, but it's still a nice scalability test.

7 years agotest/nvme/002: Test big discovery log pages
Johannes Thumshirn [Wed, 21 Mar 2018 12:55:48 +0000 (13:55 +0100)]
test/nvme/002: Test big discovery log pages

Test nvme discovery with many (1000) subsystems so the discovery log
page exceeds 4k.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
7 years agocommon/nvme: add helper functions to define a nvme target
Johannes Thumshirn [Wed, 21 Mar 2018 12:48:21 +0000 (13:48 +0100)]
common/nvme: add helper functions to define a nvme target

Add:
- _create_nvmet_port()
- _remove_nvmet_port()
- _create_nvmet_subsystem()
- _remove_nvmet_subsytem()
- _add_nvmet_subsys_to_port()
- _remove_nvmet_subsystem_from_port()

which serve as helper functions to create new nvmet ports and
subsystems for NVMe over Fabrics focused test cases.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
7 years agocommon/rc: add _have_configfs
Johannes Thumshirn [Wed, 21 Mar 2018 12:13:05 +0000 (13:13 +0100)]
common/rc: add _have_configfs

Add a _have_configfs() helper function checking if we have configfs
mounted similar to the already present _have_tracefs().

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
7 years agoFix some shellcheck warnings
Omar Sandoval [Fri, 6 Apr 2018 23:40:35 +0000 (16:40 -0700)]
Fix some shellcheck warnings

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoloop: add ioctl lock imbalance regression test
Omar Sandoval [Fri, 6 Apr 2018 16:58:43 +0000 (09:58 -0700)]
loop: add ioctl lock imbalance regression test

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock/013: fix shellcheck warning
Omar Sandoval [Wed, 28 Mar 2018 19:55:17 +0000 (12:55 -0700)]
block/013: fix shellcheck warning

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoRename sg group to scsi
Omar Sandoval [Wed, 28 Mar 2018 19:47:28 +0000 (12:47 -0700)]
Rename sg group to scsi

sg/003 is really an sd test, and there's no point in having separate
test group for sd.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoMerge pull request #13 from jeremycline/sg-ro-reread-part
Omar Sandoval [Wed, 28 Mar 2018 19:26:53 +0000 (12:26 -0700)]
Merge pull request #13 from jeremycline/sg-ro-reread-part

sg: test for patch "Keep disk read-only when re-reading partition"

7 years agosg: test for patch "Keep disk read-only when re-reading partition"
Jeremy Cline [Tue, 6 Mar 2018 19:22:33 +0000 (14:22 -0500)]
sg: test for patch "Keep disk read-only when re-reading partition"

Add a regression test for the patch "scsi: sd: Keep disk read-only when
re-reading partition" which ensures re-reading a disk's partition table
doesn't change its read-only flag.

Signed-off-by: Jeremy Cline <jeremy@jcline.org>
7 years agoMerge pull request #12 from morbidrsa/dir-locals
Omar Sandoval [Thu, 1 Mar 2018 21:18:16 +0000 (13:18 -0800)]
Merge pull request #12 from morbidrsa/dir-locals

dir-locals.el: add emacs local variable config

7 years agodir-locals.el: add emacs local variable config
Johannes Thumshirn [Thu, 1 Mar 2018 12:09:09 +0000 (13:09 +0100)]
dir-locals.el: add emacs local variable config

Add a dir-locals.el so Emacs will do the right thing when editing
blktests code and test cases.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
7 years agoblock/014: test all I/O schedulers
Omar Sandoval [Wed, 28 Feb 2018 18:17:34 +0000 (10:17 -0800)]
block/014: test all I/O schedulers

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock: add blk-mq requeue test
Omar Sandoval [Wed, 28 Feb 2018 18:11:12 +0000 (10:11 -0800)]
block: add blk-mq requeue test

This test is pretty trivial but it reproduces the hang fixed by
ba989a01469d ("block: kyber: fix domain token leak during requeue").

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock/014: fix comment about timeout frequency
Omar Sandoval [Wed, 28 Feb 2018 17:48:50 +0000 (09:48 -0800)]
block/014: fix comment about timeout frequency

An earlier version had interval 2 and probability 100%, but then I
changed it to interval 1 and probability 50%.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock: add smoke test for timeouts
Omar Sandoval [Wed, 28 Feb 2018 08:30:32 +0000 (00:30 -0800)]
block: add smoke test for timeouts

This doesn't do much, it just makes sure that the timeouts are executed
without hanging or crashing.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoMerge pull request #11 from morbidrsa/nvme-tracepoints
Omar Sandoval [Wed, 28 Feb 2018 07:41:39 +0000 (23:41 -0800)]
Merge pull request #11 from morbidrsa/nvme-tracepoints

Add the first NVMe-specific test.

7 years agotests/nvme: add NVMe test group and tracepoint test
Johannes Thumshirn [Fri, 16 Feb 2018 14:19:16 +0000 (15:19 +0100)]
tests/nvme: add NVMe test group and tracepoint test

Add a NVMe test group and a tracepoint test as the first test case.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoMerge pull request #10 from felixsch/cpuhotplug-fix
Omar Sandoval [Tue, 13 Feb 2018 19:51:59 +0000 (11:51 -0800)]
Merge pull request #10 from felixsch/cpuhotplug-fix

Append not replace cpus to cpus hotplug list

7 years agoAppend cpus to hotplug list instead of selecting the last one
Felix Schnizlein [Tue, 2 Jan 2018 09:18:54 +0000 (10:18 +0100)]
Append cpus to hotplug list instead of selecting the last one

Due to a missing plus, available cpus where not collected but only
the last possible one was used.

Signed-off-by: Felix Schnizlein <fschnizlein@suse.com>
7 years agoblock/013: Add test for BLKRRPART ioctl
xiao yang [Tue, 19 Dec 2017 10:30:23 +0000 (18:30 +0800)]
block/013: Add test for BLKRRPART ioctl

If the entire block device is formatted with a filesystem and
mounted, running "blockdev --rereadpt" should fail and return
EBUSY instead of pass.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: xiao yang <yangx.jy@cn.fujitsu.com>
[Omar: simplified a bit]
Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agocommon/rc: allow 5-digit domains in _get_pci_dev_from_blkdev
Jon Derrick [Mon, 27 Nov 2017 21:49:05 +0000 (14:49 -0700)]
common/rc: allow 5-digit domains in _get_pci_dev_from_blkdev

At least one driver (VMD) uses 32-bit pci domains, but is effectively
limited to 5-digit domains. Allow tests to access devices with 4-5 digit
domains.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
7 years agoMerge pull request #9 from yide1728/yizhang-branch
Omar Sandoval [Mon, 27 Nov 2017 19:45:02 +0000 (11:45 -0800)]
Merge pull request #9 from yide1728/yizhang-branch

Add missing _have_fio to a few tests.

7 years agoblock/006, block/008, block/010: add _have_fio to require function
Yi Zhang [Wed, 22 Nov 2017 07:34:56 +0000 (15:34 +0800)]
block/006, block/008, block/010: add _have_fio to require function

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
7 years agoloop/003: use a C program instead of bash
Omar Sandoval [Fri, 10 Nov 2017 21:30:49 +0000 (13:30 -0800)]
loop/003: use a C program instead of bash

shellcheck can't parse the {FD} syntax, and doing it in bash adds a
bunch of extra overhead to the loop, anyways.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agosrc: fix loblksize usage message
Omar Sandoval [Fri, 10 Nov 2017 21:23:41 +0000 (13:23 -0800)]
src: fix loblksize usage message

BLKSIZE is not optional.

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agosrc: add missing copyright header to loblksize
Omar Sandoval [Fri, 10 Nov 2017 21:20:51 +0000 (13:20 -0800)]
src: add missing copyright header to loblksize

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoshellcheck: ignore SC2119
Omar Sandoval [Fri, 10 Nov 2017 21:18:33 +0000 (13:18 -0800)]
shellcheck: ignore SC2119

It was causing this useless note:

tests/block/002:33:7: note: Use _init_scsi_debug "$@" if function's $1 should mean script's $1. [SC2119]

Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoblock/012: fix xfs_io error mismatch
Omar Sandoval [Fri, 10 Nov 2017 19:07:13 +0000 (11:07 -0800)]
block/012: fix xfs_io error mismatch

Old versions of xfs_io (like David must be using) use pwrite64() instead
of pwrite(), which was causing an output mismatch on my newer version.
Pull in _filter_xfs_io_error from xfstests to fix it. While we're here,
add a slightly more descriptive description.

Fixes: 3aeec46f048b ("block/012: add test for BLKROSET/BLKROGET ioctls")
Signed-off-by: Omar Sandoval <osandov@fb.com>
7 years agoMerge pull request #7 from ddiss/ro_get_set
Omar Sandoval [Fri, 10 Nov 2017 18:54:11 +0000 (10:54 -0800)]
Merge pull request #7 from ddiss/ro_get_set

Compiler warning fix and new test for BLKRO{SET,GET}.

7 years agoblock/012: add test for BLKROSET/BLKROGET ioctls
David Disseldorp [Wed, 8 Nov 2017 18:07:46 +0000 (19:07 +0100)]
block/012: add test for BLKROSET/BLKROGET ioctls

Use blockdev --setro/--getro to manipulate the read-only state of a test
device, and confirm that writes fail while set.

Signed-off-by: David Disseldorp <ddiss@suse.de>