Skip to contentSkip to conversation

blktests: char device tests with iouring-cmd fio

PATCH In review Luis Chamberlain 5 participants 14 messages Dec 21, 2022 – Jan 17, 2023 Block layer

lore
Share & tools
lore
#0 lore raw

cover blktests: char device tests with iouring-cmd fio

As io-uring cmd grows there's a desire to do a bit more funky things with it. Add basic support with fio and add a few simple tests to tests the NVMe conventional drives character device as well as the ZNS character device.

These tests are perhaps a bit *too* basic to merge, not sure, let me know. But I figured that this would provide example to let us grow this with more complex things later as folks add support for more features.

Luis Chamberlain (6):
common/fio: add helpers using io-uring cmd engine tests/nvme: add new test for rand-read on the nvme character device tests/nvme: add new test for rand-write on the nvme character device tests/nvme: add new test for optimal write on the nvme character
device
tests/zbd: add new basic test for reading zone character device tests/zbd: add new basic test for reading zone character device

 common/fio         | 47 +++++++++++++++++++++++++++++++++++++++++
 tests/nvme/046     | 42 +++++++++++++++++++++++++++++++++++++
 tests/nvme/046.out |  2 ++
 tests/nvme/047     | 41 ++++++++++++++++++++++++++++++++++++
 tests/nvme/047.out |  2 ++
 tests/nvme/048     | 41 ++++++++++++++++++++++++++++++++++++
 tests/nvme/048.out |  2 ++
 tests/zbd/011      | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/zbd/011.out  |  2 ++
 tests/zbd/012      | 50 ++++++++++++++++++++++++++++++++++++++++++++
 tests/zbd/012.out  |  2 ++
 11 files changed, 283 insertions(+)
 create mode 100755 tests/nvme/046
 create mode 100644 tests/nvme/046.out
 create mode 100755 tests/nvme/047
 create mode 100644 tests/nvme/047.out
 create mode 100755 tests/nvme/048
 create mode 100644 tests/nvme/048.out
 create mode 100755 tests/zbd/011
 create mode 100644 tests/zbd/011.out
 create mode 100755 tests/zbd/012
 create mode 100644 tests/zbd/012.out
Signature · 1 line
2.35.1
#1 lore raw

PATCH 1/6 common/fio: add helpers using io-uring cmd engine

This will allow us to add tests which use the io-uring cmd engine, part of fio. They are inspired by the work by Anuj Gupta and Ankit Kumar which added sample fio files onto fio for this exact purpose.

We can build on those to expand test coverage with elaborate tests.

We don't specify the cmd to allow other types of io-uring cmd users to use this other than nvme.

---
 common/fio | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
common/fio +47 -0
index bed76d555b2a..4da90804ed21 100644
@@ -184,6 +184,53 @@ _run_fio_verify_io() {
 	rm -f local*verify*state
 }
 
+_run_fio_rand_iouring_cmd() {
+	_run_fio --bs=4k --rw=randread --numjobs="$(nproc)" \
+		--ioengine=io_uring_cmd --iodepth=32 \
+		--thread=1 --stonewall=1 \
+		--name=reads "$@"
+}
+
+_run_fio_verify_iouring_cmd_randwrite() {
+	_run_fio --bs=4k --rw=randwrite --numjobs="$(nproc)" \
+		--ioengine=io_uring_cmd --iodepth=32 \
+		--thread=1 --stonewall=1 \
+		--sqthread_poll=1 --sqthread_poll_cpu=0 \
+		--nonvectored=1 --registerfiles=1 \
+		--verify=crc32c \
+		--name=verify "$@"
+	rm -f local*verify*state
+}
+
+_run_fio_verify_iouring_cmd_write_opts() {
+	_run_fio --bs=4k --rw=write --numjobs="$(nproc)" \
+		--ioengine=io_uring_cmd --iodepth=32 \
+		--thread=1 --stonewall=1 \
+		--sqthread_poll=1 --sqthread_poll_cpu=0 \
+		--nonvectored=1 --registerfiles=1 \
+		--verify=crc32c \
+		--name=verify "$@"
+	rm -f local*verify*state
+}
+
+_run_fio_iouring_cmd_zone() {
+	_run_fio --rw=randread --numjobs="$(nproc)" \
+		--ioengine=io_uring_cmd --iodepth=1 \
+		--stonewall=1 \
+		--zonemode=zbd \
+		--name=reads "$@"
+}
+
+_run_fio_verify_iouring_cmd_write_opts_zone() {
+	_run_fio --rw=randread --numjobs="$(nproc)" \
+		--ioengine=io_uring_cmd --iodepth=1 \
+		--stonewall=1 \
+		--zonemode=zbd \
+		--sqthread_poll=1 --registerfiles=1 --sqthread_poll_cpu=0 \
+		--verify=crc32c \
+		--name=verify "$@"
+}
+
 _fio_perf_report() {
 	# If there is more than one group, we don't know what to report.
 	if [[ $(wc -l < "$TMPDIR/fio_perf") -gt 1 ]]; then
Signature · 1 line
2.35.1
#2 lore raw

Re: [PATCH 1/6] common/fio: add helpers using io-uring cmd engine

Quoted 58 lines · Luis Chamberlain

This will allow us to add tests which use the io-uring cmd engine, part of fio. They are inspired by the work by Anuj Gupta and Ankit Kumar which added sample fio files onto fio for this exact purpose.

We can build on those to expand test coverage with elaborate tests.

We don't specify the cmd to allow other types of io-uring cmd users to use this other than nvme.

---
 common/fio | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
common/fio +35 -0
index bed76d555b2a..4da90804ed21 100644
@@ -184,6 +184,53 @@ _run_fio_verify_io() {
 	rm -f local*verify*state
 }
 
+_run_fio_rand_iouring_cmd() {
+	_run_fio --bs=4k --rw=randread --numjobs="$(nproc)" \
+		--ioengine=io_uring_cmd --iodepth=32 \
+		--thread=1 --stonewall=1 \
+		--name=reads "$@"
+}
+
+_run_fio_verify_iouring_cmd_randwrite() {
+	_run_fio --bs=4k --rw=randwrite --numjobs="$(nproc)" \
+		--ioengine=io_uring_cmd --iodepth=32 \
+		--thread=1 --stonewall=1 \
+		--sqthread_poll=1 --sqthread_poll_cpu=0 \
+		--nonvectored=1 --registerfiles=1 \
+		--verify=crc32c \
+		--name=verify "$@"
+	rm -f local*verify*state
+}
+
+_run_fio_verify_iouring_cmd_write_opts() {
+	_run_fio --bs=4k --rw=write --numjobs="$(nproc)" \
+		--ioengine=io_uring_cmd --iodepth=32 \
+		--thread=1 --stonewall=1 \
+		--sqthread_poll=1 --sqthread_poll_cpu=0 \
+		--nonvectored=1 --registerfiles=1 \
+		--verify=crc32c \
+		--name=verify "$@"
+	rm -f local*verify*state
+}
+
+_run_fio_iouring_cmd_zone() {
+	_run_fio --rw=randread --numjobs="$(nproc)" \
+		--ioengine=io_uring_cmd --iodepth=1 \
+		--stonewall=1 \
+		--zonemode=zbd \
+		--name=reads "$@"

common/fio _run_fio_verify_io() { · line 231

Quoted 10 lines
common/fio +10 -0
+}
+
+_run_fio_verify_iouring_cmd_write_opts_zone() {
+	_run_fio --rw=randread --numjobs="$(nproc)" \
+		--ioengine=io_uring_cmd --iodepth=1 \
+		--stonewall=1 \
+		--zonemode=zbd \
+		--sqthread_poll=1 --registerfiles=1 --sqthread_poll_cpu=0 \
+		--verify=crc32c \
+		--name=verify "$@"

Are you missing a "rm -f local*verify*state" here?

Joel

Quoted 8 lines
common/fio +2 -0
+}
+
 _fio_perf_report() {
 	# If there is more than one group, we don't know what to report.
 	if [[ $(wc -l < "$TMPDIR/fio_perf") -gt 1 ]]; then
Signature · 1 line
2.35.1
#3 lore raw

PATCH 2/6 tests/nvme: add new test for rand-read on the nvme character device

In reply to Luis Chamberlain

This does basic rand-read testing of the character device of a conventional NVMe drive.

---
 tests/nvme/046     | 42 ++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/046.out |  2 ++
 2 files changed, 44 insertions(+)
 create mode 100755 tests/nvme/046
 create mode 100644 tests/nvme/046.out
tests/nvme/046 new file +42 -0
new file mode 100755
index 000000000000..3526ab9eedab
@@ -0,0 +1,42 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Luis Chamberlain <[email protected]>
+#
+# This does basic sanity test for the nvme character device. This is a basic
+# test and if it fails it is probably very likely other nvme character device
+# tests would fail.
+#
+. tests/nvme/rc
+
+DESCRIPTION="basic rand-read io_uring_cmd engine for nvme-ns character device"
+QUICK=1
+
+requires() {
+	_nvme_requires
+	_have_fio
+}
+
+device_requires() {
+	_require_test_dev_is_nvme
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+	local ngdev=${TEST_DEV/nvme/ng}
+	local fio_args=(
+		--size=1M
+		--cmd_type=nvme
+		--filename="$ngdev"
+		--time_based
+		--runtime=10
+	) &&
+	_run_fio_rand_iouring_cmd "${fio_args[@]}" >>"${FULL}" 2>&1 ||
+	fail=true
+
+	if [ -z "$fail" ]; then
+		echo "Test complete"
+	else
+		echo "Test failed"
+		return 1
+	fi
+}
tests/nvme/046.out new file +2 -0
new file mode 100644
index 000000000000..2b5fa6af63b1
@@ -0,0 +1,2 @@
+Running nvme/046
+Test complete
Signature · 1 line
2.35.1
#4 lore raw

Re: [PATCH 2/6] tests/nvme: add new test for rand-read on the nvme character device

Quoted 39 lines · Luis Chamberlain

This does basic rand-read testing of the character device of a conventional NVMe drive.

---
tests/nvme/046 | 42 ++++++++++++++++++++++++++++++++++++++++++
tests/nvme/046.out | 2 ++

2 files changed, 44 insertions(+)

create mode 100755 tests/nvme/046 create mode 100644 tests/nvme/046.out

tests/nvme/046 new file +22 -0
new file mode 100755
index 000000000000..3526ab9eedab
@@ -0,0 +1,42 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Luis Chamberlain <[email protected]>
+#
+# This does basic sanity test for the nvme character device. This is a basic
+# test and if it fails it is probably very likely other nvme character device
+# tests would fail.
+#
+. tests/nvme/rc
+
+DESCRIPTION="basic rand-read io_uring_cmd engine for nvme-ns character device"
+QUICK=1
+
+requires() {
+	_nvme_requires
+	_have_fio
+}
+
+device_requires() {
+	_require_test_dev_is_nvme
+}
+

tests/nvme/046 line 32

Quoted 10 lines
tests/nvme/046 new file +10 -0
+test_device() {
+	echo "Running ${TEST_NAME}"
+	local ngdev=${TEST_DEV/nvme/ng}
+	local fio_args=(
+		--size=1M
+		--cmd_type=nvme
+		--filename="$ngdev"
+		--time_based
+		--runtime=10
+	) &&

Is this && needed?

tests/nvme/046 line 33

Quoted 1 line
tests/nvme/046 new file +1 -0
+	_run_fio_rand_iouring_cmd "${fio_args[@]}" >>"${FULL}" 2>&1 ||

Something to change here (and therefore in other patches too). If we change "cmd_type = something_random", test continues to show the success while it should show failure.

How about changing above line to:
_run_fio_rand_iouring_cmd "${fio_args[@]}" || fail=true

And thanks for the series.

#5 lore raw

Re: [PATCH 2/6] tests/nvme: add new test for rand-read on the nvme character device

Quoted 44 lines · Kanchan Joshi
Quoted 43 lines · Luis Chamberlain

This does basic rand-read testing of the character device of a conventional NVMe drive.

---
tests/nvme/046 | 42 ++++++++++++++++++++++++++++++++++++++++++
tests/nvme/046.out | 2 ++

2 files changed, 44 insertions(+)

create mode 100755 tests/nvme/046 create mode 100644 tests/nvme/046.out

tests/nvme/046 new file +26 -0
new file mode 100755
index 000000000000..3526ab9eedab
@@ -0,0 +1,42 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Luis Chamberlain <[email protected]>
+#
+# This does basic sanity test for the nvme character device. This is a basic
+# test and if it fails it is probably very likely other nvme character device
+# tests would fail.
+#
+. tests/nvme/rc
+
+DESCRIPTION="basic rand-read io_uring_cmd engine for nvme-ns character device"
+QUICK=1
+
+requires() {
+	_nvme_requires
+	_have_fio
+}
+
+device_requires() {
+	_require_test_dev_is_nvme
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+	local ngdev=${TEST_DEV/nvme/ng}
+	local fio_args=(
Quoted 8 lines

tests/nvme/046 line 32

Quoted 6 lines
tests/nvme/046 new file +6 -0
+		--size=1M
+		--cmd_type=nvme
+		--filename="$ngdev"
+		--time_based
+		--runtime=10
+	) &&

Is this && needed?

This form was inspired by commit 238c7e0b by Bart, but yeah you're right, I can't see any reason for it, so we can clean zbd/010 from it too.

Quoted 6 lines

tests/nvme/046 line 33

Quoted 2 lines
tests/nvme/046 new file +1 -0
+	_run_fio_rand_iouring_cmd "${fio_args[@]}" >>"${FULL}" 2>&1 ||

Something to change here (and therefore in other patches too). If we change "cmd_type = something_random", test continues to show the success while it should show failure.

Definitely no bueno.

Quoted 2 lines

How about changing above line to:
_run_fio_rand_iouring_cmd "${fio_args[@]}" || fail=true

We'd loose the 046.full log then.

If we just return $? at the end of _run_fio_rand_iouring_cmd() that seems to fix the undetected error. Whatyda think?

I noticed an odd thing in the last two patches which work for zone storage, if I change the runtime it doesn't take longer, so I think something is still off there too... can you take a look?

Luis

#6 lore raw

Re: [PATCH 2/6] tests/nvme: add new test for rand-read on the nvme character device

Quoted 65 lines · Luis Chamberlain
Quoted 44 lines · Kanchan Joshi
Quoted 43 lines · Luis Chamberlain

This does basic rand-read testing of the character device of a conventional NVMe drive.

---
tests/nvme/046 | 42 ++++++++++++++++++++++++++++++++++++++++++
tests/nvme/046.out | 2 ++

2 files changed, 44 insertions(+)

create mode 100755 tests/nvme/046 create mode 100644 tests/nvme/046.out

tests/nvme/046 new file +26 -0
new file mode 100755
index 000000000000..3526ab9eedab
@@ -0,0 +1,42 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Luis Chamberlain <[email protected]>
+#
+# This does basic sanity test for the nvme character device. This is a basic
+# test and if it fails it is probably very likely other nvme character device
+# tests would fail.
+#
+. tests/nvme/rc
+
+DESCRIPTION="basic rand-read io_uring_cmd engine for nvme-ns character device"
+QUICK=1
+
+requires() {
+	_nvme_requires
+	_have_fio
+}
+
+device_requires() {
+	_require_test_dev_is_nvme
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+	local ngdev=${TEST_DEV/nvme/ng}
+	local fio_args=(
Quoted 8 lines

tests/nvme/046 line 32

Quoted 6 lines
tests/nvme/046 new file +6 -0
+		--size=1M
+		--cmd_type=nvme
+		--filename="$ngdev"
+		--time_based
+		--runtime=10
+	) &&

Is this && needed?

This form was inspired by commit 238c7e0b by Bart, but yeah you're right, I can't see any reason for it, so we can clean zbd/010 from it too.

Quoted 6 lines

tests/nvme/046 line 33

Quoted 2 lines
tests/nvme/046 new file +1 -0
+	_run_fio_rand_iouring_cmd "${fio_args[@]}" >>"${FULL}" 2>&1 ||

Something to change here (and therefore in other patches too). If we change "cmd_type = something_random", test continues to show the success while it should show failure.

Definitely no bueno.

Quoted 7 lines
Quoted 2 lines

How about changing above line to:
_run_fio_rand_iouring_cmd "${fio_args[@]}" || fail=true

We'd loose the 046.full log then.

If we just return $? at the end of _run_fio_rand_iouring_cmd() that seems to fix the undetected error. Whatyda think?

It did not fix for me. It still shows test passed for "cmd_type=random". How about this one instead-

_run_fio_rand_iouring_cmd "${fio_args[@]}" >>"${FULL}" || fail=true

it retains the full log, and shows the error when it occurs.

Quoted 3 lines

I noticed an odd thing in the last two patches which work for zone storage, if I change the runtime it doesn't take longer, so I think something is still off there too... can you take a look?

Runtime change works fine for first zoned test (i.e. read one). For the last one (i.e. zbd/012), fio fails early (that's why runtime does not have any impact) because rw is set to randread along with
verify. It should rather be set to write.

#7 lore raw

Re: [PATCH 2/6] tests/nvme: add new test for rand-read on the nvme character device

In reply to Luis Chamberlain
Quoted 48 lines · Luis Chamberlain

This does basic rand-read testing of the character device of a conventional NVMe drive.

---
 tests/nvme/046     | 42 ++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/046.out |  2 ++
 2 files changed, 44 insertions(+)
 create mode 100755 tests/nvme/046
 create mode 100644 tests/nvme/046.out
tests/nvme/046 new file +31 -0
new file mode 100755
index 000000000000..3526ab9eedab
@@ -0,0 +1,42 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Luis Chamberlain <[email protected]>
+#
+# This does basic sanity test for the nvme character device. This is a basic
+# test and if it fails it is probably very likely other nvme character device
+# tests would fail.
+#
+. tests/nvme/rc
+
+DESCRIPTION="basic rand-read io_uring_cmd engine for nvme-ns character device"
+QUICK=1
+
+requires() {
+	_nvme_requires
+	_have_fio
+}
+
+device_requires() {
+	_require_test_dev_is_nvme
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+	local ngdev=${TEST_DEV/nvme/ng}
+	local fio_args=(
+		--size=1M
+		--cmd_type=nvme
+		--filename="$ngdev"
+		--time_based
+		--runtime=10

tests/nvme/046 line 41

Quoted 10 lines
tests/nvme/046 new file +10 -0
+	) &&
+	_run_fio_rand_iouring_cmd "${fio_args[@]}" >>"${FULL}" 2>&1 ||
+	fail=true
+
+	if [ -z "$fail" ]; then
+		echo "Test complete"
+	else
+		echo "Test failed"
+		return 1
+	fi

I see that several test have this structure, but would it not be better to do:

"""
if [ -n "$fail" ]; then
echo "Test failed"
return 1
fi

return "Test complete"
"""

I point this out because I noticed that most nvme tests just set the "test complete" string at the end of the test function.

Quoted 12 lines
tests/nvme/046 new file +1 -0
+}
tests/nvme/046.out new file +2 -0
new file mode 100644
index 000000000000..2b5fa6af63b1
@@ -0,0 +1,2 @@
+Running nvme/046
+Test complete
Signature · 1 line
2.35.1
#8 lore raw

Re: [PATCH 2/6] tests/nvme: add new test for rand-read on the nvme character device

Quoted 16 lines

tests/nvme/046 line 41

Quoted 7 lines
tests/nvme/046 new file +7 -0
+
+	if [ -z "$fail" ]; then
+		echo "Test complete"
+	else
+		echo "Test failed"
+		return 1
+	fi

I see that several test have this structure, but would it not be better to do:

"""
if [ -n "$fail" ]; then
echo "Test failed"
return 1
fi

Quoted 6 lines

return "Test complete"
"""

I point this out because I noticed that most nvme tests just set the "test complete" string at the end of the test function.

Yes, "Test complete" is sufficient to validate the correctness and keeps the code small.

-ck

#9 lore raw

PATCH 3/6 tests/nvme: add new test for rand-write on the nvme character device

In reply to Luis Chamberlain

This does basic rand-write testing of the character device of a conventional NVMe drive.

---
 tests/nvme/047     | 41 +++++++++++++++++++++++++++++++++++++++++
 tests/nvme/047.out |  2 ++
 2 files changed, 43 insertions(+)
 create mode 100755 tests/nvme/047
 create mode 100644 tests/nvme/047.out
tests/nvme/047 new file +41 -0
new file mode 100755
index 000000000000..8ba55b250bc5
@@ -0,0 +1,41 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Luis Chamberlain <[email protected]>
+#
+# This does basic random write test for the the convential nvme character
+# device.
+
+. tests/nvme/rc
+
+DESCRIPTION="basic rand-write io_uring_cmd engine for nvme-ns character device"
+QUICK=1
+
+requires() {
+	_nvme_requires
+	_have_fio
+}
+
+device_requires() {
+	_require_test_dev_is_nvme
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+	local ngdev=${TEST_DEV/nvme/ng}
+	local fio_args=(
+		--size=1M
+		--cmd_type=nvme
+		--filename="$ngdev"
+		--time_based
+		--runtime=10
+	) &&
+	_run_fio_verify_iouring_cmd_randwrite "${fio_args[@]}" >>"${FULL}" 2>&1 ||
+	fail=true
+
+	if [ -z "$fail" ]; then
+		echo "Test complete"
+	else
+		echo "Test failed"
+		return 1
+	fi
+}
tests/nvme/047.out new file +2 -0
new file mode 100644
index 000000000000..915d0a2389ca
@@ -0,0 +1,2 @@
+Running nvme/047
+Test complete
Signature · 1 line
2.35.1
#10 lore raw

PATCH 4/6 tests/nvme: add new test for optimal write on the nvme character device

In reply to Luis Chamberlain

This does basic optimal write testing of the character device of a conventional NVMe drive.

---
 tests/nvme/048     | 41 +++++++++++++++++++++++++++++++++++++++++
 tests/nvme/048.out |  2 ++
 2 files changed, 43 insertions(+)
 create mode 100755 tests/nvme/048
 create mode 100644 tests/nvme/048.out
tests/nvme/048 new file +41 -0
new file mode 100755
index 000000000000..94329d9ed764
@@ -0,0 +1,41 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Luis Chamberlain <[email protected]>
+#
+# This does basic optimal write test for the nvme character device.
+
+. tests/nvme/rc
+
+DESCRIPTION="basic optimal write io_uring_cmd engine for nvme-ns character device"
+QUICK=1
+CAN_BE_ZONED=1
+
+requires() {
+	_nvme_requires
+	_have_fio
+}
+
+device_requires() {
+	_require_test_dev_is_nvme
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+	local ngdev=${TEST_DEV/nvme/ng}
+	local fio_args=(
+		--size=1M
+		--cmd_type=nvme
+		--filename="$ngdev"
+		--time_based
+		--runtime=10
+	) &&
+	_run_fio_verify_iouring_cmd_write_opts "${fio_args[@]}" >>"${FULL}" 2>&1 ||
+	fail=true
+
+	if [ -z "$fail" ]; then
+		echo "Test complete"
+	else
+		echo "Test failed"
+		return 1
+	fi
+}
tests/nvme/048.out new file +2 -0
new file mode 100644
index 000000000000..65ffa47e34f1
@@ -0,0 +1,2 @@
+Running nvme/048
+Test complete
Signature · 1 line
2.35.1
#11 lore raw

PATCH 5/6 tests/zbd: add new basic test for reading zone character device

In reply to Luis Chamberlain

This adds a basic test to read using fio against a ZNS character device.

---
 tests/zbd/011     | 52 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/zbd/011.out |  2 ++
 2 files changed, 54 insertions(+)
 create mode 100755 tests/zbd/011
 create mode 100644 tests/zbd/011.out
tests/zbd/011 new file +52 -0
new file mode 100755
index 000000000000..a4d46fcd6cd3
@@ -0,0 +1,52 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Luis Chamberlain <[email protected]>
+#
+# This does basic read test for the zone nvme character device.
+
+. tests/zbd/rc
+
+DESCRIPTION="basic read io_uring_cmd engine for zone nvme-ns character device"
+QUICK=1
+CAN_BE_ZONED=1
+
+requires() {
+	_have_fio
+}
+
+fallback_device() {
+	_fallback_null_blk_zoned
+}
+
+cleanup_fallback_device() {
+	_exit_null_blk
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+	local -i bs
+	declare -a fio_args
+	local ngdev=${TEST_DEV/nvme/ng}
+
+	_get_sysfs_variable "${TEST_DEV}" || return $?
+	bs=${SYSFS_VARS[$SV_PHYS_BLK_SIZE]}
+	_put_sysfs_variable
+
+	fio_args=(
+		--bs="$bs"
+		--size=1024M
+		--cmd_type=nvme
+		--filename="$ngdev"
+		--time_based
+		--runtime=10
+	) &&
+	_run_fio_iouring_cmd_zone "${fio_args[@]}" >>"${FULL}" 2>&1 ||
+	fail=true
+
+	if [ -z "$fail" ]; then
+		echo "Test complete"
+	else
+		echo "Test failed"
+		return 1
+	fi
+}
tests/zbd/011.out new file +2 -0
new file mode 100644
index 000000000000..aec7f703938a
@@ -0,0 +1,2 @@
+Running zbd/011
+Test complete
Signature · 1 line
2.35.1
#12 lore raw

PATCH 6/6 tests/zbd: add new basic test for reading zone character device

In reply to Luis Chamberlain

This adds a basic optimal write test using fio against a ZNS character device.

---
 tests/zbd/012     | 50 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/zbd/012.out |  2 ++
 2 files changed, 52 insertions(+)
 create mode 100755 tests/zbd/012
 create mode 100644 tests/zbd/012.out
tests/zbd/012 new file +50 -0
new file mode 100755
index 000000000000..474bcb07a27b
@@ -0,0 +1,50 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Luis Chamberlain <[email protected]>
+#
+# This does basic optimal write test for the zone nvme character device.
+
+. tests/zbd/rc
+
+DESCRIPTION="basic optimal write using io_uring_cmd engine for zone nvme-ns character device"
+QUICK=1
+CAN_BE_ZONED=1
+
+requires() {
+	_have_fio
+}
+
+fallback_device() {
+	_fallback_null_blk_zoned
+}
+
+cleanup_fallback_device() {
+	_exit_null_blk
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+	local -i bs
+	declare -a fio_args
+	local ngdev=${TEST_DEV/nvme/ng}
+
+	_get_sysfs_variable "${TEST_DEV}" || return $?
+	bs=${SYSFS_VARS[$SV_PHYS_BLK_SIZE]}
+	_put_sysfs_variable
+
+	fio_args=(
+		--bs="$bs"
+		--size=1024M
+		--cmd_type=nvme
+		--filename="$ngdev"
+	) &&
+	_run_fio_verify_iouring_cmd_write_opts_zone "${fio_args[@]}" >>"${FULL}" 2>&1 ||
+	fail=true
+
+	if [ -z "$fail" ]; then
+		echo "Test complete"
+	else
+		echo "Test failed"
+		return 1
+	fi
+}
tests/zbd/012.out new file +2 -0
new file mode 100644
index 000000000000..8ff654950c5f
@@ -0,0 +1,2 @@
+Running zbd/012
+Test complete
Signature · 1 line
2.35.1
#13 lore raw
In reply to Luis Chamberlain
Quoted 9 lines · Luis Chamberlain

As io-uring cmd grows there's a desire to do a bit more funky things with it. Add basic support with fio and add a few simple tests to tests the NVMe conventional drives character device as well as the ZNS character device.

These tests are perhaps a bit *too* basic to merge, not sure, let me know. But I figured that this would provide example to let us grow this with more complex things later as folks add support for more features.

It is good to have new test cases to test new features and their new code paths. I agree to have new test cases for the NVMe character device with io-uring.

Having said that, I'm not sure if we should have all of the five test cases in the series. The test cases nvme/046, 047, 048 are similar. They do random read, random write, or sequential write respectively. I'm not sure how the workload difference expands the code coverage of the code paths in the NVMe driver. Same for zbd/011 and 012. They are intended for ZNS devices, but I do not see ZNS unique part in the NVMe character device code paths. Then the variation of the test cases do not look useful to find bugs in the driver. As the first step, I think single test case will be enough which does basic read and/or write to exercises the NVMe character device and io-uring.

Signature · 1 line
Shin'ichiro Kawasaki