All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] btrfs-progs: test for restoring multiple devices fs into a single device
@ 2017-05-17  1:41 fdmanana
  2017-05-19  0:18 ` Liu Bo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: fdmanana @ 2017-05-17  1:41 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

Test that we are able to create an image from a multiple devices fs, that
we are able to restore that image into a single device and finally that we
are able to mount it.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 tests/misc-tests/020-image-multi-devices/test.sh | 49 ++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100755 tests/misc-tests/020-image-multi-devices/test.sh

diff --git a/tests/misc-tests/020-image-multi-devices/test.sh b/tests/misc-tests/020-image-multi-devices/test.sh
new file mode 100755
index 00000000..d4a5f006
--- /dev/null
+++ b/tests/misc-tests/020-image-multi-devices/test.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+# Test btrfs-image with multiple devices filesystem and verify that restoring
+# the created image works against a single device.
+
+source $TOP/tests/common
+
+check_prereq btrfs-image
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+setup_root_helper
+
+rm -f dev1 dev2
+run_check truncate -s 2G dev1
+run_check truncate -s 2G dev2
+
+loop1=$(run_check_stdout $SUDO_HELPER losetup --find --show dev1)
+loop2=$(run_check_stdout $SUDO_HELPER losetup --find --show dev2)
+
+# Create the test file system.
+
+run_check $SUDO_HELPER $TOP/mkfs.btrfs -f $loop1 $loop2
+run_check $SUDO_HELPER mount $loop1 $TEST_MNT
+run_check $SUDO_HELPER dd bs=1M count=1 if=/dev/zero of=$TEST_MNT/foobar
+orig_md5=$(run_check_stdout md5sum $TEST_MNT/foobar | cut -d ' ' -f 1)
+run_check $SUDO_HELPER umount $TEST_MNT
+
+# Create the image to restore later.
+run_check $SUDO_HELPER $TOP/btrfs-image $loop1 $IMAGE
+
+# Wipe out the filesystem from the devices, restore the image on a single
+# device, check everything works and file foobar is there and with 1Mb of
+# zeroes.
+run_check $SUDO_HELPER wipefs -a $loop1
+run_check $SUDO_HELPER wipefs -a $loop2
+
+run_check $SUDO_HELPER $TOP/btrfs-image -r $IMAGE $loop1
+
+run_check $SUDO_HELPER mount $loop1 $TEST_MNT
+new_md5=$(run_check_stdout md5sum $TEST_MNT/foobar | cut -d ' ' -f 1)
+run_check $SUDO_HELPER umount $TEST_MNT
+
+# Cleanup loop devices.
+run_check $SUDO_HELPER losetup -d $loop1
+run_check $SUDO_HELPER losetup -d $loop2
+rm -f dev1 dev2
+
+# Compare the file digests.
+[ $orig_md5 == $new_md5 ] || _fail "File digests do not match"
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] btrfs-progs: test for restoring multiple devices fs into a single device
  2017-05-17  1:41 [PATCH 2/2] btrfs-progs: test for restoring multiple devices fs into a single device fdmanana
@ 2017-05-19  0:18 ` Liu Bo
  2017-05-19  6:59 ` Lakshmipathi.G
  2017-05-29 17:01 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Liu Bo @ 2017-05-19  0:18 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

On Wed, May 17, 2017 at 02:41:31AM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Test that we are able to create an image from a multiple devices fs, that
> we are able to restore that image into a single device and finally that we
> are able to mount it.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Liu Bo <bo.li.liu@oracle.com>

Thanks,

-liubo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] btrfs-progs: test for restoring multiple devices fs into a single device
  2017-05-17  1:41 [PATCH 2/2] btrfs-progs: test for restoring multiple devices fs into a single device fdmanana
  2017-05-19  0:18 ` Liu Bo
@ 2017-05-19  6:59 ` Lakshmipathi.G
  2017-05-29 17:01 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Lakshmipathi.G @ 2017-05-19  6:59 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

Looks fine, just couple of minor feedback.

> +run_check $SUDO_HELPER $TOP/mkfs.btrfs -f $loop1 $loop2

Please add quotation around variable in the script, as suggested in
tests/README.md 'Coding style, best practices' section. This section
is added recently, we are updating older scripts.

> +
> +# Cleanup loop devices.
> +run_check $SUDO_HELPER losetup -d $loop1
> +run_check $SUDO_HELPER losetup -d $loop2
> +rm -f dev1 dev2
> +
> +# Compare the file digests.
> +[ $orig_md5 == $new_md5 ] || _fail "File digests do not match"

"Cleanup loop devices" can be done after comparing file integrity?
This way, if integrity fails, the setup will be there to debug
further. thanks.

-- 
----
Cheers,
Lakshmipathi.G

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] btrfs-progs: test for restoring multiple devices fs into a single device
  2017-05-17  1:41 [PATCH 2/2] btrfs-progs: test for restoring multiple devices fs into a single device fdmanana
  2017-05-19  0:18 ` Liu Bo
  2017-05-19  6:59 ` Lakshmipathi.G
@ 2017-05-29 17:01 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2017-05-29 17:01 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

On Wed, May 17, 2017 at 02:41:31AM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Test that we are able to create an image from a multiple devices fs, that
> we are able to restore that image into a single device and finally that we
> are able to mount it.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Applied, with the shell quotes added, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-29 17:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-17  1:41 [PATCH 2/2] btrfs-progs: test for restoring multiple devices fs into a single device fdmanana
2017-05-19  0:18 ` Liu Bo
2017-05-19  6:59 ` Lakshmipathi.G
2017-05-29 17:01 ` David Sterba

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.