btrfs-progs/tests/fsck-tests/028-unaligned-super-dev-sizes/test.sh
David Sterba 3e7cc11ecb btrfs-progs: tests: add missing protection against running out of test suite
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. Not all cases have been fixed
in f6bbe06c08 ("btrfs-progs: tests: add protection against running
out of test suite").

Signed-off-by: David Sterba <dsterba@suse.com>
2024-06-03 22:37:53 +02:00

26 lines
653 B
Bash
Executable File

#!/bin/bash
#
# An image with mis-aligned superblock total_bytes, that will be found and
# fixed by 'check' or fixed by 'rescue fix-device-size'
source "$TEST_TOP/common" || exit
check_prereq btrfs
setup_root_helper
check_all_images
TEST_DEV=$(extract_image "./dev_and_super_mismatch_unaligned.raw.xz")
# detect and fix
run_check "$TOP/btrfs" rescue fix-device-size "$TEST_DEV"
# no problem found
run_check "$TOP/btrfs" rescue fix-device-size "$TEST_DEV"
# check if fix-device-size worked
run_check "$TOP/btrfs" check "$TEST_DEV"
# mount test
run_check_mount_test_dev
run_check_umount_test_dev "$TEST_MNT"
# remove restored image
rm -- "$TEST_DEV"