diff mbox series

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

Message ID 5a92af80237ac06efc5223a9f42094d51404761b.1718693318.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: fix csum metadata reservation and add a basic test case for itb | expand

Commit Message

Qu Wenruo June 18, 2024, 6:50 a.m. UTC
The new test case would:

- Create a btrfs with crc32c csum
- Populate the fs
- Convert the fs to the following csums:
  * xxhash
  * blake2
  * sha256
  * crc32c

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 .../064-csum-conversion-basic/test.sh         | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100755 tests/misc-tests/064-csum-conversion-basic/test.sh
diff mbox series

Patch

diff --git a/tests/misc-tests/064-csum-conversion-basic/test.sh b/tests/misc-tests/064-csum-conversion-basic/test.sh
new file mode 100755
index 000000000000..2f8be0e9b324
--- /dev/null
+++ b/tests/misc-tests/064-csum-conversion-basic/test.sh
@@ -0,0 +1,32 @@ 
+#!/bin/bash
+#
+# Verify the csum conversion works as expected.
+#
+source "$TEST_TOP/common" || exit
+source "$TEST_TOP/common.convert" || exit
+
+check_experimental_build
+setup_root_helper
+prepare_test_dev
+
+convert_to_csum()
+{
+	local new_csum=$1
+
+	run_check "$TOP/btrfstune" --csum "$new_csum" "$TEST_DEV"
+	run_check "$TOP/btrfs" check --check-data-csum "$TEST_DEV"
+}
+
+run_check_mkfs_test_dev --csum crc32c
+
+# We only mount the fs once to populate its contents,
+# later one we would never mount the fs (to reduce the dependency on
+# kernel features).
+run_check_mount_test_dev
+populate_fs
+run_check_umount_test_dev
+
+convert_to_csum xxhash
+convert_to_csum blake2
+convert_to_csum sha256
+convert_to_csum crc32c