Skip to main content
summaryrefslogtreecommitdiffstats
blob: a7af7f47d92e79a01034bb589171188c63f71a2b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<!-- 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_KIND: ${BUILD_KIND}" />
        <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_KIND"
            value="{&quot;name&quot;:&quot;BUILD_KIND&quot;,&quot;value&quot;:&quot;${BUILD_KIND}&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_KIND},${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(/^([IMXYNSR])(\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