Some lvm specific basic tests
authorUlrich Dangel <uli@spamt.net>
Sun, 28 Mar 2010 14:34:01 +0000 (16:34 +0200)
committerUlrich Dangel <uli@spamt.net>
Sun, 28 Mar 2010 14:34:01 +0000 (16:34 +0200)
lvm/deploy.sh [new file with mode: 0644]
lvm/runit.sh [new file with mode: 0755]

diff --git a/lvm/deploy.sh b/lvm/deploy.sh
new file mode 100644 (file)
index 0000000..9501bd5
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/zsh
+
+. /etc/grml/autoconfig.functions
+mkdir -p /tmp/tests
+
+STATUS=$(getbootparam status)
+run_command() {
+    ERROR_MESSAGE="$1"
+    shift
+    $* > /tmp/output
+    [ "$?" -ne 0 ] && wget --post-file=/tmp/output.log $STATUS/FAIL
+
+}
+
+sfdisk /dev/sda <<EOF
+0,10,0x8e
+EOF
+
+run_command "pvcreate" pvcreate /dev/sda1
+run_command "could not create vg group" vgcreate vg /dev/sda1
+run_command "could not create lv" lvcreate -L10M -n 01 /dev/vg
+run_command "could not format fs" mkfs.ext3 /dev/vg/01
+run_command "could not mount group" mount /dev/vg/01 /mnt/test
+run_command "could not resize logical volume" lvresize -L+5M /dev/vg/01
+run_command "could not resize filestem" resize2fs /dev/vg/01
+wget --post-data="Run $TESTS" $STATUS/DONE
diff --git a/lvm/runit.sh b/lvm/runit.sh
new file mode 100755 (executable)
index 0000000..e72269a
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+. $FRAMEWORK
+
+CMDLINE="$CMDLINE_COMMON noprompt netscript=$URL_PREFIX:$COMMON_PORT/deploy.sh status=$URL_PREFIX:$STATUS_PORT/"
+
+IMAGE=$(tempfile -d /dev/shm)
+KVM_PARAMS="-hda $IMAGE"
+TIMEOUT_TIME=180
+TEST_NAME=lvm-tests
+BAILOUT_CMD='rm -f $IMAGE ; kill -9 $TEST_PID 2>/dev/null'
+
+# create sample image file
+dd if=/dev/zero of=$IMAGE bs=1024 count=712000 2>/dev/null
+
+# run the test (will create a bootable device
+run_test
+timeout
+
+wait $SERVER_PID