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 | 44 ++++++++++++++++++++++++++++++++++++++++++++ tests/md/003.out | 1 + 4 files changed, 47 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 3e9c1fa..65a5fa5 100755 --- a/tests/md/002 +++ b/tests/md/002 @@ -25,7 +25,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..5a68480 --- /dev/null +++ b/tests/md/003 @@ -0,0 +1,44 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2025 Oracle and/or its affiliates +# +# Test NMVe Atomic Writes with MD devices + +. tests/md/rc +. common/nvme +. common/xfs + +DESCRIPTION="test md atomic writes for NVMe drives" +QUICK=1 + +requires() { + _nvme_requires + _stacked_atomic_test_requires +} + +device_requires() { + _require_test_dev_is_nvme +} + +test_device_array() { + local test_dev + local testdev_count=0 + declare -A NVME_TEST_DEVS_NAME + + echo "Running md_atomics_test" + + for test_dev in "${!TEST_DEV_ARRAY_SYSFS_DIRS[@]}"; do + NVME_TEST_DEVS_NAME["$testdev_count"]="${test_dev##*/}" + let testdev_count=testdev_count+1; + 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