bc6b5ea65651041f76c2034cf07e93f24e3fb4cf
[platform/upstream/btrfs-progs.git] / tests / convert-tests / 004-ext2-backup-superblock-ranges / test.sh
1 #!/bin/bash
2
3 # Specially created e2image dump to test backup superblock migration for
4 # new convert.
5 # These images will cause the following problems if convert doesn't handle
6 # backup superblock migration well:
7 # 1) Assert while building free space tree
8 # 2) Error copying inodes
9 # 3) Discontinuous file extents after convert
10 # 4) Overlap file extents
11 # 5) Unable to rollback
12
13 source $TOP/tests/common
14
15 check_prereq btrfs-convert
16 check_prereq btrfs
17 check_prereq btrfs-show-super
18 check_global_prereq e2fsck
19 check_global_prereq xzcat
20
21 setup_root_helper
22 prepare_test_dev 512M
23
24 for src in $(find . -iname "*.e2image.raw.xz"); do
25         TEST_DEV=$(extract_image "$src")
26         run_check e2fsck -n -f $TEST_DEV
27         run_check $TOP/btrfs-convert $TEST_DEV
28         run_check $TOP/btrfs check $TEST_DEV
29         run_check $TOP/btrfs-show-super $TEST_DEV
30
31         run_check_mount_test_dev
32         run_check $SUDO_HELPER e2fsck -n -f $TEST_MNT/ext2_saved/image
33         run_check $SUDO_HELPER umount $TEST_MNT
34
35         run_check $TOP/btrfs check $TEST_DEV
36         run_check $TOP/btrfs-convert -r $TEST_DEV
37         run_check e2fsck -n -f $TEST_DEV
38
39         rm -f $TEST_DEV
40 done