3 # test for sending stream size of clone-src option, compare against a send
4 # stream generated by buggy version
6 source $TOP/tests/common
8 check_prereq mkfs.btrfs
14 run_check "$TOP/mkfs.btrfs" -f "$TEST_DEV"
15 run_check_mount_test_dev
18 cd "$TEST_MNT" || _fail "cannot chdir to TEST_MNT"
20 run_check $SUDO_HELPER $TOP/btrfs subvolume create subv-parent1
22 run_check $SUDO_HELPER dd if=/dev/zero of=subv-parent1/file1_$i bs=1M count=1
23 run_check $SUDO_HELPER $TOP/btrfs subvolume snapshot -r subv-parent1 subv-snap1_$i
26 run_check $SUDO_HELPER $TOP/btrfs subvolume create subv-parent2
28 run_check $SUDO_HELPER dd if=/dev/zero of=subv-parent2/file2_$i bs=1M count=1
29 run_check $SUDO_HELPER $TOP/btrfs subvolume snapshot -r subv-parent2 subv-snap2_$i
32 truncate -s0 "$here"/send-stream.img
33 chmod a+w "$here"/send-stream.img
34 run_check $SUDO_HELPER $TOP/btrfs send -f "$here"/send-stream.img \
35 -c subv-snap1_1 -c subv-snap2_1 subv-snap1_[23] subv-snap2_[23]
37 image=$(extract_image "$here"/multi-clone-src-v4.8.2.stream.xz)
38 old_stream_size=`stat --format=%s "$image"`
39 stream_size=`stat --format=%s "$here"/send-stream.img`
41 if [ $old_stream_size -lt $stream_size ]; then
42 run_check ls -l "$image" "$here"/send-stream.img
43 _fail "sending stream size is bigger than old stream"
46 run_check rm -f -- "$image" "$here"/send-stream.img
48 cd "$here" || _fail "cannot chdir back to test directory"
50 run_check_umount_test_dev