btrfs-progs/tests/fsck-tests/028-unaligned-super-dev-sizes/test.sh
Gu Jinxiang cebf3b3722 btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests
Use TEST_TOP as base for tests to reference any files, this will be used
for git and external testsuite.

INTERNAL_BIN is needed for referencing binaries that could reside in
different paths in git vs external testsuite.

Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
[ add quotes around sourced files, update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
2018-02-13 15:41:32 +01:00

26 lines
645 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"
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"