mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-12-01 16:14:20 +08:00
btrfs-progs: convert-tests: Add test case for backup superblock migration
New convert introduced simpler chunk/extent allocation algorithm, at the cost of complex backup superblock migration codes. Use specially built ext2 images to test if btrfs-convert can convert and rollback images without problem. All these special ext2 image have blocks/holes across 2nd btrfs backup superblock. The naming of test image is like the following: |<------superblock migration range----->| 64M 64M + 64K |-Data--|-Data--|/Hole//|-Data--|/Hole//|-Data--|--Data--| = drdhdhdrd These test cases should check all typical layouts and make sure new convert works. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
fde5ae2e49
commit
dc4bbc37a1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
39
tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh
Executable file
39
tests/convert-tests/004-ext2-backup-superblock-ranges/test.sh
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Specially created e2image dump to test backup superblock migration for
|
||||
# new convert.
|
||||
# These images will cause the following problems if convert doesn't handle
|
||||
# backup superblock migration well:
|
||||
# 1) Assert while building free space tree
|
||||
# 2) Error copying inodes
|
||||
# 3) Discontinuous file extents after convert
|
||||
# 4) Overlap file extents
|
||||
# 5) Unable to rollback
|
||||
|
||||
source $TOP/tests/common
|
||||
|
||||
check_prereq btrfs-convert
|
||||
check_prereq btrfs
|
||||
check_prereq btrfs-show-super
|
||||
check_global_prereq e2fsck
|
||||
check_global_prereq xzcat
|
||||
|
||||
setup_root_helper
|
||||
prepare_test_dev 512M
|
||||
|
||||
for src in $(find . -iname "*.e2image.raw.xz"); do
|
||||
extracted=$(extract_image "$src")
|
||||
run_check $SUDO_HELPER e2fsck -n -f $extracted
|
||||
run_check $SUDO_HELPER $TOP/btrfs-convert $extracted
|
||||
run_check $SUDO_HELPER $TOP/btrfs check $extracted
|
||||
run_check $SUDO_HELPER $TOP/btrfs-show-super $extracted
|
||||
|
||||
run_check $SUDO_HELPER mount -o loop $extracted $TEST_MNT
|
||||
run_check $SUDO_HELPER e2fsck -n -f $TEST_MNT/ext2_saved/image
|
||||
run_check $SUDO_HELPER umount $TEST_MNT
|
||||
|
||||
run_check $SUDO_HELPER $TOP/btrfs check $extracted
|
||||
run_check $SUDO_HELPER $TOP/btrfs-convert -r $extracted
|
||||
run_check $SUDO_HELPER e2fsck -n -f $extracted
|
||||
rm -f $extracted
|
||||
done
|
Loading…
Reference in New Issue
Block a user