[Libvir] Automated build script

Daniel P. Berrange berrange at redhat.com
Wed Jan 31 12:39:10 UTC 2007


I'm going to setup libvirt to be part of an automated build system[1] which
will checkout the code, perform a build, run tests, etc, etc on a 24x7
basis. This merely requires adding a single file 'autobuild.sh' to the
top level directory to perform the neccessary build/test tasks (see
attached file). 

As part of this automation I'll have it setup to run all the test suites
under valgrind which should let us identify memory leaks sooner. Finally
I also plan to add in the Makefile rules[2] neccessary to run gcov so as to
enable reports to be generated on test suite coverage.

Regards,
Dan.

[1] http://autobuild.org/
[2] Hmm, i'm sure i sent such a patch before but can't find any trace of
    it in the mail archives.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
-------------- next part --------------
Index: autobuild.sh
===================================================================
RCS file: autobuild.sh
diff -N autobuild.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ autobuild.sh	30 Jan 2007 15:25:46 -0000
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+set -e
+
+# Make things clean.
+
+test -n "$1" && RESULTS="$1" || RESULTS="results.log"
+
+test -f Makefile && make -k distclean || :
+rm -rf MANIFEST blib
+
+#rm -rf build
+#mkdir build
+#cd build
+
+./autogen.sh --prefix=$AUTOBUILD_INSTALL_ROOT
+
+make
+make install
+
+make check 1>$RESULTS 2>&1
+#make cov
+
+rm -f *.tar.gz
+make dist
+
+if [ -f /usr/bin/rpmbuild ]; then
+  if [ -n "$AUTOBUILD_COUNTER" ]; then
+    EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER"
+  else
+    NOW=`date +"%s"`
+    EXTRA_RELEASE=".$USER$NOW"
+  fi
+  rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" -ta --clean *.tar.gz
+fi
Index: configure.in
===================================================================
RCS file: /data/cvs/libvirt/configure.in,v
retrieving revision 1.52
diff -u -p -r1.52 configure.in
--- configure.in	22 Jan 2007 15:31:00 -0000	1.52
+++ configure.in	30 Jan 2007 15:25:47 -0000
@@ -246,6 +246,28 @@ AC_SUBST(PYTHON_VERSION)
 AC_SUBST(PYTHON_INCLUDES)
 AC_SUBST(PYTHON_SITE_PACKAGES)
 
+AC_MSG_CHECKING([whether this host is running a Xen kernel])
+RUNNING_XEN=
+if test -d /proc/sys/xen
+then
+    RUNNING_XEN=yes
+else
+    RUNNING_XEN=no
+fi
+AC_MSG_RESULT($RUNNING_XEN)
+
+AC_MSG_CHECKING([If XenD UNIX socket /var/run/xend/xmlrpc.sock is accessible])
+RUNNING_XEND=
+if test -S /var/run/xend/xmlrpc.sock
+then
+    RUNNING_XEND=yes
+else
+    RUNNING_XEND=no
+fi
+AC_MSG_RESULT($RUNNING_XEND)
+
+AM_CONDITIONAL(ENABLE_XEN_TESTS, [test "$RUNNING_XEN" != "no" -a "$RUNNING_XEND" != "no"])
+
 AM_GNU_GETTEXT_VERSION([0.14.1])
 AM_GNU_GETTEXT([external])
 if test -d po
Index: tests/Makefile.am
===================================================================
RCS file: /data/cvs/libvirt/tests/Makefile.am,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile.am
--- tests/Makefile.am	19 Jan 2007 20:30:05 -0000	1.12
+++ tests/Makefile.am	30 Jan 2007 15:25:47 -0000
@@ -22,7 +22,10 @@ EXTRA_DIST = xmlrpcserver.py test_conf.s
 noinst_PROGRAMS = xmlrpctest xml2sexprtest sexpr2xmltest virshtest conftest \
 	reconnect xmconfigtest
 
-TESTS = xml2sexprtest sexpr2xmltest virshtest test_conf.sh reconnect xmconfigtest
+TESTS = xml2sexprtest sexpr2xmltest virshtest test_conf.sh xmconfigtest
+if ENABLE_XEN_TESTS
+  TESTS += reconnect
+endif
 
 valgrind:
 	$(MAKE) check TESTS_ENVIRONMENT="valgrind --quiet --leak-check=full"


More information about the libvir-list mailing list