diff mbox series

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

Message ID 20221221103441.3216600-7-mcgrof@kernel.org (mailing list archive)
State New, archived
Headers show
Series blktests: char device tests with iouring-cmd fio | expand

Commit Message

Luis Chamberlain Dec. 21, 2022, 10:34 a.m. UTC
This adds a basic optimal write test using fio against a ZNS character
device.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 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
diff mbox series

Patch

diff --git a/tests/zbd/012 b/tests/zbd/012
new file mode 100755
index 000000000000..474bcb07a27b
--- /dev/null
+++ b/tests/zbd/012
@@ -0,0 +1,50 @@ 
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Luis Chamberlain <mcgrof@kernel.org>
+#
+# 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
+}
diff --git a/tests/zbd/012.out b/tests/zbd/012.out
new file mode 100644
index 000000000000..8ff654950c5f
--- /dev/null
+++ b/tests/zbd/012.out
@@ -0,0 +1,2 @@ 
+Running zbd/012
+Test complete