[1c9540]: / build / tests.xml  Maximize  Restore  History

Download this file

681 lines (616 with data), 28.6 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
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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
<!--
~ This file is part of the Jikes RVM project (http://jikesrvm.org).
~
~ This file is licensed to You under the Eclipse Public License (EPL);
~ You may not use this file except in compliance with the License. You
~ may obtain a copy of the License at
~
~ http://www.opensource.org/licenses/eclipse-1.0.php
~
~ See the COPYRIGHT.txt file distributed with this work for information
~ regarding copyright ownership.
-->
<project name="tests">
<property name="jikesrvm.dir" location="${basedir}/../../.."/>
<!-- configuration data -->
<property file="${test.rvm.dir}/constants.properties"/>
<if>
<conditions>
<isset property="test-run.file"/>
</conditions>
<sequential>
<property file="${test-run.file}"/>
</sequential>
</if>
<import file="${jikesrvm.dir}/build/base.xml"/>
<import file="${jikesrvm.dir}/build/tasks.xml"/>
<property name="rvm.exe" location="${test.rvm.dir}/rvm"/>
<property name="timedrun.exe" location="${jikesrvm.dir}/bin/timedrun"/>
<property name="extractmmtkstats.exe" location="${jikesrvm.dir}/bin/extractmmtkstats"/>
<property name="extractcompilerstats.exe" location="${jikesrvm.dir}/bin/extractcompilerstats"/>
<!-- Default values -->
<property name="test.mode" value=""/>
<property name="test.time.limit" value="1000"/>
<property name="test.rvm.extra.args" value=""/>
<property name="test.processors" value="all"/>
<property name="test.max.opt.level" value=""/>
<property name="test.initial.heapsize" value="${config.default-heapsize.initial}"/>
<property name="test.max.heapsize" value="${config.default-heapsize.maximum}"/>
<property name="output.dir" location="${test.results.dir}/${test.group.name}"/>
<property name="build.tests.dir" location="${test.build.dir}/${test.group.name}"/>
<property name="results.file" value="${output.dir}/Results.xml"/>
<!-- **************************************************************************** -->
<!-- * * -->
<!-- * Macros for outputting results * -->
<!-- * * -->
<!-- **************************************************************************** -->
<presetdef name="res">
<echo file="${results.file}" append="true"/>
</presetdef>
<macrodef name="startResults">
<sequential>
<res append="false"><![CDATA[<group>
<name>${test.group.name}</name>]]></res>
</sequential>
</macrodef>
<macrodef name="finishResults">
<sequential>
<res><![CDATA[
</group>]]></res>
</sequential>
</macrodef>
<!-- Macro to output results to results file and echo summary to stdout -->
<macrodef name="outputResults">
<attribute name="tag"/>
<sequential>
<outputTestStart tag="@{tag}"/>
<outputTestResults tag="@{tag}"/>
<outputTestEnd/>
<displayTestResults tag="@{tag}"/>
</sequential>
</macrodef>
<!-- Macro to output results with single statistic output -->
<macrodef name="outputSingleStatisticResults">
<attribute name="tag"/>
<attribute name="key"/>
<attribute name="pattern"/>
<sequential>
<outputTestStart tag="@{tag}"/>
<outputStatisticStart/>
<extractStatistic tag="@{tag}" key="@{key}" pattern="@{pattern}"/>
<outputStatisticEnd/>
<outputTestResults tag="@{tag}"/>
<outputTestEnd/>
<displayTestResults tag="@{tag}"/>
</sequential>
</macrodef>
<!-- Macro outputting the start of test. Uses propertys set by rvm macro. See rvm macro for details -->
<macrodef name="outputTestStart">
<attribute name="tag"/>
<sequential>
<outputMultiExecutionTestStart tag="@{tag}"/>
<outputExecutionStart tag="@{tag}" execution="default"/>
</sequential>
</macrodef>
<macrodef name="outputMultiExecutionTestStart">
<attribute name="tag"/>
<sequential>
<res><![CDATA[
<test>
<name>@{tag}</name>
<command><![CDATA[cd ${test.@{tag}.dir} &amp;&amp; ${test.@{tag}.command}]]]]><![CDATA[></command>
<parameters>
<parameter key='initial.heapsize' value='${test.@{tag}.initial.heapsize}'/>
<parameter key='max.heapsize' value='${test.@{tag}.max.heapsize}'/>
<parameter key='time.limit' value='${test.@{tag}.time.limit}'/>
<parameter key='extra.args' value='${test.@{tag}.extra.args}'/>
<parameter key='extra.rvm.args' value='${test.@{tag}.extra.rvm.args}'/>
<parameter key='processors' value='${test.@{tag}.processors}'/>
<parameter key='max.opt.level' value='${test.@{tag}.max.opt.level}'/>
</parameters>
]]></res>
</sequential>
</macrodef>
<macrodef name="outputExecutionStart">
<attribute name="tag"/>
<attribute name="execution"/>
<sequential>
<res><![CDATA[<test-execution><name>@{execution}</name>]]></res>
</sequential>
</macrodef>
<macrodef name="outputStatistic">
<attribute name="key"/>
<attribute name="value"/>
<sequential>
<res><![CDATA[
<statistic key="@{key}" value="@{value}"/>]]></res>
</sequential>
</macrodef>
<macrodef name="outputStatisticStart">
<sequential>
<res><![CDATA[
<statistics>]]></res>
</sequential>
</macrodef>
<macrodef name="outputStatisticEnd">
<sequential>
<res><![CDATA[
</statistics>]]></res>
</sequential>
</macrodef>
<!--
Macro to extract a statist from sanitized output file. If it the pattern does not match then
result is set to failure and explained. If pattern matches then property test.@{tag}.statistic.@{key}
is set to value of match. Finally the statistic is output to results.
-->
<macrodef name="extractStatistic">
<attribute name="tag"/>
<attribute name="execution" default="default"/>
<attribute name="pattern"/>
<attribute name="key"/>
<attribute name="select" default="\1"/>
<attribute name="file" default=""/>
<sequential>
<findStatistic tag="@{tag}" execution="@{execution}" pattern="@{pattern}" key="@{key}" select="@{select}" file="@{file}"/>
<!-- set property if it has not been set -->
<property name="test.@{tag}.@{execution}.statistic.@{key}" value=""/>
<outputStatistic key="@{key}" value="${test.@{tag}.@{execution}.statistic.@{key}}"/>
</sequential>
</macrodef>
<!--
Macro to extract MMTk statistics from a log file. The statistics to extract is a space delimited string.
-->
<macrodef name="extractMMTkStatistics">
<attribute name="tag"/>
<attribute name="execution" default="default"/>
<attribute name="statistics"/>
<sequential>
<exec executable="${extractmmtkstats.exe}" failonerror="false" resultproperty="test.@{tag}.@{execution}.mmtkstats.exit.code">
<arg value="${test.@{tag}.@{execution}.sanitized.output.file}"/>
<arg value="${results.file}"/>
<arg line="@{statistics}"/>
</exec>
<condition property="test.@{tag}.@{execution}.result" value="FAILURE">
<not>
<equals arg1="${test.@{tag}.@{execution}.mmtkstats.exit.code}" arg2="0"/>
</not>
</condition>
<explainResult tag="@{tag}" execution="@{execution}" message="Could not extract MMTk statistics."/>
</sequential>
</macrodef>
<!--
Macro to extract compiler statistics from a log file. The statistics to extract is a space delimited string.
-->
<macrodef name="extractCompilerStatistics">
<attribute name="tag"/>
<attribute name="execution" default="default"/>
<attribute name="statistics"/>
<sequential>
<exec executable="${extractcompilerstats.exe}" failonerror="false" resultproperty="test.@{tag}.@{execution}.compilerstats.exit.code">
<arg value="${test.@{tag}.@{execution}.sanitized.output.file}"/>
<arg value="${results.file}"/>
<arg line="@{statistics}"/>
</exec>
<condition property="test.@{tag}.@{execution}.result" value="FAILURE">
<not>
<equals arg1="${test.@{tag}.@{execution}.compilerstats.exit.code}" arg2="0"/>
</not>
</condition>
<explainResult tag="@{tag}" execution="@{execution}" message="Could not extract compiler statistics."/>
</sequential>
</macrodef>
<!--
Macro to look for pattern in file and fail if unable to find pattern.
-->
<macrodef name="findStatistic">
<attribute name="tag"/>
<attribute name="execution" default="default"/>
<attribute name="pattern"/>
<attribute name="key"/>
<attribute name="select" default="\0"/>
<attribute name="file" default=""/>
<sequential>
<condition property="test.@{tag}.@{execution}.@{key}.input.file"
value="${test.@{tag}.@{execution}.sanitized.output.file}"
else="@{file}">
<equals arg1="@{file}" arg2=""/>
</condition>
<selectRegex property="test.@{tag}.@{execution}.statistic.@{key}"
select="@{select}"
file="${test.@{tag}.@{execution}.@{key}.input.file}"
pattern="@{pattern}"/>
<condition property="test.@{tag}.@{execution}.result" value="FAILURE">
<not>
<isset property="test.@{tag}.@{execution}.statistic.@{key}"/>
</not>
</condition>
<explainResult tag="@{tag}" execution="@{execution}" message="Failed to extract @{key} using pattern @{pattern}"/>
</sequential>
</macrodef>
<macrodef name="outputTestResults">
<attribute name="tag"/>
<sequential>
<outputExecutionResults tag="@{tag}" execution="default"/>
</sequential>
</macrodef>
<macrodef name="outputExecutionResults">
<attribute name="tag"/>
<attribute name="execution"/>
<sequential>
<!-- set results to success if not already set fo failure -->
<property name="test.@{tag}.@{execution}.result" value="SUCCESS"/>
<property name="test.@{tag}.@{execution}.result.explanation" value=""/>
<res><![CDATA[
<exit-code>${test.@{tag}.@{execution}.exit.code}</exit-code>
<duration>${test.@{tag}.@{execution}.time.duration}</duration>
<result>${test.@{tag}.@{execution}.result}</result>
<result-explanation>${test.@{tag}.@{execution}.result.explanation}</result-explanation>]]></res>
<res><![CDATA[
<output><]]>![CDATA[</res>
<toAscii src="${test.@{tag}.@{execution}.output.file}" dest="${build.tests.dir}/deleteme.txt"/>
<!-- truncate output to 500K -->
<truncate file="${build.tests.dir}/deleteme.txt" size="502000"/>
<replace file="${build.tests.dir}/deleteme.txt" token="]]&gt;" value="]]&gt;]]&lt;![CDATA[&gt;"/>
<concat destfile="${results.file}" append="true">
<path path="${build.tests.dir}/deleteme.txt"/>
</concat>
<res>]]<![CDATA[></output>]]></res>
</sequential>
</macrodef>
<macrodef name="outputTestEnd">
<sequential>
<outputExecutionEnd/>
<outputMultiExecutionTestEnd/>
</sequential>
</macrodef>
<macrodef name="outputMultiExecutionTestEnd">
<sequential>
<res><![CDATA[
</test>]]></res>
</sequential>
</macrodef>
<macrodef name="outputExecutionEnd">
<sequential>
<res><![CDATA[
</test-execution>]]></res>
</sequential>
</macrodef>
<macrodef name="displayTestResults">
<attribute name="tag"/>
<sequential>
<displayExecutionResults tag="@{tag}" execution="default"/>
</sequential>
</macrodef>
<macrodef name="displayExecutionResults">
<attribute name="tag"/>
<attribute name="execution"/>
<sequential>
<echo message="Test Result for [${config.name}|${test.group.name}] @{tag} (@{execution}) : ${test.@{tag}.@{execution}.result} ${test.@{tag}.@{execution}.result.explanation}"/>
</sequential>
</macrodef>
<!-- Macro that sets explanation for result if set and not a success -->
<macrodef name="explainResult">
<attribute name="tag"/>
<attribute name="execution" default="default"/>
<attribute name="message"/>
<sequential>
<condition property="test.@{tag}.@{execution}.result.explanation" value="@{message}">
<and>
<isset property="test.@{tag}.@{execution}.result"/>
<not>
<equals arg1="test.@{tag}.@{execution}.result" arg2="SUCCESS"/>
</not>
</and>
</condition>
</sequential>
</macrodef>
<!-- **************************************************************************** -->
<!-- * * -->
<!-- * Macros for cleaning test output * -->
<!-- * * -->
<!-- **************************************************************************** -->
<macrodef name="cleanOutput">
<attribute name="file"/>
<attribute name="tofile"/>
<sequential>
<toAscii src="@{file}" dest="${build.tests.dir}/deleteme.ascii"/>
<!-- TODO: can be replaced by line filtering copy in ant 1.7 -->
<lineFilter src="${build.tests.dir}/deleteme.ascii" dest="@{tofile}">
<filter pattern="^GCspy.startGCspyServer"/>
<filter pattern="^GCspy server on port [0-9]*"/>
<filter pattern="^GCspy safepoint for event [0-9]*"/>
<filter pattern="^GC Warning:"/>
<filter pattern="^GC Message:"/>
<filter pattern="^\[GC [0-9]*"/>
<filter pattern="^\[Forced GC\]*"/>
<filter pattern="^\[End [0-9]*.[0-9]* ms\]*"/>
<filter pattern="^AOS: In non-adaptive mode; controller thread exiting."/>
</lineFilter>
</sequential>
</macrodef>
<!-- **************************************************************************** -->
<!-- * * -->
<!-- * Macros for extractin proeprty for test * -->
<!-- * * -->
<!-- **************************************************************************** -->
<macrodef name="setIfPresent">
<attribute name="name"/>
<attribute name="key"/>
<sequential>
<condition property="@{name}" value="${@{key}}">
<isset property="@{key}"/>
</condition>
</sequential>
</macrodef>
<macrodef name="setTestProperty">
<attribute name="config" default="${config.name}"/>
<attribute name="group" default="${test.group.name}"/>
<attribute name="tag"/>
<attribute name="key"/>
<attribute name="default"/>
<sequential>
<setIfPresent name="test.@{tag}.@{key}" key="test.config.@{config}.@{group}.@{tag}.@{key}"/>
<setIfPresent name="test.@{tag}.@{key}" key="test.config.@{config}.@{group}.@{key}"/>
<setIfPresent name="test.@{tag}.@{key}" key="test.config.@{config}.@{key}"/>
<setIfPresent name="test.@{tag}.@{key}" key="test.config.@{group}.@{tag}.@{key}"/>
<setIfPresent name="test.@{tag}.@{key}" key="test.config.@{group}.@{key}"/>
<setIfPresent name="test.@{tag}.@{key}" key="test.config.@{key}"/>
<property name="test.@{tag}.@{key}" value="@{default}"/>
</sequential>
</macrodef>
<!-- **************************************************************************** -->
<!-- * * -->
<!-- * Macros for executing tests * -->
<!-- * * -->
<!-- **************************************************************************** -->
<!--
This macro is responsible for running the RVM. See the top of this build file for
properties this task defines and uses.
-->
<macrodef name="rvm">
<attribute name="tag" default=""/>
<attribute name="class"/>
<attribute name="args" default=""/>
<attribute name="classpath" default=""/>
<attribute name="bootclasspath" default=""/>
<attribute name="processors" default=""/>
<attribute name="initialHeapSize" default=""/>
<attribute name="maxHeapSize" default=""/>
<attribute name="rvmArgs" default=""/>
<attribute name="timeLimit" default=""/>
<attribute name="maxOptLevel" default=""/>
<attribute name="exitCode" default="0"/>
<attribute name="dir" default="${build.tests.dir}"/>
<attribute name="requires-display" default="false"/>
<sequential>
<prepareRvm tag="@{tag}"
class="@{class}"
args="@{args}"
classpath="@{classpath}"
bootclasspath="@{bootclasspath}"
processors="@{processors}"
initialHeapSize="@{initialHeapSize}"
maxHeapSize="@{maxHeapSize}"
rvmArgs="@{rvmArgs}"
timeLimit="@{timeLimit}"
maxOptLevel="@{maxOptLevel}"
exitCode="@{exitCode}"
dir="@{dir}"
requires-display="@{requires-display}"/>
<invokeRvm tag="@{tag}"/>
</sequential>
</macrodef>
<macrodef name="prepareRvm">
<attribute name="tag" default=""/>
<attribute name="class"/>
<attribute name="args" default=""/>
<attribute name="classpath" default=""/>
<attribute name="bootclasspath" default=""/>
<attribute name="processors" default=""/>
<attribute name="initialHeapSize" default=""/>
<attribute name="maxHeapSize" default=""/>
<attribute name="rvmArgs" default=""/>
<attribute name="timeLimit" default=""/>
<attribute name="maxOptLevel" default=""/>
<attribute name="exitCode" default="0"/>
<attribute name="dir" default="${build.tests.dir}"/>
<attribute name="requires-display" default="false"/>
<sequential>
<condition property="default.test.@{tag}.classpath" value="${test.class.path}" else="@{classpath}">
<equals arg1="@{classpath}" arg2=""/>
</condition>
<condition property="default.test.@{tag}.processors" value="${test.processors}" else="@{processors}">
<equals arg1="@{processors}" arg2=""/>
</condition>
<condition property="default.test.@{tag}.initialHeapSize" value="${test.initial.heapsize}"
else="@{initialHeapSize}">
<equals arg1="@{initialHeapSize}" arg2=""/>
</condition>
<condition property="default.test.@{tag}.maxHeapSize" value="${test.max.heapsize}" else="@{maxHeapSize}">
<equals arg1="@{maxHeapSize}" arg2=""/>
</condition>
<condition property="default.test.@{tag}.timeLimit" value="${test.time.limit}" else="@{timeLimit}">
<equals arg1="@{timeLimit}" arg2=""/>
</condition>
<condition property="default.test.@{tag}.maxOptLevel" value="${test.max.opt.level}" else="@{maxOptLevel}">
<equals arg1="@{maxOptLevel}" arg2=""/>
</condition>
<setTestProperty tag="@{tag}" key="extra.args" default="@{rvmArgs}"/>
<setTestProperty tag="@{tag}" key="extra.rvm.args" default=""/>
<setTestProperty tag="@{tag}" key="class.path" default="${default.test.@{tag}.classpath}"/>
<setTestProperty tag="@{tag}" key="bootclass.path" default="@{bootclasspath}"/>
<setTestProperty tag="@{tag}" key="time.limit" default="${default.test.@{tag}.timeLimit}"/>
<setTestProperty tag="@{tag}" key="initial.heapsize" default="${default.test.@{tag}.initialHeapSize}"/>
<setTestProperty tag="@{tag}" key="max.heapsize" default="${default.test.@{tag}.maxHeapSize}"/>
<setTestProperty tag="@{tag}" key="processors" default="${default.test.@{tag}.processors}"/>
<setTestProperty tag="@{tag}" key="max.opt.level" default="${default.test.@{tag}.maxOptLevel}"/>
<setTestProperty tag="@{tag}" key="exclude" default="false"/>
<condition property="test.@{tag}.maxOptLevel-arg" value=""
else="-X:aos:max_opt_level=${test.@{tag}.max.opt.level}">
<equals arg1="${test.@{tag}.max.opt.level}" arg2=""/>
</condition>
<property name="test.@{tag}.rvm.args"
value="-X:vm:errorsFatal=true -X:processors=${test.@{tag}.processors} -Xms${test.@{tag}.initial.heapsize}M -Xmx${test.@{tag}.max.heapsize}M ${test.@{tag}.extra.args} ${test.rvm.extra.args} ${test.@{tag}.extra.rvm.args} ${test.@{tag}.maxOptLevel-arg}"/>
<property name="test.@{tag}.tag" value="@{tag}"/>
<property name="test.@{tag}.class" value="@{class}"/>
<property name="test.@{tag}.args" value="@{args}"/>
<property name="test.@{tag}.dir" value="@{dir}"/>
<property name="test.@{tag}.expected.exit.code" value="@{exitCode}"/>
<!-- Do we need a display wrapper ? -->
<if>
<conditions>
<and>
<equals arg1="@{requires-display}" arg2="true"/>
<isset property="display-wrapper.exe"/>
</and>
</conditions>
<sequential>
<property name="test.@{tag}.rvm-wrapper.exe" value="${display-wrapper.exe}"/>
<property name="test.@{tag}.rvm.wrapper-args" value="-a ${timedrun.exe}"/>
</sequential>
</if>
<!-- Defaults -->
<property name="test.@{tag}.rvm-wrapper.exe" value="${timedrun.exe}"/>
<property name="test.@{tag}.rvm.wrapper-args" value=""/>
<property name="test.@{tag}.command"
value='${rvm.exe} ${test.@{tag}.rvm.args} ${test.@{tag}.bootclass.path} -classpath "${test.@{tag}.class.path}" ${test.@{tag}.class} ${test.@{tag}.args}'/>
</sequential>
</macrodef>
<macrodef name="invokeRvm">
<attribute name="tag" default=""/>
<attribute name="execution" default="default"/>
<sequential>
<property name="test.@{tag}.@{execution}.output.file" value="${output.dir}/@{tag}.@{execution}-output.txt"/>
<property name="test.@{tag}.@{execution}.sanitized.output.file" value="${output.dir}/@{tag}.@{execution}.txt"/>
<if>
<conditions>
<equals arg1="${test.@{tag}.exclude}" arg2="true"/>
</conditions>
<sequential>
<!-- If excluded then record result -->
<property name="test.@{tag}.@{execution}.result" value="EXCLUDED"/>
<explainResult tag="@{tag}" execution="@{execution}" message="Test excluded."/>
<touch file="${test.@{tag}.@{execution}.output.file}"/>
</sequential>
</if>
<timer property="test.@{tag}.@{execution}.time"/>
<if>
<conditions>
<not>
<equals arg1="${test.@{tag}.exclude}" arg2="true"/>
</not>
</conditions>
<sequential>
<exec executable="${test.@{tag}.rvm-wrapper.exe}"
failonerror="false"
dir="${test.@{tag}.dir}"
resultproperty="test.@{tag}.@{execution}.exit.code">
<!-- Possible arguments for the display wrapper -->
<arg line="${test.@{tag}.rvm.wrapper-args}"/>
<!-- Arguments for the timeout script -->
<arg line="-t ${test.@{tag}.time.limit}"/>
<arg line="-e 200"/>
<arg line="-o ${test.@{tag}.@{execution}.output.file}"/>
<!-- The RVM execution -->
<arg line="${rvm.exe} ${test.@{tag}.rvm.args} ${test.@{tag}.bootclass.path}"/>
<arg value="-classpath"/>
<arg value="${test.@{tag}.class.path}"/>
<arg line="${test.@{tag}.class} ${test.@{tag}.args}"/>
</exec>
</sequential>
</if>
<timer property="test.@{tag}.@{execution}.time" stop="true"/>
<cleanOutput file="${test.@{tag}.@{execution}.output.file}" tofile="${test.@{tag}.@{execution}.sanitized.output.file}"/>
<!-- If we run overtime then record result -->
<condition property="test.@{tag}.@{execution}.result" value="OVERTIME">
<equals arg1="${test.@{tag}.@{execution}.exit.code}" arg2="200"/>
</condition>
<explainResult tag="@{tag}" execution="@{execution}" message="Test exceeded time limit."/>
<!-- check exit codes is valid. Set exitCode to empty string to disable check -->
<condition property="test.@{tag}.@{execution}.result" value="FAILURE">
<and>
<not>
<equals arg1="${test.@{tag}.expected.exit.code}" arg2=""/>
</not>
<not>
<equals arg1="${test.@{tag}.expected.exit.code}" arg2="${test.@{tag}.@{execution}.exit.code}"/>
</not>
</and>
</condition>
<explainResult tag="@{tag}" execution="@{execution}" message="Unexpected exit code."/>
</sequential>
</macrodef>
<!-- test the results of test run against an expected value in file named @{class}@{name}.expected -->
<macrodef name="diffCompareFiles">
<attribute name="tag"/>
<attribute name="execution"/>
<attribute name="expected"/>
<attribute name="actual"/>
<sequential>
<touch file="@{expected}"/>
<touch file="@{actual}"/>
<checksum file="@{expected}" property="test.@{tag}.expected.checksum"/>
<checksum file="@{actual}" property="test.@{tag}.@{execution}.actual.checksum"/>
<condition property="test.@{tag}.@{execution}.result" value="FAILURE">
<not>
<equals arg1="${test.@{tag}.expected.checksum}" arg2="${test.@{tag}.@{execution}.actual.checksum}"/>
</not>
</condition>
<explainResult tag="@{tag}" execution="@{execution}" message="Expected and actual output have different checksums"/>
</sequential>
</macrodef>
<!-- run test then compare output to expected value in file named @{class}@{name}.expected and output results -->
<macrodef name="runCompareTest">
<attribute name="tag"/>
<attribute name="class"/>
<attribute name="classpath" default=""/>
<attribute name="bootclasspath" default=""/>
<attribute name="args" default=""/>
<attribute name="execution" default="default"/>
<attribute name="initialHeapSize" default=""/>
<attribute name="maxHeapSize" default=""/>
<attribute name="rvmArgs" default=""/>
<attribute name="timeLimit" default=""/>
<sequential>
<rvm tag="@{tag}"
class="@{class}"
args="@{args}"
classpath="@{classpath}"
bootclasspath="@{bootclasspath}"
initialHeapSize="@{initialHeapSize}"
maxHeapSize="@{maxHeapSize}"
rvmArgs="@{rvmArgs}"
timeLimit="@{timeLimit}"/>
<echo message="@{class}" file="${build.tests.dir}/deleteme.txt"/>
<replace file="${build.tests.dir}/deleteme.txt" token="." value="${file.separator}"/>
<loadfile property="test.@{tag}.expected.output.file" srcFile="${build.tests.dir}/deleteme.txt"/>
<diffCompareFiles tag="@{tag}"
execution="@{execution}"
expected="${main.java}/${test.@{tag}.expected.output.file}.expected"
actual="${test.@{tag}.default.sanitized.output.file}"/>
<outputResults tag="@{tag}"/>
</sequential>
</macrodef>
<!-- **************************************************************************** -->
<!-- * * -->
<!-- * Initialize properties * -->
<!-- * * -->
<!-- **************************************************************************** -->
<target name="init" depends="check-host-name,prepare-ant-tasks">
<available property="host_file_present" file="${host.file}"/>
<fail unless="host_file_present">
Host file ${host.file} not present. Please set host.name to the name of file in ${jikesrvm.dir}/build/hosts
directory without the .properties suffix.
</fail>
<fail unless="test.group.name" message="test.group.name must be set to name of test group."/>
<fail unless="test.build.dir"
message="test.build.dir must be set to directory to contain intermediate build artifacts."/>
<fail unless="test.results.dir" message="test.results.dir must be set to directory to contain results."/>
<fail unless="test.rvm.dir" message="test.rvm.dir must be set to directory containing rvm image."/>
<available property="rvm.exe_present" file="${rvm.exe}"/>
<fail unless="rvm.exe_present" message="${test.rvm.dir} is not a valid rvm image. Missing rvm program."/>
<fail unless="test.class.path" message="test.class.path needs to be set."/>
<mkdir dir="${build.tests.dir}"/>
<mkdir dir="${output.dir}"/>
</target>
</project>