[Openais] [PATCH] Add autobuild script for auto-build. (resend)

Angus Salkeld asalkeld at redhat.com
Wed Mar 24 16:48:44 PDT 2010


This will allow corosync to be run by auto-build.

auto-build requires a script called "autobuild.sh" to be in the base
directory of the repository.

If you want to run this manually you can.
For just building:
1) doxygen (optional)
2) splint (optional)
3) export TARGET=(your mock chroot target)

If you want to run the tests then:
1) You will need the latest devel branch of pacemaker installed
2) test nodes with login-less root access (via ssh)
3) export TEST_NODES="n1 n2" etc...

Then just run.
./autobuild.sh

To run under auto-build:

auto-build --config /etc/auto-build.d/auto-build.conf
---
 autobuild.sh |  127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 127 insertions(+), 0 deletions(-)
 create mode 100644 autobuild.sh

diff --git a/autobuild.sh b/autobuild.sh
new file mode 100644
index 0000000..540d7cb
--- /dev/null
+++ b/autobuild.sh
@@ -0,0 +1,127 @@
+#!/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
+# optional packages
+HAVE_SPLINT=0
+which splint >/dev/null 2>&1 && HAVE_SPLINT=1
+HAVE_DOXYGEN=0
+which doxygen >/dev/null 2>&1 && HAVE_DOXYGEN=1
+
+rm -rf build_output
+mkdir -p build_output
+
+set -e
+
+echo 'running autogen ...'
+./autogen.sh
+
+echo 'running configure ...'
+# disable-nss as the nss headers have warnings in them
+./configure --enable-fatal-warnings --disable-nss > build_output/configure.log 2>&1
+
+echo 'building ...'
+make > build_output/make.log 2>&1
+
+if [ $HAVE_DOXYGEN -eq 1 ]
+then
+	echo 'making doxygen ...'
+	rm -rf doc/api
+	make doxygen > build_output/make-doxygen.log 2>&1
+else
+	echo 'no doxygen, NOT running.'
+	true
+fi
+
+if [ $HAVE_SPLINT -eq 1 ]
+then
+	echo 'running splint ...'
+	make lint > build_output/make-lint.log 2>&1
+else
+	echo 'no splint, NOT running.'
+	true
+fi
+echo 'running make distcheck ...'
+make distcheck > build_output/make-distcheck.log 2>&1
+
+echo 'building source rpm'
+rm -f *.src.rpm
+make srpm > build_output/make-srpm.log 2>&1
+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
+
+echo "running mock init ($TARGET)"
+mock -r $TARGET --init > build_output/mock-init.log 2>&1
+echo "running mock rebuild ($SRPM)"
+mock -r $TARGET --rebuild $SRPM --with testagents > build_output/mock-rebuild.log 2>&1
+
+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 ./corolab.py --nodes "$TEST_NODES" --outputfile ../build_output/cts.log
+popd
+
-- 
1.6.6.1




More information about the Openais mailing list