[Openais] [PATCH 2/2] Add autobuild.sh script.

Angus Salkeld asalkeld at redhat.com
Mon Apr 19 16:32:05 PDT 2010


This add a script for buildbot to call.
It uses mock to generate the rpms and scp's
them onto the test nodes, then runs cts.

Signed-off-by: Angus Salkeld <asalkeld at redhat.com>
---
 autobuild.sh |   97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 97 insertions(+), 0 deletions(-)
 create mode 100755 autobuild.sh

diff --git a/autobuild.sh b/autobuild.sh
new file mode 100755
index 0000000..21c3b61
--- /dev/null
+++ b/autobuild.sh
@@ -0,0 +1,97 @@
+#!/bin/sh
+#
+# This script is called by auto-build to test
+# corosync. It is run continously to help catch regressions.
+#
+# ENVIRONMENT variables that affect it's behaviour:
+#
+# TEST_NODES - the hostnames of the nodes to be tested
+# TARGET - this is used by mock so look in /etc/mock for
+#          possible options.
+#
+
+# required packages
+which mock >/dev/null 2>&1
+if [ $? -ne 0 ]
+then
+	echo 'please install mock (yum install mock).'
+        exit 1
+fi
+
+MOCK=$(which mock)
+
+set -e
+
+echo 'running autogen ...'
+./autogen.sh
+
+echo 'running configure ...'
+./configure 
+
+echo 'building source rpm'
+rm -f *.src.rpm
+make srpm 
+SRPM=$(ls *src.rpm)
+
+if [ ! -f $SRPM ]
+then
+	echo $0 no source rpm to build from!
+	exit 1
+fi
+
+if [ -z "$TARGET" ]
+then
+	TARGET=fedora-12-x86_64
+fi
+
+RPM_DIR=/var/lib/mock/$TARGET/result
+rm -f $RPM_DIR/corosync*.rpm
+
+echo "running mock init ($TARGET)"
+$MOCK -r $TARGET --init 
+echo "running mock rebuild ($SRPM)"
+$MOCK -r $TARGET --rebuild $SRPM --with testagents
+
+if [ -z "$TEST_NODES" ]
+then
+	echo no test nodes, exiting without running cts.
+	exit 0
+else
+	# start the VMs, or leave them running?
+	true
+fi
+
+RPM_LIST=
+for r in $RPM_DIR/corosync*.rpm
+do
+  case $r in
+    *src.rpm)
+    ;;
+    *-devel-*)
+    ;;
+#    *debuginfo*)
+#    ;;
+    *)
+    RPM_LIST="$RPM_LIST $r"
+    ;;
+  esac
+done
+
+
+echo installing $RPM_LIST
+echo onto the test nodes $TEST_NODES
+
+# load and install rpm(s) onto the nodes
+for n in $TEST_NODES
+do
+	ssh $n "rm -rf /tmp/corosync*.rpm"
+	scp $RPM_LIST $n:/tmp/
+        ssh $n "rpm --force -Uvf /tmp/corosync*.rpm"
+done
+
+echo 'running test ...'
+pushd cts
+# needs sudo to read /var/log/messages
+sudo -n ./corolab.py --nodes "$TEST_NODES"
+popd
+
-- 
1.6.6.1




More information about the Openais mailing list