From f529d6472e09066ab8a2fd8e730f1e8c2acf04d8 Mon Sep 17 00:00:00 2001 From: Tsutomu Itoh Date: Wed, 9 Nov 2016 13:44:15 +0900 Subject: [PATCH] btrfs-progs: tests: add checking of send multiple clone source option Sending stream size of clone-src(-c) option is checked. Fixed by "btrfs-progs: send: fix handling of -c option". Signed-off-by: Tsutomu Itoh Signed-off-by: David Sterba --- .../multi-clone-src-v4.8.2.stream.xz | Bin 0 -> 2688 bytes tests/misc-tests/016-send-clone-src/test.sh | 50 ++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 tests/misc-tests/016-send-clone-src/multi-clone-src-v4.8.2.stream.xz create mode 100755 tests/misc-tests/016-send-clone-src/test.sh diff --git a/tests/misc-tests/016-send-clone-src/multi-clone-src-v4.8.2.stream.xz b/tests/misc-tests/016-send-clone-src/multi-clone-src-v4.8.2.stream.xz new file mode 100644 index 0000000000000000000000000000000000000000..34c14ed596f8b31948b4f3606a7ae79df85d2a1f GIT binary patch literal 2688 zcmV-`3V-$eH+ooF000E$*0e?f03iV!0000G&sfa={{jRkT>vp13XGw}P}F=IbdLR( z>U`@RGx=%Bf*|k3$jJy%THm;Wk-9RmSWbur;^k9E?|~A!S2QuCgFk;n&JQd{4F*4E zFI0vj=nUOa*@|S5r6xs53<@Yy$y4-(#>*jGZNIP3fN_~zwEtc1w#!5Ik`VN)vFFa^ zToG*)&*0ktd+YRpseERjPpN&icQVZ8&U`az|8SMEPqAp-@C!Y`aGaF8nJiuIBka0f zky~XqkF*D^0UaV0)5)dG(6l_UlZoIXHkSf2c+(-v>iiV8z&wFcR5Vq4GHyQ0DD%S) zxbYLN`twE4uoQl=I)ei(u?B6%-(l&+qyFx{bKNLGWbF_k6Cf3>M@6?D^FLu#)|yH{ zm7X@XgN*Y}GD&NztqK_bDq2O1`}EL#!Uu^|t;a4@Tdx9ffG~KeosNXQ1|E*hp72C zJ36spFpp0RdYtNo98om-l;~!*I=P6D(7NmWoC(kL;bJ%lKqO@$P6Dy@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YcH8{827i7gu9(WVaJzO4LtYK!Xv{2RI85P6QY?X}= z`be-`@K^4DDdQnkSH|#7`KdsP22qe{r_rjajEdU#fFxOoE==~|ucm%S%4Ri^e_(jp zEfWVF@>mf};En!(A>sfn0PV?-=qILsd u>IZ0nU%eAb;Q#>2gS|{s6sUjz0o)XV!GHt(a(+g!#Ao{g000001X)_J6DtG& literal 0 HcmV?d00001 diff --git a/tests/misc-tests/016-send-clone-src/test.sh b/tests/misc-tests/016-send-clone-src/test.sh new file mode 100755 index 00000000..e256eef9 --- /dev/null +++ b/tests/misc-tests/016-send-clone-src/test.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# test for sending stream size of clone-src option, compare against a send +# stream generated by buggy version + +source $TOP/tests/common + +check_prereq mkfs.btrfs +check_prereq btrfs + +setup_root_helper +prepare_test_dev 1g + +run_check $TOP/mkfs.btrfs -f $IMAGE +run_check_mount_test_dev + +here=`pwd` +cd "$TEST_MNT" || _fail "cannot chdir to TEST_MNT" + +run_check $SUDO_HELPER $TOP/btrfs subvolume create subv-parent1 +for i in 1 2 3; do + run_check $SUDO_HELPER dd if=/dev/zero of=subv-parent1/file1_$i bs=1M count=1 + run_check $SUDO_HELPER $TOP/btrfs subvolume snapshot -r subv-parent1 subv-snap1_$i +done + +run_check $SUDO_HELPER $TOP/btrfs subvolume create subv-parent2 +for i in 1 2 3; do + run_check $SUDO_HELPER dd if=/dev/zero of=subv-parent2/file2_$i bs=1M count=1 + run_check $SUDO_HELPER $TOP/btrfs subvolume snapshot -r subv-parent2 subv-snap2_$i +done + +truncate -s0 "$here"/send-stream.img +chmod a+w "$here"/send-stream.img +run_check $SUDO_HELPER $TOP/btrfs send -f "$here"/send-stream.img \ + -c subv-snap1_1 -c subv-snap2_1 subv-snap1_[23] subv-snap2_[23] + +image=$(extract_image "$here"/multi-clone-src-v4.8.2.stream.xz) +old_stream_size=`stat --format=%s "$image"` +stream_size=`stat --format=%s "$here"/send-stream.img` + +if [ $old_stream_size -lt $stream_size ]; then + run_check ls -l "$image" "$here"/send-stream.img + _fail "sending stream size is bigger than old stream" +fi + +run_check rm -f -- "$image" "$here"/send-stream.img + +cd "$here" || _fail "cannot chdir back to test directory" + +run_check_umount_test_dev