btrfs-progs: mkfs-tests: ensure regular builds won't enable rst feature

This test case will check the following behviour:

- 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)

Pull-request: #813
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2024-06-13 09:05:01 +09:30
parent 1c71f70af0
commit 34fc634850
2 changed files with 41 additions and 0 deletions

View file

@ -399,6 +399,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

View file

@ -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 additional 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 if experimental build is enabled 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