mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-26 16:12:34 +00:00
f6bbe06c08
Executing the script inside the directories as './test.sh' is not supposed to work but could happen accidentally. With an exit after attempting to source the we can fix that. Signed-off-by: David Sterba <dsterba@suse.com>
36 lines
949 B
Bash
Executable File
36 lines
949 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Test creating images with all supported checksums followed by mount
|
|
|
|
source "$TEST_TOP/common" || exit
|
|
|
|
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_mount_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"
|
|
|
|
run_check_mount_test_dev
|
|
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_umount_test_dev
|
|
}
|
|
|
|
for csum in $(cat /sys/fs/btrfs/features/supported_checksums); do
|
|
test_mkfs_mount_checksum "$csum"
|
|
done
|