[PATCH blktests 4/7] md/003: add NVMe atomic write tests for stacked devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



md/002 only tests SCSI via scsi_debug.

It is also useful to test NVMe, so add a specific test for that.

The results for 002 and 003 should be the same, so link them.

_md_atomics_test requires 4x devices with atomics support, so check for
that.

Signed-off-by: John Garry <john.g.garry@xxxxxxxxxx>
---
 tests/md/002     |  2 +-
 tests/md/002.out |  2 +-
 tests/md/003     | 51 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/md/003.out |  1 +
 4 files changed, 54 insertions(+), 2 deletions(-)
 create mode 100755 tests/md/003
 create mode 120000 tests/md/003.out

diff --git a/tests/md/002 b/tests/md/002
index 990b64b..87b13f2 100755
--- a/tests/md/002
+++ b/tests/md/002
@@ -24,7 +24,7 @@ test() {
 		per_host_store=true
 	)
 
-	echo "Running ${TEST_NAME}"
+	echo "Running md_atomics_test"
 
 	if ! _configure_scsi_debug "${scsi_debug_params[@]}"; then
 		return 1
diff --git a/tests/md/002.out b/tests/md/002.out
index cd34e38..b311a50 100644
--- a/tests/md/002.out
+++ b/tests/md/002.out
@@ -1,4 +1,4 @@
-Running md/002
+Running md_atomics_test
 TEST 1 raid0 step 1 - Verify md sysfs atomic attributes matches - pass
 TEST 2 raid0 step 1 - Verify sysfs atomic attributes - pass
 TEST 3 raid0 step 1 - Verify md sysfs_atomic_write_max is equal to expected_atomic_write_max - pass
diff --git a/tests/md/003 b/tests/md/003
new file mode 100755
index 0000000..8128f8d
--- /dev/null
+++ b/tests/md/003
@@ -0,0 +1,51 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2025 Oracle and/or its affiliates
+#
+# Test NMVe Atomic Writes with MD devices
+
+. tests/nvme/rc
+. common/xfs
+
+DESCRIPTION="test md atomic writes for NVMe drives"
+QUICK=1
+
+requires() {
+	_nvme_requires
+}
+
+test() {
+	local ns
+	local testdev_count=0
+	declare -A NVME_TEST_DEVS
+	declare -A NVME_TEST_DEVS_NAME
+	declare -A NVME_TEST_DEVS_SYSFS
+
+	echo "Running md_atomics_test"
+
+	for i in "${!TEST_DEV_SYSFS_DIRS[@]}"; do
+		TEST_DEV=${TEST_DEV_SYSFS_DIRS[$i]}
+		if readlink -f "$TEST_DEV" | grep -q nvme; then
+			NVME_TEST_DEVS["$testdev_count"]="$i";
+			NVME_TEST_DEVS_SYSFS["$testdev_count"]="$TEST_DEV";
+			NVME_TEST_DEVS_NAME["$testdev_count"]="$(awk '{print substr($1,6)   }' <<< $i)"
+			let testdev_count=testdev_count+1;
+		fi
+	done
+
+	for ((i = 0; i < ${#NVME_TEST_DEVS[@]}; ++i)); do
+		TEST_DEV_SYSFS="${NVME_TEST_DEVS_SYSFS[$i]}"
+		TEST_DEV="${NVME_TEST_DEVS[$i]}"
+		_require_device_support_atomic_writes
+	done
+
+	if [[ $testdev_count -lt 4 ]]; then
+		SKIP_REASONS+=("requires at least 4 NVMe devices")
+		return 1
+	fi
+
+	_md_atomics_test "${NVME_TEST_DEVS_NAME[0]}" "${NVME_TEST_DEVS_NAME[1]}" \
+			"${NVME_TEST_DEVS_NAME[2]}" "${NVME_TEST_DEVS_NAME[3]}"
+
+	echo "Test complete"
+}
diff --git a/tests/md/003.out b/tests/md/003.out
new file mode 120000
index 0000000..0412a1f
--- /dev/null
+++ b/tests/md/003.out
@@ -0,0 +1 @@
+002.out
\ No newline at end of file
-- 
2.43.5





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux