diff mbox series

[4/4] btrfs-progs: mkfs-tests: ensure regular builds won't enable rst feature

Message ID 48ce67476f6674725c5e87e25373d8e86df0cb46.1718238120.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: move RST feature back to experimental | expand

Commit Message

Qu Wenruo June 13, 2024, 12:23 a.m. UTC
This test case will check the following behaivors:

- Regular zoned supported data/metadata profiles
  Should success

- RST with zoned feature
  Should fail for non-experimental builds

- zoned with data profiles that only RST supports
  Should fail for non-experimental builds.

  Meanwhile for experimental builds it should success and enable RST
  feature automatically (verified in mkfs/030)

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tests/common                                  |  7 ++++
 tests/mkfs-tests/033-zoned-reject-rst/test.sh | 34 +++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100755 tests/mkfs-tests/033-zoned-reject-rst/test.sh
diff mbox series

Patch

diff --git a/tests/common b/tests/common
index e9456c1d96b8..12ec1ad92b85 100644
--- a/tests/common
+++ b/tests/common
@@ -392,6 +392,13 @@  check_experimental_build()
 	fi
 }
 
+check_regular_build()
+{
+	if _test_config "EXPERIMENTAL"; then
+		_not_run "This test requires non-experimental build"
+	fi
+}
+
 check_prereq()
 {
 	# Internal tools for testing, not shipped with the package
diff --git a/tests/mkfs-tests/033-zoned-reject-rst/test.sh b/tests/mkfs-tests/033-zoned-reject-rst/test.sh
new file mode 100755
index 000000000000..698551eccd59
--- /dev/null
+++ b/tests/mkfs-tests/033-zoned-reject-rst/test.sh
@@ -0,0 +1,34 @@ 
+#!/bin/bash
+# Verify mkfs for all currently supported profiles of zoned + raid-stripe-tree
+
+source "$TEST_TOP/common" || exit
+
+check_regular_build
+setup_root_helper
+setup_nullbdevs 4 128 4
+prepare_nullbdevs
+TEST_DEV=${nullb_devs[1]}
+
+profiles="dup raid1 raid1c3 raid1c4 raid10"
+
+# The existing supported profiles.
+run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f -O zoned -d single -m single "${nullb_devs[@]}"
+run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f -O zoned -d single -m DUP "${nullb_devs[@]}"
+
+# RST feature is rejected
+run_mustfail "RST feature created" \
+	$SUDO_HELPER "$TOP/mkfs.btrfs" -f -O zoned,raid-stripe-tree -d single -m DUP "${nullb_devs[@]}"
+
+for dprofile in $profiles; do
+	# make sure extra data profiles won't enable RST for non-experimental build
+	run_mustfail "unsupported profile created" \
+		$SUDO_HELPER "$TOP/mkfs.btrfs" -f -O zoned -d "$dprofile" -m DUP "${nullb_devs[@]}"
+done
+
+# The old unsupported profiles should fail no matter experimental build or not.
+run_mustfail "unsupported profile raid56 created" \
+	$SUDO_HELPER "$TOP/mkfs.btrfs" -f -O zoned -d raid5 -m raid5 "${nullb_devs[@]}"
+run_mustfail "unsupported profile raid56 created" \
+	$SUDO_HELPER "$TOP/mkfs.btrfs" -f -O zoned -d raid6 -m raid6 "${nullb_devs[@]}"
+
+cleanup_nullbdevs