]> git.saurik.com Git - wxWidgets.git/blob - build/buildbot/config/include/testdrive.xml
e9f7c9f3c924e2a5f81def484ff7385c3d731d8b
[wxWidgets.git] / build / buildbot / config / include / testdrive.xml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4 Name: include/testdrive.xml
5 Purpose: Declarations for the testdrive build slaves
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 xmlns:get="local"
16 xsl:version="1.0">
17
18 <xi:include href="defs.xml"/>
19
20 <!--
21 build - add a default <sandbox> element, the same as the previous build.
22 -->
23 <xsl:template name="build">
24 <xsl:param name="content"/>
25 <build>
26 <defaults content="{$content}">
27 <xsl:apply-templates select="get:property('sandbox', get:preceding-builds())[last()]"/>
28 </defaults>
29 <xsl:copy-of select="$content"/>
30 </build>
31 </xsl:template>
32
33 <!--
34 checkout - build step for source checkout.
35
36 Usage: as <svn> with additional <command> element and defaults for
37 <baseURL> and <defaultBranch>
38
39 Typically just:
40 <checkout/>
41 for the trunk, or:
42 <checkout branch="branches/WX_2_8_BRANCH"/>
43 to checkout a branch.
44 -->
45 <xsl:template name="checkout">
46 <xsl:param name="content"/>
47 <xsl:param name="branch" select="'trunk'"/>
48 <xsl:variable name="nodes" select="exsl:node-set($content)"/>
49 <testdrive-svn>
50 <xsl:if test="not($nodes/svnurl)">
51 <xsl:if test="not($nodes/baseURL)">
52 <baseURL><SVN_URL/></baseURL>
53 </xsl:if>
54 <xsl:if test="not($nodes/defaultBranch)">
55 <defaultBranch><xsl:value-of select="$branch"/></defaultBranch>
56 </xsl:if>
57 </xsl:if>
58 <xsl:if test="not($nodes/command)">
59 <profile/>
60 <post-checkout/>
61 </xsl:if>
62 <xsl:copy-of select="$content"/>
63 </testdrive-svn>
64 </xsl:template>
65
66 <!--
67 steps - overrides <steps> to prepend <profile/> and <prologue/> and
68 append <epilogue/> to the <command/> of each build step.
69
70 Usage: as <steps>
71
72 The differences between <profile/> and <prologue/> are:
73 1. <profile/> is also used by <checkout> for its post checkout command.
74 2. In <profile> the current node is the <steps> element.
75 3. In <prologue> the current node is the build step inside a generated
76 nodeset. The current build is passes as a parameter.
77 -->
78 <xsl:template name="steps">
79 <xsl:param name="content"/>
80 <xsl:variable name="profile"><profile/></xsl:variable>
81 <xsl:variable name="build" select="get:build()"/>
82 <steps>
83 <xsl:for-each select="exsl:node-set($content)/*">
84 <xsl:choose>
85 <xsl:when test="contains(name(), 'svn')">
86 <xsl:copy-of select="."/>
87 </xsl:when>
88 <xsl:otherwise>
89 <xsl:copy>
90 <xsl:copy-of select="@*"/>
91 <xsl:copy-of select="$profile"/>
92 <prologue build="{$build}"/>
93 <xsl:copy-of select="node()"/>
94 <xsl:if test="not(command)">
95 <command/>
96 </xsl:if>
97 <epilogue build="{$build}"/>
98 </xsl:copy>
99 </xsl:otherwise>
100 </xsl:choose>
101 </xsl:for-each>
102 </steps>
103 </xsl:template>
104
105 <!--
106 if-del-on-fail - used in the context of a build step, copies its content
107 if the build step should cleanup on failure.
108
109 Usage: <if-del-on-fail>foobar</if-del-on-fail>
110
111 On the testdrive the working directory is deleted after a build to save
112 space. If the step has <haltOnFailure/> (which is the default or
113 <configure> and <compile> steps) then this cleanup needs to happen
114 whenever the step fails.
115 -->
116 <xsl:template name="if-del-on-fail">
117 <xsl:param name="content"/>
118 <xsl:if test = "position() = last() or
119 haltOnFailure = '' or
120 haltOnFailure = 'true' or
121 (not(haltOnFailure) and
122 (name() = 'configure' or name() = 'compile'))">
123 <xsl:copy-of select="$content"/>
124 </xsl:if>
125 </xsl:template>
126
127 <!--
128 Add slave locks so that each testdrive machine only runs one bulid at a
129 time.
130 -->
131 <create-locks/>
132
133 <xsl:template name="create-locks">
134 <xsl:variable name="rtf">
135 <xsl:apply-templates select="get:property('sandbox', get:all-builds())"/>
136 </xsl:variable>
137 <xsl:variable name="sandboxes" select="exsl:node-set($rtf)/sandbox"/>
138 <xsl:for-each select="$sandboxes">
139 <xsl:variable name="text" select="text()"/>
140 <xsl:variable name="position" select="position()"/>
141 <xsl:if test="not($sandboxes[text() = $text and position() &lt; $position])">
142 <slavelock>
143 <name><xsl:value-of select="node()"/></name>
144 </slavelock>
145 </xsl:if>
146 </xsl:for-each>
147 </xsl:template>
148
149 <xsl:template name="sandbox">
150 <xsl:param name="content"/>
151 <sandbox><xsl:copy-of select="$content"/></sandbox>
152 <lock><xsl:copy-of select="$content"/></lock>
153 </xsl:template>
154
155 </bot>