Simple script to verify non-raid filesystem conversion.

Signed-off-by: Lakshmipathi.G <[email protected]>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to