new file mode 100755
@@ -0,0 +1,26 @@
+#!/bin/bash
+# Test btrfstune --csum option
+
+source "$TEST_TOP/common" || exit
+source "$TEST_TOP/common.convert" || exit
+
+check_prereq mkfs.btrfs
+check_prereq btrfstune
+check_prereq btrfs
+
+setup_root_helper
+prepare_test_dev
+
+run_check_mkfs_test_dev --csum crc32c
+run_check_mount_test_dev
+populate_fs
+run_check_umount_test_dev
+
+for hash in "blake2" "crc32c" "xxhash" "sha256"; do
+ run_check $SUDO_HELPER "$TOP/btrfstune" --csum $hash "$TEST_DEV"
+ run_check $SUDO_HELPER "$TOP/btrfs" check --check-data-csum "$TEST_DEV"
+done
+for hash in "blake2" "crc32c" "xxhash" "sha256"; do
+ run_check $SUDO_HELPER "$TOP/btrfstune" --csum $hash "$TEST_DEV"
+ run_check $SUDO_HELPER "$TOP/btrfs" check --check-data-csum "$TEST_DEV"
+done
The test case would: - Populate the fs - Run csum change for all the target csum type - Run above csum change again This should more or less cover the common paths, and detect any conflicting csum change item. Signed-off-by: Qu Wenruo <wqu@suse.com> --- .../058-btrfstune-csum-change/test.sh | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 tests/misc-tests/058-btrfstune-csum-change/test.sh