diff mbox series

[2/2] btrfs-progs: tests/misc: add a test case for csum change

Message ID 0d8e9a8dd3b9ba9d91a9ae826565c1a324218ba0.1684802060.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: tune: fix the leftover csum change item and add a test case for it | expand

Commit Message

Qu Wenruo May 23, 2023, 12:37 a.m. UTC
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
diff mbox series

Patch

diff --git a/tests/misc-tests/058-btrfstune-csum-change/test.sh b/tests/misc-tests/058-btrfstune-csum-change/test.sh
new file mode 100755
index 000000000000..925e71b86285
--- /dev/null
+++ b/tests/misc-tests/058-btrfstune-csum-change/test.sh
@@ -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