btrfs-progs/tests/mkfs-tests/019-basic-checksums-mkfs/test.sh
Marcos Paulo de Souza da04a62697 btrfs-progs: mkfs-tests: only check supported checksums
Don't hardcode the supported checksums and use the list provided by the
kernel module. The status check of support is moved to the top of the
script so it's more visible.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
[ move checks ]
Signed-off-by: David Sterba <dsterba@suse.com>
2020-03-03 19:58:54 +01:00

30 lines
706 B
Bash
Executable File

#!/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
if ! [ -f "/sys/fs/btrfs/features/supported_checksums" ]; then
_not_run "kernel support for checksums missing"
fi
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"
}
for csum in $(cat /sys/fs/btrfs/features/supported_checksums); do
test_mkfs_checksum "$csum"
done