2 # Check the various combinations of real blocks, holes, and tails
3 # Since it's possible to have a valid extent layout that check will
4 # happily accept AND have garbage in the output, compare the results
6 # We use separate inputs for tails and real blocks so we can determine
7 # if there was a failure in copying either.
9 source "$TEST_TOP/common"
10 source "$TEST_TOP/common.convert"
12 if ! check_kernel_support_reiserfs >/dev/null; then
13 _not_run "no reiserfs support"
18 check_prereq btrfs-convert
19 check_global_prereq md5sum
20 check_global_prereq mkreiserfs
22 printf "%0.sa" {1..8192} > input
23 printf "%0.sb" {1..8192} > input2
25 default_mkfs="mkreiserfs -b 4096"
26 convert_test_preamble '' 'tail conversion test' 16k "$default_mkfs"
27 convert_test_prep_fs reiserfs $default_mkfs
30 run_check $SUDO_HELPER truncate -s 81920 "$TEST_MNT/hole"
33 run_check $SUDO_HELPER dd if=input of="$TEST_MNT/1k" bs=1k count=1 \
36 # Single indirect block
37 run_check $SUDO_HELPER dd if=input of="$TEST_MNT/4k" bs=1k count=4 \
40 # Indirect block + tail
41 run_check $SUDO_HELPER dd if=input of="$TEST_MNT/5k" bs=1k count=4 \
43 run_check $SUDO_HELPER dd if=input2 of="$TEST_MNT/5k" bs=1k count=1 \
44 seek=4 > /dev/null 2>&1
46 # Hole followed by tail
47 run_check $SUDO_HELPER dd if=input of="$TEST_MNT/hole-1k" bs=1k count=1 \
48 seek=4 > /dev/null 2>&1
50 # Indirect block followed by hole
51 run_check $SUDO_HELPER dd if=input of="$TEST_MNT/4k-hole" bs=1k count=4 \
53 run_check $SUDO_HELPER truncate -s 81920 "$TEST_MNT/4k-hole"
55 # Indirect block followed by hole followed by tail
56 run_check $SUDO_HELPER dd if=input of="$TEST_MNT/4k-hole-1k" bs=1k count=4 \
58 run_check $SUDO_HELPER truncate -s 8192 "$TEST_MNT/4k-hole-1k"
59 run_check $SUDO_HELPER dd if=input2 of="$TEST_MNT/4k-hole-1k" bs=1k count=1 \
60 seek=8 > /dev/null 2>&1
65 for file in "$TEST_MNT"/*; do
70 run_check_umount_test_dev
71 convert_test_do_convert
73 run_check_mount_test_dev
74 for file in "${!SUMS[@]}"; do
76 run_check test "$SUM" = "${SUMS[$file]}"
78 run_check_umount_test_dev