diff mbox series

[2/4] btrfs-progs: hide rst related mkfs tests behind experimental builds

Message ID 5355fb34cfa7fffd9af3be919b182561189ecb69.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
Currently we unconditionally run mkfs/029 and mkfs/030 as we export
RST feature through mkfs.btrfs as supported features.

But considering the mkfs.btrfs features are mismatch with kernel support
(only a BTRFS_DEBUG kernel can support that), we're going to hide RST
behind experimental builds.

In that case RST related tests cases also need to be behind
experimental builds as regular builds of mkfs.btrfs will no longer
support RST feature.

This patch would introduce two helpers:

- _test_config()
  To verify if certain config is set to 1

- check_experimental_build()
  A wrapper of "_test_config EXPERIMENTAL", and skip the test if
  btrfs-progs has no experimental features.

So that test cases can be skipped for non-experimental builds.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tests/common                                  | 22 +++++++++++++++++++
 tests/mkfs-tests/029-raid-stripe-tree/test.sh |  1 +
 tests/mkfs-tests/030-zoned-rst/test.sh        |  1 +
 3 files changed, 24 insertions(+)
diff mbox series

Patch

diff --git a/tests/common b/tests/common
index 7a23f6dde1a5..e9456c1d96b8 100644
--- a/tests/common
+++ b/tests/common
@@ -6,6 +6,21 @@ 
 # Temporary array for building the final command, injecting arguments as needed
 declare -a cmd_array
 
+# Check if certain config is set to 1
+_test_config()
+{
+	local feature="$1"
+
+	if [ ! -f "${TOP}/include/config.h" ]; then
+		echo "include/config.h not exists"
+		exit 1
+	fi
+	if grep -q "${feature}.*1" "${TOP}/include/config.h"; then
+		return 0
+	fi
+	return 1
+}
+
 # assert that argument is not empty and is an existing path (file or directory)
 _assert_path()
 {
@@ -370,6 +385,13 @@  run_mustfail_stdout()
 	fi
 }
 
+check_experimental_build()
+{
+	if ! _test_config "EXPERIMENTAL"; then
+		_not_run "This test requires experimental build"
+	fi
+}
+
 check_prereq()
 {
 	# Internal tools for testing, not shipped with the package
diff --git a/tests/mkfs-tests/029-raid-stripe-tree/test.sh b/tests/mkfs-tests/029-raid-stripe-tree/test.sh
index c3edd36d8761..f200d068fe79 100755
--- a/tests/mkfs-tests/029-raid-stripe-tree/test.sh
+++ b/tests/mkfs-tests/029-raid-stripe-tree/test.sh
@@ -3,6 +3,7 @@ 
 
 source "$TEST_TOP/common" || exit
 
+check_experimental_build
 check_prereq mkfs.btrfs
 check_prereq btrfs
 
diff --git a/tests/mkfs-tests/030-zoned-rst/test.sh b/tests/mkfs-tests/030-zoned-rst/test.sh
index b1c696c96eb7..b03c691f1b69 100755
--- a/tests/mkfs-tests/030-zoned-rst/test.sh
+++ b/tests/mkfs-tests/030-zoned-rst/test.sh
@@ -3,6 +3,7 @@ 
 
 source "$TEST_TOP/common" || exit
 
+check_experimental_build
 setup_root_helper
 setup_nullbdevs 4 128 4
 prepare_nullbdevs