@@ -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
@@ -3,6 +3,7 @@
source "$TEST_TOP/common" || exit
+check_experimental_build
check_prereq mkfs.btrfs
check_prereq btrfs
@@ -3,6 +3,7 @@
source "$TEST_TOP/common" || exit
+check_experimental_build
setup_root_helper
setup_nullbdevs 4 128 4
prepare_nullbdevs
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(+)