diff mbox

btrfs-progs: cli-tests: Convert non-raid filesystem to raid

Message ID 20170129144455.GA12174@giis.co.in (mailing list archive)
State New, archived
Headers show

Commit Message

Lakshmipathi.G Jan. 29, 2017, 2:44 p.m. UTC
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

Comments

David Sterba March 13, 2017, 5:47 p.m. UTC | #1
On Sun, Jan 29, 2017 at 08:14:55PM +0530, Lakshmipathi.G wrote:
> Simple script to verify non-raid filesystem conversion.

The cli (command line interface) tests are supposed to cover the common
usecases from the point of option combinations etc, not really verifying
the result. It would be good if you add more than just one simple test,
especially for the balance filters. Adding the helpers to prepare the
filesystem (number of devices, raid profiles) would be a good start.
Some code for that is in the mkfs tests, but this belongs to the common
scripts so we could easily use that.
--
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
Lakshmipathi.G April 15, 2017, 11:16 a.m. UTC | #2
On Mon, Mar 13, 2017 at 06:47:50PM +0100, David Sterba wrote:
> On Sun, Jan 29, 2017 at 08:14:55PM +0530, Lakshmipathi.G wrote:
> > Simple script to verify non-raid filesystem conversion.
> 
> The cli (command line interface) tests are supposed to cover the common
> usecases from the point of option combinations etc, not really verifying
> the result. It would be good if you add more than just one simple test,
> especially for the balance filters. Adding the helpers to prepare the
> filesystem (number of devices, raid profiles) would be a good start.
> Some code for that is in the mkfs tests, but this belongs to the common
> scripts so we could easily use that.

Ok. I'll try to add helpers to common. So that option like this can
be re-used easily.

Cheers.
Lakshmipathi.G
--
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
diff mbox

Patch

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