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>
This commit is contained in:
Marcos Paulo de Souza 2020-02-10 13:43:00 -03:00 committed by David Sterba
parent 015402b847
commit da04a62697
2 changed files with 14 additions and 12 deletions

View File

@ -10,6 +10,10 @@ 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
@ -20,7 +24,6 @@ test_mkfs_checksum()
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
for csum in $(cat /sys/fs/btrfs/features/supported_checksums); do
test_mkfs_checksum "$csum"
done

View File

@ -10,6 +10,10 @@ 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_mount_checksum()
{
local csum
@ -26,11 +30,6 @@ test_mkfs_mount_checksum()
run_check_umount_test_dev
}
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
for csum in $(cat /sys/fs/btrfs/features/supported_checksums); do
test_mkfs_mount_checksum "$csum"
done