mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-25 07:32:22 +00:00
btrfs-progs: tests: add tests for checksums
Add separate tests for basic coverage of new checksum algorithms. It comes in two parts to do a full mkfs test and also a condition mount test. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
b475a46f4d
commit
95117cbd4a
26
tests/mkfs-tests/019-basic-checksums-mkfs/test.sh
Executable file
26
tests/mkfs-tests/019-basic-checksums-mkfs/test.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Test creating images with all supported checksums, mount checks are separate
|
||||
|
||||
source "$TEST_TOP/common"
|
||||
|
||||
check_prereq mkfs.btrfs
|
||||
check_prereq btrfs
|
||||
|
||||
setup_root_helper
|
||||
prepare_test_dev
|
||||
|
||||
test_mkfs_checksum()
|
||||
{
|
||||
local csum
|
||||
|
||||
csum="$1"
|
||||
run_check_stdout $SUDO_HELPER "$TOP/mkfs.btrfs" -f --csum "$csum" "$TEST_DEV" | grep -q "Checksum:.*$csum"
|
||||
run_check $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV"
|
||||
run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
|
||||
}
|
||||
|
||||
test_mkfs_checksum crc32c
|
||||
test_mkfs_checksum xxhash
|
||||
test_mkfs_checksum sha256
|
||||
test_mkfs_checksum blake2
|
33
tests/mkfs-tests/020-basic-checksums-mount/test.sh
Executable file
33
tests/mkfs-tests/020-basic-checksums-mount/test.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Test creating images with all supported checksums followed by mount
|
||||
|
||||
source "$TEST_TOP/common"
|
||||
|
||||
check_prereq mkfs.btrfs
|
||||
check_prereq btrfs
|
||||
|
||||
setup_root_helper
|
||||
prepare_test_dev
|
||||
|
||||
test_mkfs_mount_checksum()
|
||||
{
|
||||
run_check_stdout $SUDO_HELPER "$TOP/mkfs.btrfs" -f --csum "$csum" "$TEST_DEV" | grep -q "Checksum:.*$csum"
|
||||
run_check $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV"
|
||||
run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
|
||||
|
||||
run_check $SUDO_HELPER mount "$dev1" "$TEST_MNT"
|
||||
run_check "$TOP/btrfs" filesystem df "$TEST_MNT"
|
||||
run_check $SUDO_HELPER "$TOP/btrfs" filesystem usage "$TEST_MNT"
|
||||
run_check $SUDO_HELPER "$TOP/btrfs" device usage "$TEST_MNT"
|
||||
run_check $SUDO_HELPER umount "$TEST_MNT"
|
||||
}
|
||||
|
||||
if ! [ -f "/sys/fs/btrfs/features/supported_checksums" ]; then
|
||||
_not_run "kernel support for checksums missing"
|
||||
fi
|
||||
|
||||
test_mkfs_mount_checksum crc32c
|
||||
test_mkfs_mount_checksum xxhash
|
||||
test_mkfs_mount_checksum sha256
|
||||
test_mkfs_mount_checksum blake2
|
Loading…
Reference in New Issue
Block a user