All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
To: linux-btrfs@vger.kernel.org, dsterba@suse.cz
Subject: [PATCH] btrfs-progs: send-test: add checking of clone-src option
Date: Fri, 04 Nov 2016 17:35:18 +0900	[thread overview]
Message-ID: <201611040835.AA00012@WIN-5MHF4RKU941.jp.fujitsu.com> (raw)
In-Reply-To: <201610190235.AA00003@WIN-5MHF4RKU941.jp.fujitsu.com>

Sending stream size of clone-src(-c) option is checked.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
---
 tests/misc-tests/016-send-clone-src/test.sh | 54 +++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100755 tests/misc-tests/016-send-clone-src/test.sh

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..dddd16d
--- /dev/null
+++ b/tests/misc-tests/016-send-clone-src/test.sh
@@ -0,0 +1,54 @@
+#!/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 2g
+
+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 btrfs subvolume create subv-parent1
+run_check $SUDO_HELPER dd if=/dev/urandom of=subv-parent1/file1_1 bs=1M count=10
+run_check $SUDO_HELPER btrfs subvolume snapshot -r subv-parent1 subv-snap1_1
+run_check $SUDO_HELPER dd if=/dev/urandom of=subv-parent1/file1_2 bs=1M count=10
+run_check $SUDO_HELPER btrfs subvolume snapshot -r subv-parent1 subv-snap1_2
+run_check $SUDO_HELPER dd if=/dev/urandom of=subv-parent1/file1_3 bs=1M count=10
+run_check $SUDO_HELPER btrfs subvolume snapshot -r subv-parent1 subv-snap1_3
+
+run_check $SUDO_HELPER btrfs subvolume create subv-parent2
+run_check $SUDO_HELPER dd if=/dev/urandom of=subv-parent2/file2_1 bs=1M count=10
+run_check $SUDO_HELPER btrfs subvolume snapshot -r subv-parent2 subv-snap2_1
+run_check $SUDO_HELPER dd if=/dev/urandom of=subv-parent2/file2_2 bs=1M count=10
+run_check $SUDO_HELPER btrfs subvolume snapshot -r subv-parent2 subv-snap2_2
+run_check $SUDO_HELPER dd if=/dev/urandom of=subv-parent2/file2_3 bs=1M count=10
+run_check $SUDO_HELPER btrfs subvolume snapshot -r subv-parent2 subv-snap2_3
+
+run_check $SUDO_HELPER btrfs send -f "$here"/send.stream.before \
+	-c subv-snap1_1 -c subv-snap2_1 subv-snap1_[23] subv-snap2_[23]
+
+run_check $SUDO_HELPER $TOP/btrfs send -f "$here"/send.stream.after \
+	-c subv-snap1_1 -c subv-snap2_1 subv-snap1_[23] subv-snap2_[23]
+
+before_size=`ls -l "$here"/send.stream.before | awk '{print $5}'`
+after_size=`ls -l "$here"/send.stream.after | awk '{print $5}'`
+
+if [ $before_size -lt $after_size ]; then
+	run_check ls -l "$here"/send.stream.*
+	_fail "sending stream size is bigger than old stream"
+fi
+
+run_check rm -f "$here"/send.stream.*
+
+cd "$here" || _fail "cannot chdir back to test directory"
+
+run_check_umount_test_dev
+
-- 
2.9.3

  parent reply	other threads:[~2016-11-04  8:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19  2:35 [PATCH 3/3] btrfs-progs: send: fix handling of -c option Tsutomu Itoh
2016-11-02 12:22 ` David Sterba
2016-11-04  2:10   ` Tsutomu Itoh
2016-11-04  8:33 ` [PATCH v2 " Tsutomu Itoh
2016-11-07 15:57   ` David Sterba
2016-11-04  8:35 ` Tsutomu Itoh [this message]
2016-11-07 15:16   ` [PATCH] btrfs-progs: send-test: add checking of clone-src option David Sterba
2016-11-09  1:25   ` [PATCH v2] " Tsutomu Itoh
2016-11-09  1:39     ` Qu Wenruo
2016-11-09  1:57       ` Tsutomu Itoh
2016-11-09  4:44   ` [PATCH v3] " Tsutomu Itoh
2016-11-09 10:49     ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201611040835.AA00012@WIN-5MHF4RKU941.jp.fujitsu.com \
    --to=t-itoh@jp.fujitsu.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.