summaryrefslogtreecommitdiff
path: root/tests/misc-tests/001-btrfstune-features/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/misc-tests/001-btrfstune-features/test.sh')
-rwxr-xr-xtests/misc-tests/001-btrfstune-features/test.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/misc-tests/001-btrfstune-features/test.sh b/tests/misc-tests/001-btrfstune-features/test.sh
new file mode 100755
index 00000000..c858d701
--- /dev/null
+++ b/tests/misc-tests/001-btrfstune-features/test.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# test btrfstune options that enable filesystem features
+
+source $TOP/tests/common
+
+check_prereq btrfs-debug-tree
+check_prereq btrfs-show-super
+check_prereq mkfs.btrfs
+check_prereq btrfstune
+check_prereq btrfs
+
+setup_root_helper
+prepare_test_dev
+
+# test whether fsck can rebuild a corrupted extent tree
+# parameters:
+# - option for mkfs.btrfs -O, empty for defaults
+# - option for btrfstune
+# - string representing the feature in btrfs-show-super dump
+test_feature()
+{
+ local mkfsfeatures
+ local tuneopt
+ local sbflag
+
+ mkfsfeatures=${1:+-O ^$1}
+ tuneopt="$2"
+ sbflag="$3"
+
+ run_check $SUDO_HELPER $TOP/mkfs.btrfs -f $mkfsfeatures $TEST_DEV
+ if run_check_stdout $TOP/btrfs-show-super $TEST_DEV | \
+ grep -q "$sbflag"; then
+ _fail "FAIL: feature $sbflag must not be set on the base image"
+ fi
+ run_check $TOP/btrfstune $tuneopt $TEST_DEV
+ if ! run_check_stdout $TOP/btrfs-show-super $TEST_DEV | \
+ grep -q "$sbflag"; then
+ _fail "FAIL: feature $sbflag not set"
+ fi
+ run_check $SUDO_HELPER $TOP/btrfs check $TEST_DEV
+}
+
+test_feature extref -r EXTENDED_IREF
+test_feature skinny-metadata -x SKINNY_METADATA
+test_feature no-holes -n NO_HOLES
+test_feature '' '-S 1' SEEDING