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
21 check_global_prereq perl
23 perl -e "print 'a'x8192;" > input
24 perl -e "print 'b'x8192;" > input2
26 default_mkfs="mkreiserfs -b 4096"
27 convert_test_preamble '' 'tail conversion test' 16k "$default_mkfs"
28 convert_test_prep_fs reiserfs $default_mkfs
31 run_check $SUDO_HELPER truncate -s 81920 "$TEST_MNT/hole"
34 run_check $SUDO_HELPER dd if=input of="$TEST_MNT/1k" bs=1k count=1 \
37 # Single indirect block
38 run_check $SUDO_HELPER dd if=input of="$TEST_MNT/4k" bs=1k count=4 \
41 # Indirect block + tail
42 run_check $SUDO_HELPER dd if=input of="$TEST_MNT/5k" bs=1k count=4 \
44 run_check $SUDO_HELPER dd if=input2 of="$TEST_MNT/5k" bs=1k count=1 \
45 seek=4 > /dev/null 2>&1
47 # Hole followed by tail
48 run_check $SUDO_HELPER dd if=input of="$TEST_MNT/hole-1k" bs=1k count=1 \
49 seek=4 > /dev/null 2>&1
51 # Indirect block followed by hole
52 run_check $SUDO_HELPER dd if=input of="$TEST_MNT/4k-hole" bs=1k count=4 \
54 run_check $SUDO_HELPER truncate -s 81920 "$TEST_MNT/4k-hole"
56 # Indirect block followed by hole followed by tail
57 run_check $SUDO_HELPER dd if=input of="$TEST_MNT/4k-hole-1k" bs=1k count=4 \
59 run_check $SUDO_HELPER truncate -s 8192 "$TEST_MNT/4k-hole-1k"
60 run_check $SUDO_HELPER dd if=input2 of="$TEST_MNT/4k-hole-1k" bs=1k count=1 \
61 seek=8 > /dev/null 2>&1
66 for file in "$TEST_MNT"/*; do
71 run_check_umount_test_dev
72 convert_test_do_convert
74 run_check_mount_test_dev
75 for file in "${!SUMS[@]}"; do
77 run_check test "$SUM" = "${SUMS[$file]}"
79 run_check_umount_test_dev