From 2ecf5b986e83b4108b57a736e65f5b52c35f7cde Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Sun, 2 May 2010 10:51:30 +0000 Subject: [PATCH] Add autobuild.sh : for buildbot to run CTS git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2796 fd59a12c-fef9-0310-b244-a6a79926bd2f --- autobuild.sh | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 autobuild.sh diff --git a/autobuild.sh b/autobuild.sh new file mode 100644 index 00000000..65d4c898 --- /dev/null +++ b/autobuild.sh @@ -0,0 +1,98 @@ +#!/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 ...' +rm -f cts.log +pushd cts +# needs sudo to read /var/log/messages +sudo -n ./corolab.py --nodes "$TEST_NODES" --outputfile ../cts.log +popd +