Skip to main content
aboutsummaryrefslogblamecommitdiffstats
blob: a6d93fbff8dabbf36b653d3f1438f69025911ab1 (plain) (tree)
1
2
3
4
5
6





                                                                                 








                                                                                                                                                                   































                                                                                   
 


                                                 
                                                                 
                      
 


                                                 
                                                                 
                      
 




                                                                 
 








                                 












                                                                                                  


















                                                                                                                                 

                                                                      






































































                                                                                                                         
<!-- Copyright (c) 2011 IBM Corporation and others. All rights reserved.
    This program and the accompanying materials are made available under the
    terms of the Eclipse Public License v1.0 which accompanies this distribution,
    and is available at http://www.eclipse.org/legal/epl-v10.html Contributors:
    IBM Corporation - initial API and implementation -->

    <!--
    this script is invoked by the build, on the build machine,
    to signify to hudson "the build is done", pass a few parameters,
    then let Hudson take over.

    wget - -no-verbose -O invokeTestsJSON.xml http://git.eclipse.org/c/platform/eclipse.platform.releng.eclipsebuilder.git/plain/invokeTestsJSON.xml?h=master 2>&1;

    -->
    
<project
    name="Hudson-Tests"
    default="runTests"
    basedir=".">

    <target
        name="runTests"
        depends="init">
        <echo message="invokeTestsJSON.xml" />
        <echo message="env.HUDSON_PROTOCOL: ${env.HUDSON_PROTOCOL}" />
        <echo message="env.HUDSON_HOST: ${env.HUDSON_HOST}" />
        <echo message="buildId: ${buildId} " />
        <echo message="eclipseStream: ${eclipseStream}" />
        <echo message="eclipseStreamMajor: ${eclipseStreamMajor}" />
        <echo message="BUILD_TECH: ${BUILD_TECH}" />
        <echo message="EBUILDER_HASH: ${EBUILDER_HASH}" />
        <antcall target="JUnitTests" />
    </target>


    <target
        name="JUnitTests"
        depends="init">

        <!--
          currently we test on three platforms.
          So, three parallel calls since on different machines (and Hudson queues).
          TODO: Can these be called, in parrallel via callant (or, perhaps subant?)
          for greater flexibility in what to test?
        -->

        <parallel>

            <antcall target="triggerHudsonTests">
                <param
                    name="job"
                    value="ep${eclipseStreamMajor}-unit-lin64" />
            </antcall>

            <antcall target="triggerHudsonTests">
                <param
                    name="job"
                    value="ep${eclipseStreamMajor}-unit-win32" />
            </antcall>

            <antcall target="triggerHudsonTests">
                <param
                    name="job"
                    value="ep${eclipseStreamMajor}-unit-mac64" />
            </antcall>

        </parallel>
    </target>


    <target
        name="triggerHudsonTests"
        depends="init">



     <!--
     baseURL used to be "required parameter" for Hudson job, but seemed overly complicated so
     I compute all this later (based on stream and id) but, I've learned, one disadvantage is this
     restricts test code locations to "downloads". There might be times we want to do from "build"
     locations, or similar. Not to mention, other, internal test systems someday.

        <property
            name="baseURL"
            value="http://download.eclipse.org/eclipse/downloads/${dropsDirSegment}/${buildId}" />
     -->

        <!-- Hudson jobs currently have four required parameters -->
        <property
            name="JSON_buildId"
            value="{&quot;name&quot;:&quot;buildId&quot;,&quot;value&quot;:&quot;${buildId}&quot;}" />
        <property
            name="JSON_eclipseStream"
            value="{&quot;name&quot;:&quot;eclipseStream&quot;,&quot;value&quot;:&quot;${eclipseStream}&quot;}" />
        <property
            name="JSON_BUILD_TECH"
            value="{&quot;name&quot;:&quot;BUILD_TECH&quot;,&quot;value&quot;:&quot;${BUILD_TECH}&quot;}" />
        <property
            name="JSON_EBUILDER_HASH"
            value="{&quot;name&quot;:&quot;EBUILDER_HASH&quot;,&quot;value&quot;:&quot;${EBUILDER_HASH}&quot;}" />

        <property
            name="json"
            value="{&quot;parameter&quot;: [${JSON_buildId},${JSON_eclipseStream},${JSON_BUILD_TECH},${JSON_EBUILDER_HASH}] }" />



        <echo message="env.HUDSON_PROTOCOL: ${env.HUDSON_PROTOCOL}" />
        <echo message="env.HUDSON_HOST: ${env.HUDSON_HOST}" />

        <echo message="${json}" />
        <exec executable="curl">
            <arg line="-X POST" />
            <arg value="${env.HUDSON_PROTOCOL}://${env.HUDSON_HOST}/hudson/job/${job}/build" />
            <arg line="-d token=${env.HUDSON_TOKEN}" />
            <arg value="--data-urlencode" />
            <arg value="json=${json}" />
        </exec>

    </target>

    <target
        name="init"
        depends="initStreamVariables"
        unless="invokeTestsJSONinitialized">

        <property environment="env" />

        <property
            name="env.HUDSON_HOST"
            value="hudson.eclipse.org" />
        <property
            name="env.HUDSON_PROTOCOL"
            value="https" />


        <script language="javascript">
            var buildId = project.getProperty("buildId");
            var pattern = new RegExp(/^([IMNSR])(\d{8})-(\d{4})$/);

            var sArray = pattern.exec(buildId);
            // sArray 0 is "whole match"
            project.setProperty("buildType", sArray[1]);
        </script>

        <property
            name="invokeTestsJSONinitialized"
            value="true" />
    </target>

    <target name="initStreamVariables">

        <fail
            unless="eclipseStream"
            message="eclipseStream must be provided by caller" />
        <condition property="streamOK">
            <matches
                pattern="\d\.\d\.\d"
                string="${eclipseStream}" />
        </condition>
        <fail
            message="eclipseStream variable had unexpected format. Should be digit.digit.digit, but was ${eclipseStream}"
            unless="streamOK" />
        <script language="javascript">
            var eclipseStream = project.getProperty("eclipseStream");
            var pattern = new
            RegExp(/(\d+)\.(\d+)\.(\d+)/);

            var sArray = pattern.exec(eclipseStream);
            // sArray[0] is "whole match"
            project.setProperty("eclipseStreamMajor", sArray[1]);
            project.setProperty("eclipseStreamMinor", sArray[2]);
            project.setProperty("eclipseStreamService", sArray[3]);

        </script>

    </target>


</project>

Back to the top