linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: cli-tests: Convert non-raid filesystem to raid
@ 2017-01-29 14:44 Lakshmipathi.G
  2017-03-13 17:47 ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Lakshmipathi.G @ 2017-01-29 14:44 UTC (permalink / raw)
  To: linux-btrfs

Simple script to verify non-raid filesystem conversion.

Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
---
 tests/cli-tests/005-convert-btrfs-to-raid/test.sh | 32 +++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100755 tests/cli-tests/005-convert-btrfs-to-raid/test.sh

diff --git a/tests/cli-tests/005-convert-btrfs-to-raid/test.sh b/tests/cli-tests/005-convert-btrfs-to-raid/test.sh
new file mode 100755
index 0000000..96772de
--- /dev/null
+++ b/tests/cli-tests/005-convert-btrfs-to-raid/test.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# convert non-raid btrfs to raid
+
+source $TOP/tests/common
+
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+setup_root_helper
+prepare_test_dev 1g
+run_check truncate -s1g img
+
+run_check $TOP/mkfs.btrfs -f $IMAGE
+run_check_mount_test_dev
+
+loopdev=$(run_check_stdout $SUDO_HELPER losetup --partscan --find --show img)
+
+run_check $SUDO_HELPER $TOP/btrfs device add $loopdev $TEST_MNT
+run_check $SUDO_HELPER $TOP/btrfs balance start -dconvert=raid1 -mconvert=raid1 $TEST_MNT
+
+run_check_stdout $SUDO_HELPER $TOP/btrfs filesystem show $loopdev | grep "Total devices 2" -q
+if [ $? -ne 0 ]; then
+	run_check $SUDO_HELPER losetup -d $loopdev
+	rm -f img
+        _fail "Conversion from non-raid filesystem to raid failed."
+fi
+run_check_umount_test_dev
+
+# cleanup
+run_check $SUDO_HELPER losetup -d $loopdev
+rm -f img
-- 
2.7.4


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

end of thread, other threads:[~2017-04-15 11:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-29 14:44 [PATCH] btrfs-progs: cli-tests: Convert non-raid filesystem to raid Lakshmipathi.G
2017-03-13 17:47 ` David Sterba
2017-04-15 11:16   ` Lakshmipathi.G

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).