-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon-test.xml
More file actions
201 lines (182 loc) · 8.91 KB
/
common-test.xml
File metadata and controls
201 lines (182 loc) · 8.91 KB
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?xml version="1.0" encoding="UTF-8"?>
<project name="rti-common-test" default="-fail">
<import file="common.xml"/>
<!-- @todo call -enable-emma for unit/operational/regression tests -->
<target name="-init-tests" depends="-init-deps,-init-build">
<property file="${test.dir}/test-user.properties"/>
<property file="${test.dir}/test.properties"/>
<available property="unit.exists" file="${test.dir}/unit/src"/>
<available property="operational.exists" file="${test.dir}/operational/src"/>
<available property="regression.exists" file="${test.dir}/regression/src"/>
<available property="uncategorized.exists" file="${test.dir}/src"/>
<property name="test.classpath.computed" value="${junit.jar}:${test.classpath}:${collected.jar.deps}"/>
</target>
<target name="all-tests"
depends="unit-test,regression-test,operational-test,uncategorized-test"
description="run all tests"/>
<target name="unit-test" description="run unit tests" depends="-init-tests,-unit-tests"/>
<target name="regression-test" description="run regression tests" depends="-init-tests,-regression-tests"/>
<target name="operational-test" description="run operational tests" depends="-init-tests,-operational-tests"/>
<target name="uncategorized-test" description="run other tests" depends="-init-tests,-uncategorized-tests"/>
<target name="-unit-test-suite" if="unit.test.suite" depends="-init-tests">
<runsuite type="unit"/>
</target>
<target name="-unit-tests" if="unit.exists" unless="skip.unit" depends="-init-tests">
<runtests type="unit"/>
</target>
<target name="-regression-tests" if="regression.exists" unless="skip.regression" depends="-init-tests">
<runtests type="regression"/>
</target>
<target name="-operational-tests" if="operational.exists" unless="skip.operational" depends="-init-tests">
<runtests type="operational"/>
</target>
<target name="-uncategorized-tests" if="uncategorized.exists" depends="-init-tests">
<runtests type=""/>
</target>
<target name="build-all-tests" depends="-init-tests">
<build-tests type=""/>
</target>
<target name="-debug-test-single" depends="-init-tests">
<javacompile src="${test.dir}/${test.type}/src"
dest="${test.dir}/bin/${test.type}"
cp="${test.classpath}:${build.classpath}"
fork="false"/>
<pathconvert property="test.classes" pathsep=",">
<chainedmapper>
<flattenmapper/>
<mapper type="regexp" from="(.*)\.java" to="**/\1\.class"/>
</chainedmapper>
<path>
<filelist dir="${test.dir}/${test.type}/src" files="${files}"/>
</path>
</pathconvert>
<pathconvert property="src.paths">
<chainedmapper>
<flattenmapper/>
<globmapper from="*" to="../*/src"/>
</chainedmapper>
<path>
<filelist dir=".." files="${product.deps}"/>
</path>
</pathconvert>
<nbjpdastart name="${classname}" addressproperty="jpda.address" transport="dt_socket">
<classpath path="${test.classpath}"/>
<sourcepath path="${src.paths}:test/${test.type}/src"/>
</nbjpdastart>
<runtests type="${test.type}" include="${test.classes}">
<vmargs>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=none"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
</vmargs>
</runtests>
</target>
<target name="-test-single" depends="-init-tests">
<javacompile src="${test.dir}/${test.type}/src"
dest="${test.build.dir}/${test.type}"
cp="${test.classpath}:${build.classpath}"
fork="false"/>
<pathconvert property="test.classes" pathsep=",">
<chainedmapper>
<flattenmapper/>
<mapper type="regexp" from="(.*)\.java" to="**/\1\.class"/>
</chainedmapper>
<path>
<filelist dir="${test.dir}/${test.type}/src" files="${files}"/>
</path>
</pathconvert>
<runtests type="${test.type}" include="${test.classes}"/>
</target>
<macrodef name="build-tests">
<attribute name="type"/>
<attribute name="src" default="${test.dir}/@{type}/src"/>
<attribute name="build" default="${test.build.dir}/@{type}"/>
<attribute name="cp" default="${test.classpath.computed}" />
<sequential>
<antcall target="-emma"/>
<echo level="verbose">Compiling tests with classpath : @{cp}</echo>
<javacompile src="@{src}" dest="@{build}" cp="@{cp}" useant="true"/>
<copy todir="@{build}">
<fileset dir="@{src}" includes="${jar.includes}" excludes="${default.jar.excludes}" />
</copy>
</sequential>
</macrodef>
<macrodef name="runsuite">
<attribute name="type"/>
<attribute name="cp" default="${test.classpath.computed}"/>
<attribute name="build" default="${test.build.dir}/@{type}"/>
<sequential>
<fail unless="@{type}.test.suite" message="@{type}.test.suite not defined"/>
<javacompile src="${test.dir}/@{type}/src" dest="@{build}" cp="@{cp}" useant="true"/>
<testsuite suite="${@{type}.test.suite}" out="test/@{type}/results" cp="@{cp}:@{build}"/>
</sequential>
</macrodef>
<macrodef name="testsuite">
<attribute name="suite" description="the java suite to run" />
<attribute name="out" description="The destination for test results"/>
<attribute name="dir" default="${basedir}"/>
<attribute name="cp" default="${build.classpath}:${test.classpath.computed}" />
<sequential>
<mkdir dir="@{out}" />
<junit printsummary="yes" fork="yes" dir="@{dir}" haltonfailure="true">
<assertions />
<formatter type="xml" />
<classpath>
<path path="@{cp}" />
</classpath>
<test name="@{suite}" outfile="@{out}" />
</junit>
</sequential>
</macrodef>
<macrodef name="runtests">
<attribute name="type"/>
<attribute name="src" default="${test.dir}/@{type}/src"/>
<attribute name="out" default="${test.dir}/@{type}/results"/>
<attribute name="build" default="${test.build.dir}/@{type}"/>
<attribute name="dir" default="${basedir}"/>
<attribute name="cp.extra" default=""/>
<attribute name="cp" default="@{cp.extra}:${test.classpath.computed}" />
<attribute name="include" default="**/*Test.class"/>
<attribute name="exclude" default="**/*Suite.class"/>
<attribute name="haltOnFail" default="false"/>
<element name="vmargs" optional="true"/>
<sequential>
<mkdir dir="@{out}"/>
<build-tests type="@{type}" src="@{src}" build="@{build}" cp="@{cp}"/>
<junit printsummary="withOutAndErr" fork="yes" forkmode="once"
dir="@{dir}" haltonfailure="@{haltOnFail}" filtertrace="off" showoutput="yes">
<jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.emma"/>
<jvmarg value="-Demma.coverage.out.merge=true"/>
<jvmarg value="-Demma.verbosity.level=trace1"/>
<jvmarg value="-Dcom.sun.management.jmxremote"/>
<jvmarg value="-Xmx256m"/>
<vmargs/>
<assertions/>
<formatter usefile="false" type="brief"/>
<formatter type="xml"/>
<classpath>
<!-- add instrumented classes first -->
<pathelement path="${coverage.dir}/instr"/>
<path path="@{cp}"/>
<path path="@{build}"/>
<path refid="emma.libs"/>
</classpath>
<batchtest todir="@{out}">
<fileset dir="@{build}"
includes="@{include} ${@{type}.test.include}"
excludes="@{exclude} ${@{type}.test.exclude}">
</fileset>
</batchtest>
</junit>
<emma enabled="${emma.enabled}" >
<report sourcepath="${src.dir}" depth="method" >
<fileset dir="${coverage.dir}" >
<include name="*.emma" />
</fileset>
<html outfile="${coverage.dir}/coverage.html" />
</report>
</emma>
</sequential>
</macrodef>
</project>