source: release-kits/lirk3/resources/gs3-release-maker/apache-ant-1.6.5/src/etc/testcases/taskdefs/java.xml@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 11.0 KB
Line 
1<?xml version="1.0"?>
2
3<project name="java-test" basedir="." default="foo">
4 <fail unless="tests-classpath.value"
5 message="the property tests-classpath.value is required by this test" />
6 <!-- this property gets overridden programmatically-->
7 <property name="timeToWait" value="4"/>
8 <!-- this property gets overridden programmatically-->
9 <property name="logFile" value="spawn.log"/>
10 <property name="tmp" location="${java.io.tmpdir}"/>
11 <property name="app"
12 value="org.apache.tools.ant.taskdefs.JavaTest$$EntryPoint" />
13
14 <property name="app2"
15 value="org.apache.tools.ant.taskdefs.JavaTest$$ExceptingEntryPoint" />
16
17 <property name="spawnapp"
18 value="org.apache.tools.ant.taskdefs.JavaTest$$SpawnEntryPoint" />
19
20 <property name="pipeapp"
21 value="org.apache.tools.ant.taskdefs.JavaTest$$PipeEntryPoint" />
22
23 <target name="testNoJarNoClassname">
24 <java/>
25 </target>
26
27 <target name="testJarNoFork">
28 <java jar="test.jar" fork="false"/>
29 </target>
30
31
32 <target name="testJarAndClassName">
33 <java jar="test.jar" classname="${app}" />
34 </target>
35
36 <target name="testClassnameAndJar">
37 <java classname="${app}" jar="test.jar" />
38 </target>
39
40 <target name="testRun">
41 <fail unless="tests-classpath.value" />
42 <java classname="${app}"
43 classpath="${tests-classpath.value}"/>
44 </target>
45
46 <target name="testRunFail">
47 <java classname="${app}"
48 classpath="${tests-classpath.value}"
49 >
50 <arg value="2"/>
51 </java>
52 </target>
53
54 <target name="testRunFailFoe">
55 <java classname="${app}"
56 classpath="${tests-classpath.value}"
57 failonerror="true">
58 <arg value="2"/>
59 </java>
60 </target>
61
62 <target name="testRunFailFoeFork">
63 <java classname="${app}"
64 classpath="${tests-classpath.value}"
65 failonerror="true"
66 fork="true">
67 <arg value="2"/>
68 </java>
69 </target>
70
71 <target name="testExcepting">
72 <java classname="${app2}"
73 classpath="${tests-classpath.value}"
74 >
75 </java>
76 </target>
77
78 <target name="testExceptingFork">
79 <java classname="${app2}"
80 classpath="${tests-classpath.value}"
81 fork="true">
82 </java>
83 </target>
84
85 <target name="testExceptingFoe">
86 <java classname="${app2}"
87 classpath="${tests-classpath.value}"
88 failonerror="true">
89 </java>
90 </target>
91
92 <target name="testExceptingFoeFork">
93 <java classname="${app2}"
94 classpath="${tests-classpath.value}"
95 failonerror="true"
96 fork="true">
97 </java>
98 </target>
99
100 <target name="testResultPropertyZero">
101 <java classname="${app}"
102 classpath="${tests-classpath.value}"
103 resultproperty="exitcode"
104 fork="true"
105 >
106 </java>
107 <echo message="exitcode = ${exitcode}"/>
108 </target>
109
110 <target name="testResultPropertyNonZero">
111 <java classname="${app}"
112 classpath="${tests-classpath.value}"
113 resultproperty="exitcode"
114 failonerror="false"
115 fork="true"
116 >
117 <arg value="2"/>
118 </java>
119 <echo message="exitcode = ${exitcode}"/>
120 </target>
121
122 <target name="testResultPropertyZeroNoFork">
123 <java classname="${app}"
124 classpath="${tests-classpath.value}"
125 resultproperty="exitcode"
126 fork="false"
127 >
128 <permissions/>
129 </java>
130 <echo message="exitcode = ${exitcode}"/>
131 </target>
132
133 <target name="testResultPropertyNonZeroNoFork">
134 <java classname="${app}"
135 classpath="${tests-classpath.value}"
136 resultproperty="exitcode"
137 failonerror="false"
138 fork="false">
139 <arg value="-1"/>
140 <permissions/>
141 </java>
142 <echo message="exitcode = ${exitcode}"/>
143 </target>
144
145 <target name="testRunFailWithFailOnError">
146 <java classname="${app}"
147 classpath="${tests-classpath.value}"
148 failonerror="true"
149 >
150 <arg value="2"/>
151 </java>
152 </target>
153
154 <target name="testRunSuccessWithFailOnError">
155 <java classname="${app}"
156 classpath="${tests-classpath.value}"
157 failonerror="true"
158 >
159 <arg value="0"/>
160 </java>
161 </target>
162
163 <target name="testSpawn">
164 <java classname="${spawnapp}" fork="true" spawn="true" classpath="${tests-classpath.value}">
165 <arg value="${timeToWait}"/>
166 <arg value="${logFile}" />
167 </java>
168 </target>
169
170 <!--redirection testcases don't want to run under junit unless forked-->
171 <target name="redirect1">
172 <condition property="sleeptime" value="2000">
173 <os family="windows"/>
174 </condition>
175 <property name="sleeptime" value="1"/>
176 <property name="outfile" location="${tmp}/redirect.out" />
177
178 <java classname="${pipeapp}"
179 classpath="${tests-classpath.value}"
180 inputstring="foo"
181 fork="true"
182 output="${outfile}"
183 errorproperty="redirect.err">
184 <arg value="out" />
185 </java>
186
187 <!-- let dumb Windows catch up -->
188 <waitfor>
189 <available file="${outfile}" />
190 </waitfor>
191 <sleep milliseconds="${sleeptime}"/>
192 <loadfile property="redirect.out.contents" srcfile="${outfile}" />
193
194 <condition property="r1file">
195 <equals arg1="${redirect.out.contents}" arg2="foo" />
196 </condition>
197
198 <fail unless="r1file">${outfile}:
199&quot;${redirect.out.contents}&quot; expected &quot;foo&quot;</fail>
200
201 <condition property="r1prop">
202 <equals arg1="${redirect.err}" arg2="" />
203 </condition>
204
205 <fail unless="r1prop">
206redirect.err=&quot;${redirect.err}&quot; should be empty</fail>
207
208 </target>
209
210 <target name="redirect2" depends="redirect1">
211 <property name="outfile" location="${tmp}/redirect.out" />
212
213 <java classname="${pipeapp}"
214 classpath="${tests-classpath.value}"
215 inputstring="bar"
216 append="true"
217 fork="true"
218 output="${outfile}"
219 errorproperty="redirect.err">
220 <arg value="both" />
221 </java>
222
223 <!-- let dumb Windows catch up -->
224 <waitfor>
225 <available file="${outfile}" />
226 </waitfor>
227 <sleep milliseconds="${sleeptime}"/>
228
229 <loadfile property="redirect.out.contents2" srcfile="${outfile}" />
230
231 <condition property="r2file">
232 <equals arg1="${redirect.out.contents2}" arg2="foobar" />
233 </condition>
234
235 <fail unless="r2file">${outfile}:
236&quot;${redirect.out.contents2}&quot; expected &quot;foobar&quot;</fail>
237
238 <condition property="r2prop">
239 <!-- property should not change -->
240 <equals arg1="${redirect.err}" arg2="" />
241 </condition>
242
243 <fail unless="r2prop">
244redirect.err=&quot;${redirect.err}&quot; should be empty</fail>
245
246 </target>
247
248 <target name="redirect3">
249 <property name="outfile" location="${tmp}/redirect.out" />
250 <property name="errfile" location="${tmp}/redirect.err" />
251
252 <java classname="${pipeapp}"
253 classpath="${tests-classpath.value}"
254 inputstring="foo"
255 fork="true"
256 output="${outfile}"
257 error="${errfile}">
258 <arg value="both" />
259 </java>
260
261 <!-- let dumb Windows catch up -->
262 <waitfor>
263 <and>
264 <available file="${outfile}" />
265 <available file="${errfile}" />
266 </and>
267 </waitfor>
268
269 <loadfile property="redirect.out.contents" srcfile="${outfile}" />
270
271 <condition property="r3file">
272 <equals arg1="${redirect.out.contents}" arg2="foo" />
273 </condition>
274
275 <fail unless="r3file">${outfile}:
276&quot;${redirect.out.contents}&quot; expected &quot;foo&quot;</fail>
277
278 <condition property="r3match">
279 <filesmatch file1="${outfile}" file2="${errfile}" />
280 </condition>
281
282 <fail unless="r3file">${errfile} differs from ${outfile}</fail>
283
284 </target>
285
286 <target name="redirector1">
287 <property name="outfile" location="${tmp}/redirector.out" />
288 <property name="errfile" location="${tmp}/redirector.err" />
289
290 <java taskname="foo" classname="${pipeapp}" fork="true"
291 classpath="${tests-classpath.value}">
292 <redirector inputstring="foo"
293 output="${outfile}"
294 error="${errfile}"
295 createemptyfiles="false" />
296 <arg value="out" />
297 </java>
298
299 <!-- let dumb Windows catch up -->
300 <waitfor>
301 <available file="${outfile}" />
302 </waitfor>
303
304 <loadfile property="redirector.out.contents" srcfile="${outfile}" />
305
306 <condition property="ror1out">
307 <equals arg1="${redirector.out.contents}" arg2="foo" />
308 </condition>
309
310 <fail unless="ror1out">${outfile}:
311&quot;${redirector.out.contents}&quot; expected &quot;foo&quot;</fail>
312
313 <condition property="ror1noerr">
314 <not>
315 <available file="${errfile}" />
316 </not>
317 </condition>
318 <fail unless="ror1noerr">${errfile} exists but should not</fail>
319 </target>
320
321 <target name="redirector2" depends="redirector1">
322 <property name="outfile" location="${tmp}/redirector.out" />
323 <property name="errfile" location="${tmp}/redirector.err" />
324
325 <!-- fork here; some VMs can be ill-behaved with files,
326 such as W!nd0ws -->
327 <java taskname="foo" classname="${pipeapp}" fork="true"
328 classpath="${tests-classpath.value}">
329 <redirector inputstring="foo"
330 append="true"
331 output="${outfile}"
332 error="${errfile}"
333 createemptyfiles="false">
334 <errorfilterchain>
335 <replacestring from="foo" to="bar" />
336 </errorfilterchain>
337 </redirector>
338 <arg value="both" />
339 </java>
340
341 <!-- let dumb Windows catch up -->
342 <waitfor>
343 <and>
344 <available file="${outfile}" />
345 <available file="${errfile}" />
346 </and>
347 </waitfor>
348
349 <loadfile property="redirector.out.contents2"
350 srcfile="${outfile}" />
351
352 <loadfile property="redirector.err.contents"
353 srcfile="${errfile}" />
354
355 <condition property="ror2out">
356 <equals arg1="${redirector.out.contents2}" arg2="foofoo" />
357 </condition>
358
359 <fail unless="ror1out">${outfile}:
360&quot;${redirector.out.contents}&quot; expected &quot;foofoo&quot;</fail>
361
362 <condition property="ror2err">
363 <equals arg1="${redirector.err.contents}" arg2="bar" />
364 </condition>
365
366 <fail unless="ror1out">${errfile}:
367&quot;${redirector.err.contents}&quot; expected &quot;bar&quot;</fail>
368
369 </target>
370
371 <target name="cleanup">
372 <delete>
373 <fileset file="${logFile}" />
374 <fileset dir="${tmp}" includes="redirect*" />
375 </delete>
376 </target>
377
378 <target name="foo" />
379</project>
Note: See TracBrowser for help on using the repository browser.