Skip to content

Commit 4650d68

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

1 file changed

Lines changed: 69 additions & 13 deletions

File tree

misc/build-template.xml

Lines changed: 69 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@
4747
<property name="javacc-home" value="${env.JAVACC_HOME}" />
4848
<property name="clover-jar" value="${env.CLOVER_JAR}" />
4949

50-
51-
<!-- By default, don't filter tests on anything -->
50+
<!-- Testing defaults -->
5251
<property name="test-spec" value="" />
52+
<property name="test-repeat" value="1" /> <!-- TODO: Use this value -->
53+
<property name="test-timeout" value="1440" />
5354

5455
<!-- By default, clean can fail -->
5556
<property name="clean-can-fail" value="yes" />
@@ -79,6 +80,8 @@
7980
<taskdef resource="com/cenqua/ant/antlib.xml" classpath="lib/buildlib/cenquatasks.jar" />
8081
<extendclasspath path="lib/buildlib/junit.jar" />
8182

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

8386
<!-- ***********
8487
Help Target
@@ -424,10 +427,60 @@
424427
<target name="test" depends="test-15" description="Shortcut for 'test-15'">
425428
</target>
426429

427-
428-
<target name="test-15" depends="compile-15, assert-15"
430+
<target name="test-15" depends="compile-15"
429431
description="Run all 5.0 tests under Java 5.0 (after compiling); use -Dtest-spec=... to filter">
430-
<echo message="Running all 5.0 tests matching '${test-spec}' under Java 5.0" />
432+
<antcall target="iterate-tests">
433+
<param name="do-test-target" value="do-test-15" />
434+
</antcall>
435+
</target>
436+
437+
<target name="test-14" depends="compile-14"
438+
description="Run all 1.4 tests under Java 1.4 (after compiling); use -Dtest-spec=... to filter">
439+
<antcall target="iterate-tests">
440+
<param name="do-test-target" value="do-test-14" />
441+
</antcall>
442+
</target>
443+
444+
<target name="test-14-in-15" depends="compile-14, assert-15"
445+
description="Run all 1.4 tests under Java 5.0 (after compiling); use -Dtest-spec=... to filter">
446+
<antcall target="iterate-tests">
447+
<param name="do-test-target" value="do-test-14-in-15" />
448+
</antcall>
449+
</target>
450+
451+
<target name="iterate-tests">
452+
<if>
453+
<equals arg1="${test-spec}" arg2="" />
454+
<then>
455+
<limit minutes="${test-timeout}" failonerror="true">
456+
<antcall target="${do-test-target}">
457+
<param name="test-filter-string" value="" />
458+
</antcall>
459+
</limit>
460+
</then>
461+
<else>
462+
<for list="${test-spec}" param="test-filter-string-attribute">
463+
<sequential>
464+
<limit minutes="${test-timeout}" failonerror="true">
465+
<antcall target="${do-test-target}">
466+
<param name="test-filter-string" value="@{test-filter-string-attribute}" />
467+
</antcall>
468+
</limit>
469+
</sequential>
470+
</for>
471+
</else>
472+
</if>
473+
</target>
474+
475+
<selector id="tests-to-run">
476+
<and>
477+
<filename name="**/*${test-filter-string}*/**" />
478+
<filename name="**/*Test.class" />
479+
</and>
480+
</selector>
481+
482+
<target name="do-test-15" depends="assert-15">
483+
<echo message="Running all 5.0 tests matching '${test-filter-string}' under Java 5.0" />
431484
<junit haltonfailure="yes" fork="yes" forkmode="perTest" maxmemory="256M" dir="${basedir}">
432485
<classpath>
433486
<pathelement location="lib/buildlib/junit.jar" />
@@ -439,14 +492,14 @@
439492
</classpath>
440493
<formatter type="brief" usefile="false" />
441494
<batchtest>
442-
<fileset dir="classes/test" includes="**/*${test-spec}*Test.class" />
495+
<fileset dir="classes/test">
496+
<selector refid="tests-to-run" />
497+
</fileset>
443498
</batchtest>
444499
</junit>
445-
446500
</target>
447501

448-
<target name="test-14" depends="compile-14, resolve-java14-exec"
449-
description="Run all 1.4 tests under Java 1.4 (after compiling); use -Dtest-spec=... to filter">
502+
<target name="do-test-14" depends="resolve-java14-exec">
450503
<echo message="Running all 1.4 tests matching '${test-spec}' under Java 1.4" />
451504
<junit haltonfailure="yes" fork="yes" forkmode="perTest" maxmemory="256M" jvm="${java14-exec}" dir="${basedir}">
452505
<classpath>
@@ -459,13 +512,14 @@
459512
</classpath>
460513
<formatter type="brief" usefile="false" />
461514
<batchtest>
462-
<fileset dir="classes/test-14" includes="**/*${test-spec}*Test.class" />
515+
<fileset dir="classes/test-14">
516+
<selector refid="tests-to-run" />
517+
</fileset>
463518
</batchtest>
464519
</junit>
465520
</target>
466521

467-
<target name="test-14-in-15" depends="compile-14, assert-15"
468-
description="Run all 1.4 tests under Java 5.0 (after compiling); use -Dtest-spec=... to filter">
522+
<target name="do-test-14-in-15" depends="assert-15">
469523
<echo message="Running all 1.4 tests matching '${test-spec}' under Java 5.0" />
470524
<junit haltonfailure="yes" fork="yes" forkmode="perTest" maxmemory="256M" dir="${basedir}">
471525
<classpath>
@@ -478,7 +532,9 @@
478532
</classpath>
479533
<formatter type="brief" usefile="false" />
480534
<batchtest>
481-
<fileset dir="classes/test-14" includes="**/*${test-spec}*Test.class" />
535+
<fileset dir="classes/test-14">
536+
<selector refid="tests-to-run" />
537+
</fileset>
482538
</batchtest>
483539
</junit>
484540
</target>

0 commit comments

Comments
 (0)