blob: 32725de283514b18605b75fe31e9f6556d17a349 (
plain)
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
<!-- ============================================================================== -->
<!-- This assumes a complete pre-built eclipse workspace -->
<!-- ============================================================================== -->
<project name="junitModules" default="test-all" basedir=".">
<property name="project.name" value="junitModules"/>
<target name="info">
<echo >
Variables to consider defining:
aspectjrt.path path to release version of runtime
test.classpath use "jar.classpath" or "bin.classpath"
(default is bin if available)
Both require module tests be built with the modules.
bin.classpath: use eclipse bin/ directories
jar.classpath: use build.xml jar files:
cd build
ant clean
ant -Dtrim.testing.default=false build-testing-jars
</echo>
</target>
<target name="init">
<property name="haltOnTestFailure" value="false"/>
<property name="modules.dir"
location="${basedir}/.."/>
<property name="jar.dir"
location="${modules.dir}/aj-build/jars"/>
<property name="tests.module.dir"
location="${modules.dir}/tests"/>
<property name="aspectj.modules.lib.dir"
location="${modules.dir}/lib"/>
<property name="junitModules.output.dir"
location="${tests.module.dir}/bin/junitXmlOutput" />
<property name="aspectjrt.path"
location="${aspectj.modules.lib.dir}/test/aspectjrt.jar"/>
<mkdir dir="${junitModules.output.dir}"/>
<path id="lib.classpath">
<pathelement location="${aspectj.modules.lib.dir}/bcel/bcel.jar" />
<pathelement location="${aspectj.modules.lib.dir}/jdiff/jdiff.jar" />
<pathelement location="${aspectj.modules.lib.dir}/commons/commons.jar" />
<pathelement location="${aspectj.modules.lib.dir}/ant/lib/ant.jar" />
<pathelement location="${aspectj.modules.lib.dir}/ant/lib/xml-apis.jar" />
<pathelement location="${aspectj.modules.lib.dir}/ant/lib/xercesImpl.jar" />
<pathelement location="${aspectj.modules.lib.dir}/junit/junit.jar" />
<pathelement location="${modules.dir}/org.eclipse.jdt.core/jdtcore-for-aspectj.jar" />
</path>
<path id="bin.classpath">
<pathelement location="${modules.dir}/ajde/bin" />
<pathelement location="${modules.dir}/ajbrowser/bin" />
<pathelement location="${modules.dir}/asm/bin" />
<pathelement location="${modules.dir}/bridge/bin" />
<pathelement location="${modules.dir}/build/bin" />
<pathelement location="${modules.dir}/org.aspectj.ajdt.core/bin" />
<pathelement location="${modules.dir}/runtime/bin" />
<pathelement location="${modules.dir}/taskdefs/bin" />
<pathelement location="${modules.dir}/testing/bin" />
<pathelement location="${modules.dir}/testing-client/bin" />
<pathelement location="${modules.dir}/testing-drivers/bin" />
<pathelement location="${modules.dir}/testing-util/bin" />
<pathelement location="${modules.dir}/util/bin" />
<pathelement location="${modules.dir}/weaver/bin" />
<path refid="lib.classpath"/>
</path>
<!-- requires normal build, i.e., with test classes -->
<path id="jar.classpath">
<pathelement location="${jar.dir}/ajde.jar" />
<pathelement location="${jar.dir}/ajbrowser.jar" />
<pathelement location="${jar.dir}/asm.jar" />
<pathelement location="${jar.dir}/bridge.jar" />
<pathelement location="${jar.dir}/build.jar" />
<pathelement location="${jar.dir}/org.aspectj.ajdt.core.jar" />
<pathelement location="${jar.dir}/runtime.jar" />
<pathelement location="${jar.dir}/taskdefs.jar" />
<pathelement location="${jar.dir}/testing.jar" />
<pathelement location="${jar.dir}/testing-client.jar" />
<pathelement location="${jar.dir}/testing-drivers.jar" />
<pathelement location="${jar.dir}/testing-util.jar" />
<pathelement location="${jar.dir}/util.jar" />
<pathelement location="${jar.dir}/weaver.jar" />
<path refid="lib.classpath"/>
</path>
<available property="bin.path.available"
file="${modules.dir}/weaver/bin"/>
<available property="jar.path.available"
file="${jar.dir}/asm.jar"/>
</target>
<target name="select-path"
depends="select-jar,select-bin"
unless="test.classpath"/>
<target name="select-bin" depends="init"
if="bin.path.available">
<property name="test.classpath" value="bin.classpath"/>
</target>
<target name="select-jar" depends="init"
if="jar.path.available" unless="bin.path.available">
<property name="test.classpath" value="jar.classpath"/>
</target>
<target name="clean" depends="init">
<delete dir="${junitModules.output.dir}"/>
</target>
<target name="jdepend" depends="init"
description="run jdepend - untested">
<jdepend format="xml">
<sourcespath>
<pathelement location="${tests.module.dir}/../testing/src" />
</sourcespath>
<classpath>
<pathelement location="${tests.module.dir}/../bin" />
</classpath>
</jdepend>
</target>
<target name="redirect-test-all" depends="init"
description="run from another Ant process to redirect output">
<antcall target="clean"/>
<mkdir dir="${junitModules.output.dir}"/>
<ant dir="${basedir}"
antfile="junitModules.xml"
target="run-test-all"
inheritAll="false"
output="${junitModules.output.dir}/output.txt"/>
<echo message="View log in ${junitModules.output.dir}/output.txt"/>
<property name="fileUrl"
location="${junitModules.output.dir}/html/index.html"/>
<echo message="View results in file:${fileUrl}"/>
</target>
<target name="test-all-at-once" depends="init,select-path"
description="run all module tests (except IDE integrations)">
<echo message="fails - AJDE needs ../ajde-style paths"/>
<mkdir dir="${junitModules.output.dir}"/>
<delete dir="${junitModules.output.dir}"/>
<mkdir dir="${junitModules.output.dir}"/>
<junit fork="on"
includeAntRuntime="off"
dir="${tests.module.dir}"
printsummary="yes"
haltonfailure="${haltOnTestFailure}" >
<classpath>
<path refid="${test.classpath}"/>
</classpath>
<jvmarg value="-Daspectjrt.path=${aspectjrt.path}" />
<formatter type="xml"/>
<batchtest todir="${junitModules.output.dir}">
<formatter type="xml"/>
<fileset dir="${modules.dir}/ajbrowser/testsrc">
<include name="*ModuleTests.java" />
</fileset>
<fileset dir="${modules.dir}/asm/testsrc">
<include name="*ModuleTests.java" />
</fileset>
<fileset dir="${modules.dir}/ajde/testsrc">
<include name="*ModuleTests.java" />
</fileset>
<fileset dir="${modules.dir}/bridge/testsrc">
<include name="*ModuleTests.java" />
</fileset>
<fileset dir="${modules.dir}/build/testsrc">
<include name="*ModuleTests.java" />
</fileset>
<fileset dir="${modules.dir}/org.aspectj.ajdt.core/testsrc">
<include name="*ModuleTests.java" />
</fileset>
<fileset dir="${modules.dir}/runtime/testsrc">
<include name="*ModuleTests.java" />
</fileset>
<fileset dir="${modules.dir}/taskdefs/testsrc">
<include name="*ModuleTests.java" />
</fileset>
<fileset dir="${modules.dir}/testing/testsrc">
<include name="*ModuleTests.java" />
</fileset>
<fileset dir="${modules.dir}/testing-client/testsrc">
<include name="*ModuleTests.java" />
</fileset>
<fileset dir="${modules.dir}/testing-drivers/testsrc">
<include name="*ModuleTests.java" />
</fileset>
<fileset dir="${modules.dir}/testing-util/testsrc">
<include name="*ModuleTests.java" />
</fileset>
<fileset dir="${modules.dir}/util/testsrc">
<include name="*ModuleTests.java" />
</fileset>
<fileset dir="${modules.dir}/weaver/testsrc">
<include name="*ModuleTests.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="test-all" depends="init,select-path"
description="run all module tests (except IDE integrations)">
<mkdir dir="${junitModules.output.dir}"/>
<delete dir="${junitModules.output.dir}"/>
<mkdir dir="${junitModules.output.dir}"/>
<antcall target="run-module-junit-tests">
<param name="moduleName" value="ajbrowser"/>
</antcall>
<antcall target="run-module-junit-tests">
<param name="moduleName" value="ajde"/>
</antcall>
<antcall target="run-module-junit-tests">
<param name="moduleName" value="asm"/>
</antcall>
<antcall target="run-module-junit-tests">
<param name="moduleName" value="weaver"/>
</antcall>
<antcall target="run-module-junit-tests">
<param name="moduleName" value="bridge"/>
</antcall>
<antcall target="run-module-junit-tests">
<param name="moduleName" value="build"/>
</antcall>
<antcall target="run-module-junit-tests">
<param name="moduleName" value="org.aspectj.ajdt.core"/>
</antcall>
<!-- no JUnit testsrc in org.eclipse.jdt.core -->
<antcall target="run-module-junit-tests">
<param name="moduleName" value="runtime"/>
</antcall>
<antcall target="run-module-junit-tests">
<param name="moduleName" value="taskdefs"/>
</antcall>
<antcall target="run-module-junit-tests">
<param name="moduleName" value="testing"/>
</antcall>
<antcall target="run-module-junit-tests">
<param name="moduleName" value="testing-client"/>
</antcall>
<antcall target="run-module-junit-tests">
<param name="moduleName" value="testing-drivers"/>
</antcall>
<antcall target="run-module-junit-tests">
<param name="moduleName" value="testing-util"/>
</antcall>
<antcall target="run-module-junit-tests">
<param name="moduleName" value="util"/>
</antcall>
<antcall target="report-tests"/>
</target>
<target name="init-taskdefs" depends="init"
description="define junit taskdefs" >
<property name="aj.taskdef.package"
value="org.aspectj.internal.tools.ant.taskdefs"/>
<taskdef name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
<classpath>
<pathelement location="${aspectj.modules.lib.dir}/ant/xlib/optional.jar" />
<pathelement location="${aspectj.modules.lib.dir}/junit/junit.jar" />
</classpath>
</taskdef>
<taskdef name="junitreport"
classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator">
<classpath>
<pathelement location="${aspectj.modules.lib.dir}/ant/xlib/optional.jar" />
<pathelement location="${aspectj.modules.lib.dir}/junit/junit.jar" />
</classpath>
</taskdef>
</target>
<target name="run-module-junit-tests" depends="init-taskdefs"
description="run all junit tests for a module">
<mkdir dir="${junitModules.output.dir}/${moduleName}"/>
<!-- fork to load classes, include AntRuntime to get taskdef classes junit.jar -->
<echo message="Starting ${moduleName} tests..."/>
<junit fork="on"
includeAntRuntime="off"
dir="${modules.dir}/${moduleName}"
printsummary="yes"
haltonfailure="${haltOnTestFailure}" >
<classpath>
<path refid="${test.classpath}"/>
</classpath>
<!-- AMC added this next line, needed when testing release builds,
(those whose version is something other than DEVELOPMENT). The NullIdeAdapter
used for various Ajde tests picks up this property and adds it to the project
classpath, which allows the Ajde version tests to complete.
Having built a release version, use e.g.
ant -Daspectjrt.path=../aj-build/dist/lib/aspectjrt.jar
-->
<jvmarg value="-Daspectjrt.path=${aspectjrt.path}" />
<formatter type="xml"/>
<batchtest todir="${junitModules.output.dir}/${moduleName}">
<formatter type="xml"/>
<fileset dir="${modules.dir}/${moduleName}/testsrc">
<include name="*ModuleTests.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="report-tests" depends="init-taskdefs">
<mkdir dir="${junitModules.output.dir}/html"/>
<junitreport todir="${junitModules.output.dir}/html"
tofile="results.html">
<fileset dir="${junitModules.output.dir}/">
<include name="**/TEST-*.xml"/>
</fileset>
<report format="frames"
todir="${junitModules.output.dir}/html"/>
</junitreport>
<property name="fileUrl"
location="${junitModules.output.dir}/html/index.html"/>
<echo message="View results in file:${fileUrl}"/>
</target>
</project>
|