[v3] btrfs-progs: send-test: add checking of clone-src option
diff mbox

Message ID 201611090444.AA00014@WIN-5MHF4RKU941.jp.fujitsu.com
State New
Headers show

Commit Message

Tsutomu Itoh Nov. 9, 2016, 4:44 a.m. UTC
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 <t-itoh@jp.fujitsu.com>
---
V2: old sending stream image is used
V3: image file has been compressed by gzip
---
 .../016-send-clone-src/send-stream-v4.8.2.img.gz   | Bin 0 -> 11826 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/send-stream-v4.8.2.img.gz
 create mode 100755 tests/misc-tests/016-send-clone-src/test.sh

Comments

David Sterba Nov. 9, 2016, 10:49 a.m. UTC | #1
On Wed, Nov 09, 2016 at 01:44:15PM +0900, Tsutomu Itoh wrote:
> V2: old sending stream image is used
> V3: image file has been compressed by gzip

Thanks. Should be compressed by 'xz -9', the result is now 2k instead of
11k. The extract_image now understands compressed streams. Test script
updated.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/tests/misc-tests/016-send-clone-src/send-stream-v4.8.2.img.gz b/tests/misc-tests/016-send-clone-src/send-stream-v4.8.2.img.gz
new file mode 100644
index 0000000000000000000000000000000000000000..f49c5cba1a8307f99732530ab8613f4a22902b9d
GIT binary patch
literal 11826
zcmeI2ZBSEJ8plz$(rwqq-EN!dR!O%VWvxh5gzzS5*KJv)lBuZZfP_^MD@uR}F_7d+
zU1eM>8KH^_N!r!QD3T~xUJQ9@sUlSpkU~Tt;VlG62!xP?yxqGuAtku(EKTyQ17Da6
zcb+-tx&L#X|MNQsmH+a~*ABnC$7=~ODfQqw;_-~6e;iwvwaGu&f203r$CACqx{tN2
zQhew$oD;FBXZ-OV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7iQ!E#n=ft}$xwlNRdQDb`zq@E*-PAFUE-VIPgVPP>eQVi^KZar^3
zf){wsi}$)diRRGDwP%ntB}Dq~8&ond4{IiQFK)ap{HQ%w19o1q^b5!`p7-~$x0WDZ
v+xNTfI}y?Hq}T-WM6U2`>EqKmgxVZznz$<u`CoUafJGAYg)^VOlj!vy0fdTo

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 0000000..3a61db7
--- /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
+
+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]
+
+gunzip -c "$here"/send-stream-v4.8.2.img.gz > "$here"/old-send-stream.img
+old_stream_size=`stat --format=%s "$here"/old-send-stream.img`
+stream_size=`stat --format=%s "$here"/send-stream.img`
+
+if [ $old_stream_size -lt $stream_size ]; then
+	run_check ls -l "$here"/old-send-stream.img "$here"/send-stream.img
+	_fail "sending stream size is bigger than old stream"
+fi
+
+run_check rm -f "$here"/old-send-stream.img "$here"/send-stream.img
+
+cd "$here" || _fail "cannot chdir back to test directory"
+
+run_check_umount_test_dev
+