summaryrefslogtreecommitdiffstats
path: root/regressions
diff options
context:
space:
mode:
authorMatthew Booth <mbooth@redhat.com>2011-11-17 12:43:49 +0000
committerRichard W.M. Jones <rjones@redhat.com>2011-11-17 12:43:49 +0000
commitc4bd6bba8d88ecf1ebf4a9c2c80a407d9971aaf7 (patch)
tree8a38b7dff74a70d40c229f9b60fbb10de20ce8fb /regressions
parent0c99bb06f4565e053e18e082065bdc739f5130ab (diff)
downloadlibguestfs-c4bd6bba8d88ecf1ebf4a9c2c80a407d9971aaf7.tar.gz
libguestfs-c4bd6bba8d88ecf1ebf4a9c2c80a407d9971aaf7.tar.xz
libguestfs-c4bd6bba8d88ecf1ebf4a9c2c80a407d9971aaf7.zip
New API: mdadm-detail.
Diffstat (limited to 'regressions')
-rwxr-xr-xregressions/test-mdadm.sh60
1 files changed, 59 insertions, 1 deletions
diff --git a/regressions/test-mdadm.sh b/regressions/test-mdadm.sh
index 3ad4f22d..81195617 100755
--- a/regressions/test-mdadm.sh
+++ b/regressions/test-mdadm.sh
@@ -92,4 +92,62 @@ write /r5t3/baz "testing"
EOF
-rm -f md-test1.img md-test2.img md-test3.img md-test4.img
+eval `../fish/guestfish --listen`
+../fish/guestfish --remote add-ro md-test1.img
+../fish/guestfish --remote add-ro md-test2.img
+../fish/guestfish --remote add-ro md-test3.img
+../fish/guestfish --remote add-ro md-test4.img
+../fish/guestfish --remote run
+
+for md in `../fish/guestfish --remote list-md-devices`; do
+ ../fish/guestfish --remote mdadm-detail "${md}" > mdadm-detail.out
+
+ sed 's/:\s*/=/' mdadm-detail.out > mdadm-detail.out.sh
+ . mdadm-detail.out.sh
+ rm -f mdadm-detail.out.sh
+
+ error=0
+ case "$name" in
+ *:r1t1)
+ [ "$level" == "raid1" ] || error=1
+ [ "$devices" == "2" ] || error=1
+ ;;
+
+ *:r1t2)
+ [ "$level" == "raid1" ] || error=1
+ [ "$devices" == "2" ] || error=1
+ ;;
+
+ *:r5t1)
+ [ "$level" == "raid5" ] || error=1
+ [ "$devices" == "4" ] || error=1
+ ;;
+
+ *:r5t2)
+ [ "$level" == "raid5" ] || error=1
+ [ "$devices" == "3" ] || error=1
+ ;;
+
+ *:r5t3)
+ [ "$level" == "raid5" ] || error=1
+ [ "$devices" == "2" ] || error=1
+ ;;
+
+ *)
+ error=1
+ esac
+
+ [[ "$uuid" =~ ([0-9a-f]{8}:){3}[0-9a-f]{8} ]] || error=1
+ [ ! -z "$metadata" ] || error=1
+
+ if [ "$error" == "1" ]; then
+ echo "$0: Unexpected output from mdadm-detail for device $md"
+ cat mdadm-detail.out
+ ../fish/guestfish --remote exit
+ exit 1
+ fi
+done
+
+../fish/guestfish --remote exit
+
+rm -f mdadm-detail.out md-test1.img md-test2.img md-test3.img md-test4.img