]> git.saurik.com Git - wxWidgets.git/blob - build/buildbot/config/testdrive-inc.xml
2.4 GTK fix as at http://thread.gmane.org/gmane.comp.lib.wxwidgets.devel/93157
[wxWidgets.git] / build / buildbot / config / testdrive-inc.xml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4 Name: testdrive-inc.xml
5 Purpose: Declarations for the testdrive build slave
6 Author: Mike Wetherell
7 RCS-ID: $Id$
8 Copyright: (c) 2007 Mike Wetherell
9 Licence: wxWidgets licence
10 -->
11
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"
15 xsl:version="1.0">
16
17 <xi:include href="include.xml" xpointer="xpointer(*/*)"/>
18
19 <!--
20 checkout - build step for source checkout.
21
22 Usage: as <svn> with additional <command> element and defaults for
23 <baseURL> and <defaultBranch>
24
25 Typically just:
26 <checkout/>
27 for the trunk, or:
28 <checkout branch="branches/WX_2_8_BRANCH"/>
29 to checkout a branch.
30 -->
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)"/>
35 <testdrive-svn>
36 <xsl:if test="not($nodes/svnurl)">
37 <xsl:if test="not($nodes/baseURL)">
38 <baseURL><SVN_URL/></baseURL>
39 </xsl:if>
40 <xsl:if test="not($nodes/defaultBranch)">
41 <defaultBranch><xsl:value-of select="$branch"/></defaultBranch>
42 </xsl:if>
43 </xsl:if>
44 <xsl:if test="not($nodes/command)">
45 <profile/>
46 <post-checkout/>
47 </xsl:if>
48 <xsl:copy-of select="$content"/>
49 </testdrive-svn>
50 </xsl:template>
51
52 <xsl:template name="post-checkout">
53 <command>
54 mkdir -p $TOPDIR
55 chown $USER $TOPDIR
56 rm -rf $BUILDDIR
57 cp -pR . $BUILDDIR || { cd; rm -rf $BUILDDIR; exit 1; }
58 </command>
59 </xsl:template>
60
61 <!--
62 configure - make disable-precomp-headers a default configure option for
63 the testdrive, and post process the Makefiles to use ccache.
64
65 Usage: <configure options="-with-foobar"/>
66 -->
67 <xsl:template name="configure">
68 <xsl:param name="content"/>
69 <xsl:param name="options"/>
70 <configure>
71 <copy-with-defaults content="{$content}">
72 <command>./configure --disable-precomp-headers <xsl:value-of select="$options"/></command>
73 </copy-with-defaults>
74 <command>find . -name Makefile | xargs perl -pi -e 's/^(?:CC|CXX) = /$&amp;ccache /'</command>
75 </configure>
76 </xsl:template>
77
78 <!--
79 setup - a build step that makes sure any prerequisites are set up for
80 the current testdrive build.
81
82 Usage: <setup/>
83 <setup cppunit-options="-host=i686-apple-darwin8"/>
84
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
88 build.
89 -->
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"/>
97 <shellcommand>
98 <description>setting up</description>
99 <descriptionDone>set up</descriptionDone>
100 <haltOnFailure/>
101 <command>
102 MINSPACE=1000000
103 DSPACE=`df -Pk $BUILDDIR | tail -1 | awk '{ print $4 }'`
104 if [ $DSPACE -lt $MINSPACE ]; then
105 echo "Disk space low, skipping build"
106 exit 1
107 fi
108 if [ -z "$CCACHE_DIR" ]; then
109 gunzip -c $HOME/src/ccache-*.tar.gz | tar xf -
110 cd ccache-*
111 <xsl:value-of select="concat($ccache-configure, ' ', $ccache-options, ' ', $options)"/>
112 make
113 strip ccache
114 make install
115 cd $BUILDDIR
116 rm -r ccache-*
117 fi
118 if { cppunit-config --version || "$CPPUNIT_CONFIG" --version; } 2>/dev/null; then
119 HAVE_CPPUNIT=1
120 fi
121 if [ -z "$HAVE_CPPUNIT" ]; then
122 gunzip -c $HOME/src/cppunit-*.tar.gz | tar xf -
123 cd cppunit-*
124 <xsl:value-of select="concat($cppunit-configure, ' ', $cppunit-options, ' ', $options)"/>
125 make install-strip
126 chmod +x $OPTDIR/bin/cppunit-config
127 cd $BUILDDIR
128 rm -rf cppunit-*
129 fi
130 </command>
131 </shellcommand>
132 </xsl:template>
133
134 <!--
135 builddir - override <builddir> to accept a full path
136
137 Usage: <builddir>/tmp/wx/foobar</builddir>
138
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
141 machine.
142
143 The actual builddir (i.e. last part 'foobar') as usual must be unique
144 across all the builds of all the slaves.
145 -->
146 <xsl:template name="builddir">
147 <xsl:param name="content"/>
148 <builddir>
149 <basename><xsl:copy-of select="$content"/></basename>
150 </builddir>
151 </xsl:template>
152
153 <!--
154 steps - overrides <steps> to prepend <profile/> and <prologue/> and
155 append <epilogue/> to the <command/> of each build step.
156
157 Usage: as <steps>
158
159 The differences between <profile/> and <prologue/> are:
160 1. <profile/> is also used by <checkout> for its post checkout command,
161 <proglogue/> isn't.
162 2. <profile/> has access to the build's fields, for example it can
163 use <get name="builddir"/>, while <prologue/> can't.
164 -->
165 <xsl:template name="steps">
166 <xsl:param name="content"/>
167 <xsl:variable name="profile"><profile/></xsl:variable>
168 <steps>
169 <xsl:for-each select="exsl:node-set($content)/*">
170 <xsl:choose>
171 <xsl:when test="contains(name(), 'svn')">
172 <xsl:copy-of select="."/>
173 </xsl:when>
174 <xsl:otherwise>
175 <xsl:copy>
176 <xsl:copy-of select="@*"/>
177 <xsl:copy-of select="$profile"/>
178 <prologue/>
179 <xsl:copy-of select="node()"/>
180 <xsl:if test="not(command)">
181 <command/>
182 </xsl:if>
183 <epilogue/>
184 </xsl:copy>
185 </xsl:otherwise>
186 </xsl:choose>
187 </xsl:for-each>
188 </steps>
189 </xsl:template>
190
191 <!--
192 profile - see <steps> above.
193 -->
194 <xsl:template name="profile">
195 <command>
196 set -e
197 uname -smnr
198 umask 022
199 LANG=C
200 TOPDIR=<get name="builddir"/>
201 BUILDDIR=$TOPDIR/build
202 OPTDIR=$HOME/opt/<basename><get name="builddir"/></basename>
203 </command>
204 </xsl:template>
205
206 <!--
207 prologue - see <steps> above.
208 -->
209 <xsl:template name="prologue">
210 <command>
211 INSTALLDIR=$TOPDIR/install
212 case `uname -sm` in
213 Linux*86*) PATH=$HOME/linux-x86/bin:$PATH ;;
214 esac
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>&amp;1; then
219 CCACHE_DIR=$TOPDIR/ccache
220 export CCACHE_DIR
221 ccache -M 90M
222 fi
223 cd $BUILDDIR
224 <if-del-on-fail>trap 'cd; rm -rf $BUILDDIR' EXIT</if-del-on-fail>
225 </command>
226 </xsl:template>
227
228 <!--
229 epilogue - see <steps> above.
230 -->
231 <xsl:template name="epilogue">
232 <xsl:if test="position() != last()">
233 <if-del-on-fail>
234 <command>trap '' EXIT</command>
235 </if-del-on-fail>
236 </xsl:if>
237 </xsl:template>
238
239 <!--
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.
242
243 Usage: <if-del-on-fail>foobar</if-del-on-fail>
244
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.
249 -->
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"/>
258 </xsl:if>
259 </xsl:template>
260
261 <!--
262 Add slave locks so that each testdrive machine only runs one bulid at a
263 time
264 -->
265 <xsl:for-each select="../build/sandbox">
266 <xsl:if test="not(../preceding-sibling::build[sandbox = current()])">
267 <slavelock>
268 <name><xsl:apply-templates select="node()"/></name>
269 </slavelock>
270 </xsl:if>
271 </xsl:for-each>
272
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>
277 </xsl:template>
278
279 <!--
280 basename - returns the final component of a path
281
282 Usage: <basename>/foo/bar</basename>
283
284 Evaluates to 'bar'.
285 -->
286 <xsl:template name="basename">
287 <xsl:param name="path"/>
288 <xsl:choose>
289 <xsl:when test="contains($path, '/')">
290 <xsl:call-template name="basename">
291 <xsl:with-param name="path" select="substring-after($path, '/')"/>
292 </xsl:call-template>
293 </xsl:when>
294 <xsl:otherwise>
295 <xsl:value-of select="$path"/>
296 </xsl:otherwise>
297 </xsl:choose>
298 </xsl:template>
299
300 </bot>