[Openais] [PATCH] Add autobuild.sh for auto-build
Angus Salkeld
asalkeld at redhat.com
Wed Mar 10 17:51:20 PST 2010
Hi
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:
Attached is my "/etc/auto-build.d/auto-build.conf"
(you will need to change the env{} section.
then run:
auto-build --config /etc/auto-build.d/auto-build.conf
Regards
Angus
Signed-off-by: Angus Salkeld <asalkeld at redhat.com>
---
autobuild.sh | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 127 insertions(+), 0 deletions(-)
create mode 100755 autobuild.sh
diff --git a/autobuild.sh b/autobuild.sh
new file mode 100755
index 0000000..773d46b
--- /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 --at-boot 0 --nodes "$TEST_NODES" --outputfile ../build_output/cts.log
+popd
+
--
1.6.6.1
-------------- next part --------------
#
# Test-AutoBuild main configuration file.
#
# Short documentation can be found inline, and for further
# information consult the manual page 'man 5 auto-build.conf'
#
# Path to the build engine definition. This determines the
# sequence of stages executed by the build engine, package
# types to publish, and other miscellaneous aspects of the
# build engine's runtime environment.
# It will typically suffice to leave this on the default
# setting
engine = /etc/auto-build.d/engine/host-build.conf
# If you want to use SELinux MAC, then uncomment this
# and run with '/usr/bin/auto-build-secure' instead
#engine = /etc/auto-build.d/engine/host-build-secure.conf
# The location of the directory containing the template files
# for the HTML status pages, and email alert messages
templateDir = /etc/auto-build.d/templates
# The directory under which the build engine will run. This
# should match whatever path was provided when running the
# 'auto-build-make-root' script. /var/lib/builder is the default
# directory created by the RPM perl-Test-AutoBuild-account
buildRoot = /var/lib/builder
# A name for the build instance. This is used in the HTML
# status pages, email alert subject, and RSS feeds
label = Corosync Continous Builder and Tester
# Name and email address of the build administrator
adminEmail = asalkeld at redhat.com
adminName = Angus Salkeld
# Name and email address of the development team writing the
# software being built. Typically point it to the main developer
# mailing list
#groupEmail = dev at example.com
#groupName = Corosync Developers
# If the build host has multiple names, then specify which
# one is used for the virtual host publishing the HTML status
# pages. This will be used to construct links in the RSS feed
# and email alert messages. If not set, defaults to the primary
# hostname of the machine
#hostname = example.com
# The prefix under which the HTML status pages are located.
# If using /etc/auto-build.d/httpd/aliased.conf, then
#httpPrefix = /builder
# Else with /etc/auto-build.d/httpd/user.conf, then
#httpPrefix = /~builder
# Finally with /etc/auto-build.d/httpd/vhost.conf, then
httpPrefix = /~builder
# Where to save a log of the build engine progress (this
# data is also sent to STDERR, but when run from cron this
# typically ends up in /dev/null)
engineLogFile = /var/lib/builder/autobuild.log
# The method used for acquiring a lock file to prevent multiple
# build instances running at the same time against the same
# buildRoot directory.
# * fcntl - Best option, but only implemented for Linux, SunOS
# and FreeBSD
# * flock - Portable to any UNIX, but does not completely protect
# if buildRoot is on an NFS volume
# * file - Simple file creation/deletion test. If the build engine
# or host machine crashes, it will be neccessary to manually
# delete the lock file ($buildRoot/.build.mutex)
lockMethod = fcntl
# Define what high level features you want enabled
features = {
# If the cache is enabled, then modules will only be built if their
# sources have changed since the previous build cycle. This provides
# much faster cycle times if there are many modules in the build
# config, only a few of which ever change
cache = 0
# Whether to try and checkout the latest sources from version control
# If checkout is disabled, the build will run with whatever sources
# were checked out on the previous cycle.
checkout = 1
# Whether to run the 'createrepo' tool against the RPMs on the HTTP
# distribution site
createrepo_index = 0
# Whether to run the 'yum-arch' tool against the RPMs on the HTTP
# distribution site
yum_index = 0
# Whether to generate an APT index of RPMs / Debian packages on the
# HTTP distribution site
apt_index = 0
# Whether to send email alerts at the end of cycles
email_alerts = 0
}
# Describe 'interesting' metadata about the build platform
platform = {
# Taken from /etc/issue, if not set
#label = RHEL-4, Update 2
# Taken from uname(2) 'sysname' if not set
#operating_system = GNU/Linux
# Taken from uname(2) 'machine' if not set
# architecture = i386
# Arbitrary administrator specific options...
#options = {
# compiler.cc = GCC 4.0.2
# linker = GNU ld 2.15.94.0.2.2
#}
}
# Criteria for sending email alerts
alert = {
# If the scope is set to
# * builder - one email is sent with info on all modules
# * module - one email is sent for each module
scope = builder
# Conditions for sending alerts
# * always - send regardless of status
# * fail - send whenever the status is 'failed'
# * first-fail - send on the first failure only
trigger = first-fail
# If scope is set to 'builder' then
#
# * admin - use the global address defined for $adminEmail
# * group - use the global address defined for $groupEmail
#
# If scope is set to 'module' then
#
# * admin - use the module specific address defined for $adminEmail
# * group - use the module specific address defined for $groupEmail
#
# Or just set an explicit email address (separate multiple address with ,)
to = admin
# What to set the 'From' address to
from = builder at corosync.org
# The SMTP server to relay the mail via, defaults to localhost
#smtpServer = mail.example.com
}
# Set the maximum disk space allowed for use by the cache
maxCacheSize = 100M
# Set the maximum number of days to keep a cache around before
# considering it expired
maxCacheAge = 7d
# Module groups (for web status)
groups = {
software = {
label = Software
}
autobuild = {
label = Test-AutoBuild
}
docs = {
label = Documentation
}
}
# Global environment variables which will be set whenever
# any command is run by the build engine
env = {
USER = builder
}
#TEST_NODES="n2 n3 n4"
# Define the source control repositories from which modules
# will be checked out. There are 7 supported repository types
# at this time. Depending on the 'type' parameter, various
# 'env' or 'option' parameters may be required
#
# cvs - CVS. Specify the CVSROOT environment variable, and
# optionally a CVS_RSH variable
#
# env = {
# CVSROOT = :pserver:anonymous at cvs.gna.org:/cvs/testautobuild
# }
#
# p4 - Perforce. Specify the P4CONFIG environment variable
# for a client view. The viewspec will be filled in
# automatically
#
# env = {
# P4CONFIG = /var/lib/builder/.p4config
# }
#
# tla - GNU Arch. Specify the 'archive-name' and 'archive-uri'
# options for the remote repository. eg,
#
# options = {
# archive-name = lord at emf.net--2004
# archive-uri = http://arch.quackerhead.com/~lord/archives/lord@emf.net--2004
# }
#
# hg - Mercurial. Specify the 'base-url' option to refer to
# the base URL under which the repositories are located
#
# options = {
# base-url = http://www.selenic.com/
# }
#
# git - Git. Specify the 'base-url' option to refer to
# the base URL under which the repositories are located
#
# options = {
# base-url = git://anongit.freedesktop.org/git/
# }
#
# darcs - Darcs. Specify the 'base-url' option to refer to
# the base URL under which the repositories are located
#
# options = {
# base-url = http://www.darcs.net/repos/
# }
#
# bzr - Bazaar. Specify the 'base-url' option to refer to
# the base URL under which the repositories are located
#
# options = {
# base-url = http://www.darcs.net/repos/
# }
#
# mtn - Monotone. Specify the 'server' option to refer to
# the hostname under which the repository is located
#
# options = {
# server = guitone.thomaskeller.biz
# }
#
# Or the path to the dir containing local DBs
#
# options = {
# path = /path/to/repo/dir/
# }
#
# svn - Subversion. Specify the 'url' option to refer to the base
# URL for the repository
#
# options = {
# url = http://aplaws.redhat.com/svn/aplaws/
# }
#
# svk - SVK. No special options. The modules contain the full URL
#
# disk - Local disk. Specify the 'directory' otion to refer to the
# base directory containing the files
#
# options = {
# directory = /var/lib/builder/local-files
# }
#
repositories = {
fedorahosted-svn = {
label = fedorahosted svn
type = svn
options = {
url = http://svn.fedorahosted.org/svn/corosync
}
}
}
# Now, the list of modules to checkout from the repositories
# defined above.
modules = {
corosync-trunk = {
# This is used in email alerts, HTML status pages & RSS feeds
# to refer to the module
label = Test Corosync Truck
# If different from global settings. These will be used if
# the email alert scope is set to 'module'
#
#admin-email = autobuild-admin at example.com
#admin-name = Module Administrator
#group-email = autobuild-dev at example.com
#group-name = Module Developers
# The source code to check out
source = {
# Name of the repository defined above
repository = fedorahosted-svn
# The path within the repository to be checked out
path = trunk
}
# Any module specific environment variables to be set when
# executing the module control file
#env = {
# HTMLURLPREFIX = /~builder/artifacts/autobuild-dev/apidocs
#}
# List of groups (defined earlier) which this module is a
# member of
groups = (
autobuild
software
docs
)
# Arbitrary list of hyperlinks to associate with this module
# in the HTML status pages. Typically link to the module
# developer web pages & source code browser
links = (
{
href = http://www.corosync.org
label = Corosync
}
)
# List of artifacts generated during build which should be
# published on the HTML pages. For example, code cover reports
# API documentation. The 'src' parameter is relative to the
# module's root source code directory. The 'dst' parameter is
# the URL prefix under which to save the artifact. The optional
# 'path' parameter is needed if there is no index file in the
# directory copied.
artifacts = (
{
src = build_output/*
dst = output
label = build output
}
{
src = blib/coverage/*
dst = coverage/
label = Code Test & POD coverage Reports
}
{
src = doc/api/html/
dst = apidocs
path = apidocs/html/index.html
label = API documentation
}
)
}
}
# Optionally, the packages (RPMs, etc) generated during the
# build can be built into an ISO image for distribution
#isos = {
# autobuild-unstable = {
# # File name for the ISO image
# name = autobuild-unstable.iso
# # Label to use in link for HTML status pages
# label = Test-AutoBuild Unstable
# # The package types to include in the ISO, can be
# # one or more of 'rpm', 'zip', 'debian'
# packageTypes = (
# rpm
# zip
# )
# # List of modules whose packages should be included
# # in the ISO
# modules = (
# autobuild-dev
# )
# }
#}
# That's all folks!
More information about the Openais
mailing list