1 <?xml version=
"1.0" encoding=
"utf-8"?>
4 Name: testdrive-inc.xml
5 Purpose: Declarations for the testdrive build slave
8 Copyright: (c) 2007 Mike Wetherell
9 Licence: wxWidgets licence
12 <bot xmlns:
xi=
"http://www.w3.org/2001/XInclude"
13 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
14 xmlns:
exsl=
"http://exslt.org/common"
17 <xi:include href=
"include.xml" xpointer=
"xpointer(*/*)"/>
20 checkout - build step for source checkout.
22 Usage: as <svn> with additional <command> element and defaults for
23 <baseURL> and <defaultBranch>
28 <checkout branch="branches/WX_2_8_BRANCH"/>
31 <xsl:template name=
"checkout">
32 <xsl:param name=
"content"/>
33 <xsl:param name=
"branch" select=
"'trunk'"/>
34 <xsl:variable name=
"nodes" select=
"exsl:node-set($content)"/>
36 <xsl:if test=
"not($nodes/svnurl)">
37 <xsl:if test=
"not($nodes/baseURL)">
38 <baseURL><SVN_URL/></baseURL>
40 <xsl:if test=
"not($nodes/defaultBranch)">
41 <defaultBranch><xsl:value-of select=
"$branch"/></defaultBranch>
44 <xsl:if test=
"not($nodes/command)">
48 <xsl:copy-of select=
"$content"/>
52 <xsl:template name=
"post-checkout">
57 cp -pR . $BUILDDIR || { cd; rm -rf $BUILDDIR; exit
1; }
62 configure - make disable-precomp-headers a default configure option for
63 the testdrive, and post process the Makefiles to use ccache.
65 Usage: <configure options="-with-foobar"/>
67 <xsl:template name=
"configure">
68 <xsl:param name=
"content"/>
69 <xsl:param name=
"options"/>
71 <copy-with-defaults content=
"{$content}">
72 <command>./configure --disable-precomp-headers
<xsl:value-of select=
"$options"/></command>
74 <command>find . -name Makefile | xargs perl -pi -e 's/^(?:CC|CXX) = /$
&ccache /'
</command>
79 setup - a build step that makes sure any prerequisites are set up for
80 the current testdrive build.
83 <setup cppunit-options="-host=i686-apple-darwin8"/>
85 One of the things it sets up is cppunit. There is more than one compiler
86 available on some of the testdrive machines, and generally speaking
87 cppuint needs to be compiled by the same one that will be used for the
90 <xsl:template name=
"setup">
91 <xsl:param name=
"content"/>
92 <xsl:param name=
"options"/>
93 <xsl:param name=
"ccache-configure" select=
"'./configure INSTALL=./install-sh\ -c --prefix=$HOME --bindir=$OPTDIR/bin'"/>
94 <xsl:param name=
"ccache-options"/>
95 <xsl:param name=
"cppunit-configure" select=
"'./configure INSTALL=config/install-sh\ -c --prefix=$HOME --bindir=$OPTDIR/bin --libdir=$OPTDIR/lib --disable-static'"/>
96 <xsl:param name=
"cppunit-options"/>
98 <description>setting up
</description>
99 <descriptionDone>set up
</descriptionDone>
103 DSPACE=`df -Pk $BUILDDIR | tail -
1 | awk '{ print $
4 }'`
104 if [ $DSPACE -lt $MINSPACE ]; then
105 echo "Disk space low, skipping build"
108 if [ -z "$CCACHE_DIR" ]; then
109 gunzip -c $HOME/src/ccache-*.tar.gz | tar xf -
111 <xsl:value-of select=
"concat($ccache-configure, ' ', $ccache-options, ' ', $options)"/>
118 if { cppunit-config --version || "$CPPUNIT_CONFIG" --version; }
2>/dev/null; then
121 if [ -z "$HAVE_CPPUNIT" ]; then
122 gunzip -c $HOME/src/cppunit-*.tar.gz | tar xf -
124 <xsl:value-of select=
"concat($cppunit-configure, ' ', $cppunit-options, ' ', $options)"/>
126 chmod +x $OPTDIR/bin/cppunit-config
135 builddir - override <builddir> to accept a full path
137 Usage: <builddir>/tmp/wx/foobar</builddir>
139 Normally builddir is a single directory name not a full path. Override
140 to allow a working directory to be selected on the remote testdrive
143 The actual builddir (i.e. last part 'foobar') as usual must be unique
144 across all the builds of all the slaves.
146 <xsl:template name=
"builddir">
147 <xsl:param name=
"content"/>
149 <basename><xsl:copy-of select=
"$content"/></basename>
154 steps - overrides <steps> to prepend <profile/> and <prologue/> and
155 append <epilogue/> to the <command/> of each build step.
159 The differences between <profile/> and <prologue/> are:
160 1. <profile/> is also used by <checkout> for its post checkout command,
162 2. <profile/> has access to the build's fields, for example it can
163 use <get name="builddir"/>, while <prologue/> can't.
165 <xsl:template name=
"steps">
166 <xsl:param name=
"content"/>
167 <xsl:variable name=
"profile"><profile/></xsl:variable>
169 <xsl:for-each select=
"exsl:node-set($content)/*">
171 <xsl:when test=
"contains(name(), 'svn')">
172 <xsl:copy-of select=
"."/>
176 <xsl:copy-of select=
"@*"/>
177 <xsl:copy-of select=
"$profile"/>
179 <xsl:copy-of select=
"node()"/>
180 <xsl:if test=
"not(command)">
192 profile - see <steps> above.
194 <xsl:template name=
"profile">
200 TOPDIR=
<get name=
"builddir"/>
201 BUILDDIR=$TOPDIR/build
202 OPTDIR=$HOME/opt/
<basename><get name=
"builddir"/></basename>
207 prologue - see <steps> above.
209 <xsl:template name=
"prologue">
211 INSTALLDIR=$TOPDIR/install
213 Linux*
86*) PATH=$HOME/linux-x86/bin:$PATH ;;
215 PATH=$OPTDIR/bin:$PATH
216 LD_LIBRARY_PATH=$BUILDDIR/lib:$OPTDIR/lib:$LD_LIBRARY_PATH
217 export LD_LIBRARY_PATH
218 if { ccache -V; }
>/dev/null
2>&1; then
219 CCACHE_DIR=$TOPDIR/ccache
224 <if-del-on-fail>trap 'cd; rm -rf $BUILDDIR' EXIT
</if-del-on-fail>
229 epilogue - see <steps> above.
231 <xsl:template name=
"epilogue">
232 <xsl:if test=
"position() != last()">
234 <command>trap '' EXIT
</command>
240 if-del-on-fail - used in the context of a build step, copies its content
241 if the build step should cleanup on failure.
243 Usage: <if-del-on-fail>foobar</if-del-on-fail>
245 On the testdrive the working directory is deleted after a build to save
246 space. If the step has <haltOnFailure/> (which is the default or
247 <configure> and <compile> steps) then this cleanup needs to happen
248 whenever the step fails.
250 <xsl:template name=
"if-del-on-fail">
251 <xsl:param name=
"content"/>
252 <xsl:if test =
"position() = last() or
253 haltOnFailure = '' or
254 haltOnFailure = 'true' or
255 (not(haltOnFailure) and
256 (name() = 'configure' or name() = 'compile'))">
257 <xsl:copy-of select=
"$content"/>
262 Add slave locks so that each testdrive machine only runs one bulid at a
265 <xsl:for-each select=
"../build/sandbox">
266 <xsl:if test=
"not(../preceding-sibling::build[sandbox = current()])">
268 <name><xsl:apply-templates select=
"node()"/></name>
273 <xsl:template name=
"sandbox">
274 <xsl:param name=
"content"/>
275 <sandbox><xsl:copy-of select=
"$content"/></sandbox>
276 <lock><xsl:copy-of select=
"$content"/></lock>
280 basename - returns the final component of a path
282 Usage: <basename>/foo/bar</basename>
286 <xsl:template name=
"basename">
287 <xsl:param name=
"path"/>
289 <xsl:when test=
"contains($path, '/')">
290 <xsl:call-template name=
"basename">
291 <xsl:with-param name=
"path" select=
"substring-after($path, '/')"/>
295 <xsl:value-of select=
"$path"/>