Skip to content

Commit 86ee283

Browse files
author
dlsmith
committed
Added more powerful "test-spec" capabilities and testing timeout to the PLT build script
git-svn-id: file:///tmp/test-svn/trunk@3954 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent 4650d68 commit 86ee283

3 files changed

Lines changed: 70 additions & 13 deletions

File tree

plt/build.xml

Lines changed: 69 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
<property name="java14-home" value="${env.JAVA14_HOME}" />
1515
<property name="clover-jar" value="${env.CLOVER_JAR}" />
1616

17-
18-
<!-- By default, don't filter tests on anything -->
17+
<!-- Testing defaults -->
1918
<property name="test-spec" value="" />
19+
<property name="test-repeat" value="1" /> <!-- TODO: Use this value -->
20+
<property name="test-timeout" value="1440" />
2021

2122
<!-- By default, clean can fail -->
2223
<property name="clean-can-fail" value="yes" />
@@ -42,6 +43,8 @@
4243
<taskdef resource="com/cenqua/ant/antlib.xml" classpath="lib/buildlib/cenquatasks.jar" />
4344
<extendclasspath path="lib/buildlib/junit.jar" />
4445

46+
<!-- Extension containing various tools, including "for" and "if" -->
47+
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="lib/buildlib/ant-contrib.jar"/>
4548

4649
<!-- ***********
4750
Help Target
@@ -223,10 +226,60 @@
223226
<target name="test" depends="test-15" description="Shortcut for 'test-15'">
224227
</target>
225228

226-
227-
<target name="test-15" depends="compile-15, assert-15"
229+
<target name="test-15" depends="compile-15"
228230
description="Run all 5.0 tests under Java 5.0 (after compiling); use -Dtest-spec=... to filter">
229-
<echo message="Running all 5.0 tests matching '${test-spec}' under Java 5.0" />
231+
<antcall target="iterate-tests">
232+
<param name="do-test-target" value="do-test-15" />
233+
</antcall>
234+
</target>
235+
236+
<target name="test-14" depends="compile-14"
237+
description="Run all 1.4 tests under Java 1.4 (after compiling); use -Dtest-spec=... to filter">
238+
<antcall target="iterate-tests">
239+
<param name="do-test-target" value="do-test-14" />
240+
</antcall>
241+
</target>
242+
243+
<target name="test-14-in-15" depends="compile-14, assert-15"
244+
description="Run all 1.4 tests under Java 5.0 (after compiling); use -Dtest-spec=... to filter">
245+
<antcall target="iterate-tests">
246+
<param name="do-test-target" value="do-test-14-in-15" />
247+
</antcall>
248+
</target>
249+
250+
<target name="iterate-tests">
251+
<if>
252+
<equals arg1="${test-spec}" arg2="" />
253+
<then>
254+
<limit minutes="${test-timeout}" failonerror="true">
255+
<antcall target="${do-test-target}">
256+
<param name="test-filter-string" value="" />
257+
</antcall>
258+
</limit>
259+
</then>
260+
<else>
261+
<for list="${test-spec}" param="test-filter-string-attribute">
262+
<sequential>
263+
<limit minutes="${test-timeout}" failonerror="true">
264+
<antcall target="${do-test-target}">
265+
<param name="test-filter-string" value="@{test-filter-string-attribute}" />
266+
</antcall>
267+
</limit>
268+
</sequential>
269+
</for>
270+
</else>
271+
</if>
272+
</target>
273+
274+
<selector id="tests-to-run">
275+
<and>
276+
<filename name="**/*${test-filter-string}*/**" />
277+
<filename name="**/*Test.class" />
278+
</and>
279+
</selector>
280+
281+
<target name="do-test-15" depends="assert-15">
282+
<echo message="Running all 5.0 tests matching '${test-filter-string}' under Java 5.0" />
230283
<junit haltonfailure="yes" fork="yes" forkmode="perTest" maxmemory="256M" dir="${basedir}">
231284
<classpath>
232285
<pathelement location="lib/buildlib/junit.jar" />
@@ -237,14 +290,14 @@
237290
</classpath>
238291
<formatter type="brief" usefile="false" />
239292
<batchtest>
240-
<fileset dir="classes/test" includes="**/*${test-spec}*Test.class" />
293+
<fileset dir="classes/test">
294+
<selector refid="tests-to-run" />
295+
</fileset>
241296
</batchtest>
242297
</junit>
243-
244298
</target>
245299

246-
<target name="test-14" depends="compile-14, resolve-java14-exec"
247-
description="Run all 1.4 tests under Java 1.4 (after compiling); use -Dtest-spec=... to filter">
300+
<target name="do-test-14" depends="resolve-java14-exec">
248301
<echo message="Running all 1.4 tests matching '${test-spec}' under Java 1.4" />
249302
<junit haltonfailure="yes" fork="yes" forkmode="perTest" maxmemory="256M" jvm="${java14-exec}" dir="${basedir}">
250303
<classpath>
@@ -256,13 +309,14 @@
256309
</classpath>
257310
<formatter type="brief" usefile="false" />
258311
<batchtest>
259-
<fileset dir="classes/test-14" includes="**/*${test-spec}*Test.class" />
312+
<fileset dir="classes/test-14">
313+
<selector refid="tests-to-run" />
314+
</fileset>
260315
</batchtest>
261316
</junit>
262317
</target>
263318

264-
<target name="test-14-in-15" depends="compile-14, assert-15"
265-
description="Run all 1.4 tests under Java 5.0 (after compiling); use -Dtest-spec=... to filter">
319+
<target name="do-test-14-in-15" depends="assert-15">
266320
<echo message="Running all 1.4 tests matching '${test-spec}' under Java 5.0" />
267321
<junit haltonfailure="yes" fork="yes" forkmode="perTest" maxmemory="256M" dir="${basedir}">
268322
<classpath>
@@ -274,7 +328,9 @@
274328
</classpath>
275329
<formatter type="brief" usefile="false" />
276330
<batchtest>
277-
<fileset dir="classes/test-14" includes="**/*${test-spec}*Test.class" />
331+
<fileset dir="classes/test-14">
332+
<selector refid="tests-to-run" />
333+
</fileset>
278334
</batchtest>
279335
</junit>
280336
</target>

plt/lib/buildlib/ant-contrib.jar

190 KB
Binary file not shown.

plt/lib/readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ buildlib/*.jar: Binaries used in the build process, but that should not be part
66
VERSIONS:
77

88
retroweaver-rt-1.2.3.jar: Retroweaver 1.2.3
9+
buildlib/ant-contrib.jar: ANT Contrib 1.0b2
910
buildlib/cenquatasks.jar: Distributed with Clover 1.3.9
1011
buildlib/junit.jar: JUnit 3.8.1
1112
buildlib/retroweaver-all-1.2.3.jar: Retroweaver 1.2.3

0 commit comments

Comments
 (0)