wxWidgets/build/buildbot/config/include/testdrive.xml

183 lines
5.9 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<!--
Name: include/testdrive.xml
Purpose: Declarations for the testdrive build slaves
Author: Mike Wetherell
RCS-ID: $Id$
Copyright: (c) 2007 Mike Wetherell
Licence: wxWidgets licence
-->
<bot xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
xmlns:get="local"
xsl:version="1.0">
<xi:include href="defs.xml"/>
<!--
build - add a default <sandbox> element, the same as the previous build.
-->
<xsl:template name="build">
<xsl:param name="content"/>
<build>
<defaults content="{$content}">
<xsl:apply-templates select="get:property('sandbox', get:preceding-builds())[last()]"/>
</defaults>
<xsl:copy-of select="$content"/>
</build>
</xsl:template>
<!--
checkout - build step for source checkout.
Usage: as <svn> with additional <command> element and defaults for
<baseURL> and <defaultBranch>
Typically just:
<checkout/>
for the trunk, or:
<checkout branch="branches/WX_2_8_BRANCH"/>
to checkout a branch.
-->
<xsl:template name="checkout">
<xsl:param name="content"/>
<xsl:param name="branch" select="'trunk'"/>
<xsl:variable name="nodes" select="exsl:node-set($content)"/>
<testdrive-svn>
<profile/>
<xsl:if test="not($nodes/svnurl)">
<xsl:if test="not($nodes/baseURL)">
<baseURL><SVN_URL/></baseURL>
</xsl:if>
<xsl:if test="not($nodes/defaultBranch)">
<defaultBranch><xsl:value-of select="$branch"/></defaultBranch>
</xsl:if>
</xsl:if>
<xsl:if test="not($nodes/command)">
<post-checkout/>
</xsl:if>
<xsl:copy-of select="$content"/>
</testdrive-svn>
</xsl:template>
<!--
fatch - fetch an source tarball/zip over http or ftp.
Usage:
<fetch branch="Daily_HEAD/wxX11.tar.gz"/>
Fetches the URL given by <baseURL>/$branch, where the current default
for <baseURL> is "http://biolpc22.york.ac.uk/pub".
The archive is then extracted by executing <profile/> then <unarchive/>
on the remote machine.
-->
<xsl:template name="fetch">
<xsl:param name="content"/>
<xsl:param name="branch">Daily_HEAD/wxWidgets.tar.gz</xsl:param>
<wget>
<profile/>
<defaults content="{$content}">
<baseURL><SNAPSHOT_URL/></baseURL>
<defaultBranch><xsl:value-of select="$branch"/></defaultBranch>
<unarchive/>
</defaults>
<xsl:copy-of select="$content"/>
</wget>
</xsl:template>
<!--
steps - overrides <steps> to prepend <profile/> and <prologue/> and
append <epilogue/> to the <command/> of each build step.
Usage: as <steps>
The differences between <profile/> and <prologue/> are:
1. <profile/> is also used by <checkout> for its post checkout command.
2. In <profile> the current node is the <steps> element.
3. In <prologue> the current node is the build step inside a generated
nodeset. The current build is passes as a parameter.
-->
<xsl:template name="steps">
<xsl:param name="content"/>
<xsl:variable name="profile"><profile/></xsl:variable>
<xsl:variable name="build" select="get:build()"/>
<steps>
<xsl:for-each select="exsl:node-set($content)/*">
<xsl:choose>
<xsl:when test="contains(name(), 'svn') or
contains(name(), 'get')">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:copy-of select="$profile"/>
<prologue build="{$build}"/>
<xsl:copy-of select="node()"/>
<xsl:if test="not(command)">
<command/>
</xsl:if>
<epilogue build="{$build}"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</steps>
</xsl:template>
<!--
if-del-on-fail - used in the context of a build step, copies its content
if the build step should cleanup on failure.
Usage: <if-del-on-fail>foobar</if-del-on-fail>
On the testdrive the working directory is deleted after a build to save
space. If the step has <haltOnFailure/> (which is the default or
<configure> and <compile> steps) then this cleanup needs to happen
whenever the step fails.
-->
<xsl:template name="if-del-on-fail">
<xsl:param name="content"/>
<xsl:if test = "position() = last() or
haltOnFailure = '' or
haltOnFailure = 'true' or
(not(haltOnFailure) and
(name() = 'configure' or name() = 'compile'))">
<xsl:copy-of select="$content"/>
</xsl:if>
</xsl:template>
<!--
Add slave locks so that each testdrive machine only runs one bulid at a
time.
-->
<create-locks/>
<xsl:template name="create-locks">
<xsl:variable name="rtf">
<xsl:apply-templates select="get:property('sandbox', get:all-builds())"/>
</xsl:variable>
<xsl:variable name="sandboxes" select="exsl:node-set($rtf)/sandbox"/>
<xsl:for-each select="$sandboxes">
<xsl:variable name="text" select="text()"/>
<xsl:variable name="position" select="position()"/>
<xsl:if test="not($sandboxes[text() = $text and position() &lt; $position])">
<slavelock>
<name><xsl:value-of select="node()"/></name>
</slavelock>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="sandbox">
<xsl:param name="content"/>
<sandbox><xsl:copy-of select="$content"/></sandbox>
<lock><xsl:copy-of select="$content"/></lock>
</xsl:template>
</bot>