[parted-devel] [PATCH 09/10] Add mdadm specific functions.
Joel Granados Moreno
jgranado at redhat.com
Wed Jun 10 17:05:54 UTC 2009
* tests/test-lib.sh (require_mdadm_): New function.
(mdadm_create_linear_device_): New function.
---
tests/test-lib.sh | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index 7fa81ce..11e8eaa 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -317,3 +317,33 @@ elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
else
compare() { cmp "$@"; }
fi
+
+require_mdadm_()
+{
+ ( mdadm --version ) > /dev/null 2>&1 ||
+ {
+ say "skipping $0: could not find mdadm executable"
+ test_done
+ exit
+ }
+}
+
+# Will look for an md number that is not in use and create a md device with
+# that number. If the system has more than 9 md devices, it will fail.
+mdadm_create_linear_device_()
+{
+ lo_dev=$1
+ mdd=$G_dev_/md0
+ for i in 0 1 2 3 4 5 6 7 8 9 ; do
+ mdd=$G_dev_/md$i
+ mdadm --create --force $mdd --level=linear --raid-devices=1 $lo_dev > /dev/null 2>&1 \
+ && break
+
+ if [ $i -eq 9 ]; then echo $mdd ; return 1 ; fi
+ done
+
+ echo $mdd
+ return 0
+}
+
+
--
1.6.0.6
More information about the parted-devel
mailing list