2015-06-02 14:37:20 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# test btrfstune options that enable filesystem features
|
|
|
|
|
2018-02-08 06:34:19 +00:00
|
|
|
source "$TEST_TOP/common"
|
2015-06-02 14:37:20 +00:00
|
|
|
|
|
|
|
check_prereq mkfs.btrfs
|
2016-01-12 14:16:11 +00:00
|
|
|
check_prereq btrfstune
|
|
|
|
check_prereq btrfs
|
|
|
|
|
2015-06-02 14:37:20 +00:00
|
|
|
setup_root_helper
|
2015-07-27 12:24:31 +00:00
|
|
|
prepare_test_dev
|
2015-06-02 14:37:20 +00:00
|
|
|
|
|
|
|
# test whether fsck can rebuild a corrupted extent tree
|
|
|
|
# parameters:
|
|
|
|
# - option for mkfs.btrfs -O, empty for defaults
|
|
|
|
# - option for btrfstune
|
2016-10-26 14:41:32 +00:00
|
|
|
# - string representing the feature in dump-super output
|
2015-06-02 14:37:20 +00:00
|
|
|
test_feature()
|
|
|
|
{
|
|
|
|
local mkfsfeatures
|
|
|
|
local tuneopt
|
|
|
|
local sbflag
|
|
|
|
|
2018-03-23 15:34:30 +00:00
|
|
|
mkfsfeatures=$1
|
2015-06-02 14:37:20 +00:00
|
|
|
tuneopt="$2"
|
|
|
|
sbflag="$3"
|
|
|
|
|
2019-06-05 17:09:38 +00:00
|
|
|
run_check_mkfs_test_dev ${mkfsfeatures:+-O ^"$mkfsfeatures"}
|
2018-03-23 15:34:30 +00:00
|
|
|
if run_check_stdout "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV" | \
|
2015-06-02 14:37:20 +00:00
|
|
|
grep -q "$sbflag"; then
|
|
|
|
_fail "FAIL: feature $sbflag must not be set on the base image"
|
|
|
|
fi
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check "$TOP/btrfstune" "$tuneopt" "$TEST_DEV"
|
|
|
|
if ! run_check_stdout "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV" | \
|
2015-06-02 14:37:20 +00:00
|
|
|
grep -q "$sbflag"; then
|
|
|
|
_fail "FAIL: feature $sbflag not set"
|
|
|
|
fi
|
2018-03-23 15:34:30 +00:00
|
|
|
run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
|
2015-06-02 14:37:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
test_feature extref -r EXTENDED_IREF
|
|
|
|
test_feature skinny-metadata -x SKINNY_METADATA
|
2015-06-02 16:41:01 +00:00
|
|
|
test_feature no-holes -n NO_HOLES
|
2015-06-02 14:37:20 +00:00
|
|
|
test_feature '' '-S 1' SEEDING
|