mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-11 03:31:17 +00:00
btrfs-progs: tests: hide RST related mkfs tests behind experimental builds
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 don't match 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. 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> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
285d2cbdf9
commit
7ca1e41093
23
tests/common
23
tests/common
@ -6,6 +6,22 @@
|
||||
# Temporary array for building the final command, injecting arguments as needed
|
||||
declare -a cmd_array
|
||||
|
||||
# Check if a given option in config.h is set to 1
|
||||
# $1: config option name
|
||||
_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()
|
||||
{
|
||||
@ -376,6 +392,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
|
||||
|
Loading…
Reference in New Issue
Block a user