summaryrefslogtreecommitdiffstats
path: root/make/build-test.xml
blob: dd3db3e1497bdc499b7e30c6eda11577701c3052 (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
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
681
682
683
684
685
686
687
<?xml version="1.0" encoding="UTF-8"?>

<project name="JOGLTest" basedir="." default="all">

    <description>JUNIT Tests JOGL</description>

    <property name="jogl.basename" value="jogl" /> <!-- if differs, ie jenkins jobname, must be set properly first -->
    <echo message="jogl.basename: ${jogl.basename}"/>

    <import file="build-common.xml"/>

    <taskdef resource="net/sf/antcontrib/antlib.xml">
      <classpath> <pathelement location="${ant-contrib.jar}"/> </classpath>
    </taskdef>

    <!-- ================================================================== -->
    <!-- 
       - Declare all paths and user defined variables.
      -->
    <target name="declare.common" description="Declare properties" depends="common.init">
        <property name="rootrel.src.test"     value="src/test" />
        <property name="src.test"             value="${project.root}/${rootrel.src.test}" />

        <property name="classes"              value="${build.test}/classes" />
        <property name="classes.path"         location="${classes}"/> <!-- absolute path -->

        <property name="java.part.test"       value="com/jogamp/** jogamp/**"/>
        <property name="java.dir.test"        value="com/jogamp/opengl/test"/>
        <property name="java.dir.junit"       value="${java.dir.test}/junit"/>
        <property name="java.dir.bugs"        value="${java.dir.test}/bugs"/>

        <property name="test.archive.name"    value="${archive.name}-test-results-${build.node.name}"/>
        <condition property="jvmarg.mainthrd" value="-XstartOnFirstThread"><isset property="isOSX"/></condition>
        <condition property="jvmarg.mainthrd" value="-Ddummy"><not><isset property="isOSX"/></not></condition>
        <condition property="jvmarg.headless" value="-XstartOnFirstThread -Djava.awt.headless=true"><isset property="isOSX"/></condition>
        <condition property="jvmarg.headless" value="-Djava.awt.headless=true"><not><isset property="isOSX"/></not></condition>

        <property name="batchtest.timeout"    value="1800000"/> <!-- 30 min -->
    </target>
    
    <!-- ================================================================== -->
    <!--
       - Clean up all that is built.
      -->
    <target name="clean" description="Remove all build products" depends="declare.common">
        <delete includeEmptyDirs="true" quiet="true">
            <fileset dir="${build.test}" />
            <fileset dir="." includes="*.tga" />
            <fileset file="${jogl.test.jar}" />
        </delete>
    </target>

    <!-- ================================================================== -->
    <!--
       - Build/run tests/junit.
      -->
    <target name="test.compile.check" depends="declare.common">
      <!-- Create the required output directories. -->
      <mkdir dir="${obj.test}" />
      <mkdir dir="${classes}" />

      <property name="jogl.test.jar.path" location="${jogl.test.jar}"/> <!-- absolute path -->
      <echo message="jogl.test.jar ${jogl.test.jar.path}"/>
      <uptodate property="test.compile.skip">
        <srcfiles dir= "."                 includes="*.xml"/>
        <srcfiles dir= "${src.test}"       includes="**"/>
        <srcfiles                          file="${gluegen.jar}" />
        <srcfiles                          dir="${src}/nativewindow" />
        <srcfiles                          dir="${src}/jogl" />
        <srcfiles                          dir="${src}/newt" />
        <mapper type="merge" to="${jogl.test.jar.path}"/>
      </uptodate>
    </target>

    <target name="test.compile" depends="test.compile.check" unless="test.compile.skip">
        <!-- Perform the junit pass Java compile -->
        <javac destdir="${classes}"
               fork="yes"
               includeAntRuntime="false"
               memoryMaximumSize="${javac.memorymax}"
               encoding="UTF-8"
               source="${target.sourcelevel}" 
               target="${target.targetlevel}" 
               bootclasspath="${target.rt.jar}"
               debug="${javacdebug}" debuglevel="${javacdebuglevel}">
            <classpath refid="junit_jogl_newt_android.compile.classpath"/>
            <src path="${src.test}" />
        </javac>
        <!-- include any resource files that tests may require -->
        <copy todir="${classes}">
            <fileset dir="${src.test}">
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
        <jar destfile="${jogl.test.jar}" filesonly="true">
            <!-- get all class files, but skip any resource files that external tools
                 might have copied into the class directory (otherwise, it's possible
                 to get the same resource file twice in the jar) -->
            <fileset dir="${classes}"
                includes="${java.part.test}"/>
        </jar>
    </target>

    <target name="test.manual.run" depends="test.compile">
        <for param="test.class.path.m" keepgoing="true">
            <!-- results in absolute path -->
            <fileset dir="${classes}">
                <include name="${java.dir.bugs}/**/*Test*"/>
                <exclude name="**/*$$*"/>
            </fileset>
          <sequential>
            <var name="test.class.path" unset="true"/>
            <property name="test.class.path" basedir="${classes}" relative="true" location="@{test.class.path.m}"/>
            <var name="test.class.fqn" unset="true"/>
            <pathconvert property="test.class.fqn">
              <fileset file="${classes}${file.separator}${test.class.path}"/>
              <chainedmapper>
                  <globmapper    from="${classes.path}${file.separator}*" to="*"/> <!-- rel. -->
                  <packagemapper from="*.class"           to="*"/> <!-- FQCN -->
              </chainedmapper>
            </pathconvert>
            <var name="test.class.result.file" value="${results.test}/TEST-${test.class.fqn}.log"/>
            <echo message="Testing ${test.class.fqn} -- ${test.class.result.file}"/>
            <apply dir="." executable="${java.home}/bin/java" 
                 parallel="false" 
                 timeout="${batchtest.timeout}"
                 vmlauncher="false"
                 relative="true"
                 failonerror="false"
                 output="${test.class.result.file}">
                <env key="${system.env.library.path}" path="${obj.all.paths}"/>
                <env key="CLASSPATH" value="${junit_jogl_awt.run.jars}"/>
                <arg line="${junit.run.arg0}"/>
                <arg line="${junit.run.arg1}"/>
                <arg line="${jvmDataModel.arg}"/>
                <arg value="-Djava.library.path=${obj.all.paths}"/>
                <!--
                <arg line="-Dnewt.debug.EDT"/>
                -->
                <srcfile/>
                <mappedresources>
                    <fileset dir="${classes}" includes="${test.class.path}"/>
                    <packagemapper from="*.class" to="*"/>
                </mappedresources>
            </apply>
          </sequential>
        </for>
        <antcall target="test-zip-archive" inheritRefs="true" inheritAll="true"/>
    </target>

    <target name="junit.run.noui" depends="test.compile">
        <!-- Test*NOUI* -->
        <junit forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
            <env key="${system.env.library.path}" path="${obj.all.paths}"/>
            <jvmarg value="${junit.run.arg0}"/>
            <jvmarg value="${junit.run.arg1}"/>
            <jvmarg value="${jvmDataModel.arg}"/>
            <jvmarg value="-Djava.library.path=${obj.all.paths}"/>

            <!--
            <jvmarg value="-Djogl.debug=all"/>
            <jvmarg value="-Dgluegen.debug.NativeLibrary=true"/>
            <jvmarg value="-Dgluegen.debug.ProcAddressHelper=true"/>
            <jvmarg value="-Djogl.debug.GLSLState"/>
            <jvmarg value="-Dnativewindow.debug=all"/>
            <jvmarg value="-verbose:jni"/> 
            <jvmarg value="-client"/>
            <jvmarg value="-d32"/>
            -->

            <formatter usefile="false" type="plain"/>
            <formatter usefile="true" type="xml"/>
            <classpath refid="junit_jogl_awt.run.classpath"/>

            <batchtest todir="${results.test}">
              <fileset dir="${classes}">
                  <include name="${java.dir.junit}/**/Test*NOUI*"/>
                  <exclude name="**/*$$*"/>
              </fileset>
              <formatter usefile="false" type="brief"/>
              <formatter usefile="true" type="xml"/>
            </batchtest>
        </junit>
    </target>

    <target name="junit.run.newt.headless" depends="test.compile">
        <!-- Test*NEWT* 

             Emulation of junit task,
             due to the fact that we have to place invoke our MainThread class first (-> MacOSX).

             Utilizing Ant-1.8.0 and ant-contrib-1.0b3 (loops, mutable properties).
          --> 
        <for param="test.class.path.m" keepgoing="true">
            <!-- results in absolute path -->
            <fileset dir="${classes}">
                <include name="${java.dir.junit}/**/Test*NEWT*"/>
                <exclude name="**/*$$*"/>
            </fileset>
          <sequential>
            <var name="test.class.path" unset="true"/>
            <property name="test.class.path" basedir="${classes}" relative="true" location="@{test.class.path.m}"/>
            <var name="test.class.fqn" unset="true"/>
            <pathconvert property="test.class.fqn">
              <fileset file="${classes}${file.separator}${test.class.path}"/>
              <chainedmapper>
                  <globmapper    from="${classes.path}${file.separator}*" to="*"/> <!-- rel. -->
                  <packagemapper from="*.class"           to="*"/> <!-- FQCN -->
              </chainedmapper>
            </pathconvert>
            <var name="test.class.result.file" value="${results.test}/TEST-${test.class.fqn}.xml"/>
            <echo message="Testing ${test.class.fqn} -- ${test.class.result.file}"/>
            <apply dir="." executable="${java.home}/bin/java" 
                 parallel="false" 
                 timeout="${batchtest.timeout}"
                 vmlauncher="false"
                 relative="true"
                 failonerror="false">
                <env key="${system.env.library.path}" path="${obj.all.paths}"/>
                <env key="CLASSPATH" value="${junit_jogl_noawt.run.jars}"/>
                <arg line="${junit.run.arg0}"/>
                <arg line="${junit.run.arg1}"/>
                <arg line="${jvmDataModel.arg}"/>
                <arg value="-Djava.library.path=${obj.all.paths}"/>
                <arg line="${jvmarg.headless}"/>
                <!--
                <arg line="-Dnewt.debug.EDT"/>
                -->
                <arg line="com.jogamp.newt.util.MainThread"/>
                <arg line="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner"/>
                <srcfile/>
                <arg line="filtertrace=true"/>
                <arg line="haltOnError=false"/>
                <arg line="haltOnFailure=false"/>
                <arg line="showoutput=true"/>
                <arg line="outputtoformatters=true"/>
                <arg line="logfailedtests=true"/>
                <arg line="logtestlistenerevents=true"/>
                <arg line="formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter"/>
                <arg line="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.class.result.file}"/>
                <mappedresources>
                    <fileset dir="${classes}" includes="${test.class.path}"/>
                    <packagemapper from="*.class" to="*"/>
                </mappedresources>
            </apply>
          </sequential>
        </for>
    </target>

    <!-- junit.run.newt is covered by junit.run.newt.headless, disable it for now, but may be checked manually.
         This test target would also overwrite the test result XML files, we would also need a solution here for hudson,
         if run in parallel.
      -->
    <target name="junit.run.newt" depends="test.compile">
        <!-- Test*NEWT* -->
        <junit forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
            <env key="${system.env.library.path}" path="${obj.all.paths}"/>
            <jvmarg value="${junit.run.arg0}"/>
            <jvmarg value="${junit.run.arg1}"/>
            <jvmarg value="${jvmDataModel.arg}"/>
            <jvmarg value="-Djava.library.path=${obj.all.paths}"/>

            <!--
            <jvmarg value="-Dnewt.debug.EDT"/>
            <jvmarg value="-Djogl.debug=all"/>
            <jvmarg value="-Dgluegen.debug.NativeLibrary=true"/>
            <jvmarg value="-Dgluegen.debug.ProcAddressHelper=true"/>
            <jvmarg value="-Djogl.debug.GLSLState"/>
            <jvmarg value="-Dnativewindow.debug=all"/>
            <jvmarg value="-Dnewt.debug=all"/>
            <jvmarg value="-verbose:jni"/> 
            <jvmarg value="-client"/>
            <jvmarg value="-d32"/>
            -->

            <formatter usefile="false" type="plain"/>
            <formatter usefile="true" type="xml"/>
            <classpath refid="junit_jogl_noawt.run.classpath"/>

            <batchtest todir="${results.test}">
              <fileset dir="${classes}">
                  <include name="${java.dir.junit}/**/Test*NEWT*"/>
                  <exclude name="**/*$$*"/>
              </fileset>
              <formatter usefile="false" type="brief"/>
              <formatter usefile="true" type="xml"/>
            </batchtest>
        </junit>
    </target>

    <target name="junit.run.awt" depends="test.compile">
        <!-- Test*AWT* -->
        <junit forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
            <env key="${system.env.library.path}" path="${obj.all.paths}"/>
            <jvmarg value="${junit.run.arg0}"/>
            <jvmarg value="${junit.run.arg1}"/>
            <jvmarg value="${jvmDataModel.arg}"/>
            <jvmarg value="-Djava.library.path=${obj.all.paths}"/>

            <!--
            <jvmarg value="-Djogl.debug=all"/>
            <jvmarg value="-Dgluegen.debug.NativeLibrary=true"/>
            <jvmarg value="-Dgluegen.debug.ProcAddressHelper=true"/>
            <jvmarg value="-Djogl.debug.GLSLState"/>
            <jvmarg value="-Dnativewindow.debug=all"/>
            <jvmarg value="-verbose:jni"/> 
            <jvmarg value="-client"/>
            <jvmarg value="-d32"/>
            -->

            <formatter usefile="false" type="plain"/>
            <formatter usefile="true" type="xml"/>
            <classpath refid="junit_jogl_awt.run.classpath"/>

            <batchtest todir="${results.test}">
              <fileset dir="${classes}">
                  <include name="${java.dir.junit}/**/Test*AWT*"/>
                  <exclude name="**/*$$*"/>
                  <exclude name="**/*SWT*"/>
                  <exclude name="**/newt/**"/>
              </fileset>
              <formatter usefile="false" type="brief"/>
              <formatter usefile="true" type="xml"/>
            </batchtest>
        </junit>
    </target>

    <target name="junit.run.awt.singletest" depends="test.compile">
        <!-- Test*AWT* -->
        <junit forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
            <env key="${system.env.library.path}" path="${obj.all.paths}"/>
            <jvmarg value="${junit.run.arg0}"/>
            <jvmarg value="${junit.run.arg1}"/>
            <jvmarg value="${jvmDataModel.arg}"/>
            <jvmarg value="-Djava.library.path=${obj.all.paths}"/>

            <!--
            <jvmarg value="-Djogl.debug=all"/>
            <jvmarg value="-Dgluegen.debug.NativeLibrary=true"/>
            <jvmarg value="-Dgluegen.debug.ProcAddressHelper=true"/>
            <jvmarg value="-Djogl.debug.GLSLState"/>
            <jvmarg value="-Dnativewindow.debug=all"/>
            <jvmarg value="-verbose:jni"/> 
            <jvmarg value="-client"/>
            <jvmarg value="-d32"/>
            -->

            <formatter usefile="false" type="plain"/>
            <formatter usefile="true" type="xml"/>
            <classpath refid="junit_jogl_awt.run.classpath"/>

            <test name="${testclass}"/>
        </junit>
    </target>

    <target name="junit.run.swt.headless" depends="test.compile" description="Runs all pure SWT tests." if="isSWTRuntimeAvailable">
        <!-- Test*SWT* 

             Emulation of junit task.

             Utilizing Ant-1.8.0 and ant-contrib-1.0b3 (loops, mutable properties).
          --> 
        <for param="test.class.path.m" keepgoing="true">
            <!-- results in absolute path -->
            <fileset dir="${classes}">
                <include name="${java.dir.junit}/**/Test*SWT*"/>
                <exclude name="**/*$$*"/>
                <exclude name="**/*AWT*"/>
                <exclude name="**/newt/**"/>
            </fileset>
          <sequential>
            <var name="test.class.path" unset="true"/>
            <property name="test.class.path" basedir="${classes}" relative="true" location="@{test.class.path.m}"/>
            <var name="test.class.fqn" unset="true"/>
            <pathconvert property="test.class.fqn">
              <fileset file="${classes}${file.separator}${test.class.path}"/>
              <chainedmapper>
                  <globmapper    from="${classes.path}${file.separator}*" to="*"/> <!-- rel. -->
                  <packagemapper from="*.class"           to="*"/> <!-- FQCN -->
              </chainedmapper>
            </pathconvert>
            <var name="test.class.result.file" value="${results.test}/TEST-${test.class.fqn}.xml"/>
            <echo message="Testing ${test.class.fqn} -- ${test.class.result.file}"/>
            <apply dir="." executable="${java.home}/bin/java" 
                 parallel="false" 
                 timeout="${batchtest.timeout}"
                 vmlauncher="false"
                 relative="true"
                 failonerror="false">
                <env key="${system.env.library.path}" path="${obj.all.paths}"/>
                <env key="CLASSPATH" value="${junit_extra_classpath}${junit_jogl_swt.run.jars}"/>
                <arg line="${junit.run.arg0}"/>
                <arg line="${junit.run.arg1}"/>
                <arg line="${jvmDataModel.arg}"/>
                <arg value="-Djava.library.path=${obj.all.paths}"/>
                <arg line="${jvmarg.headless}"/>
                <!--
                <arg line="-Dnewt.debug.EDT"/>
                -->
                <!-- arg line="com.jogamp.newt.util.MainThread"/-->
                <arg line="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner"/>
                <srcfile/>
                <arg line="filtertrace=true"/>
                <arg line="haltOnError=false"/>
                <arg line="haltOnFailure=false"/>
                <arg line="showoutput=true"/>
                <arg line="outputtoformatters=true"/>
                <arg line="logfailedtests=true"/>
                <arg line="logtestlistenerevents=true"/>
                <arg line="formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter"/>
                <arg line="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.class.result.file}"/>
                <mappedresources>
                    <fileset dir="${classes}" includes="${test.class.path}"/>
                    <packagemapper from="*.class" to="*"/>
                </mappedresources>
            </apply>
          </sequential>
        </for>
    </target>

    <target name="junit.run.swt.awt" depends="test.compile" description="Runs all SWT AWT tests." if="isSWTRuntimeAvailable">
      <!-- Test*SWT*AWT* -->
      <junit forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
          <env key="${system.env.library.path}" path="${obj.all.paths}"/>
          <jvmarg value="${junit.run.arg0}"/>
          <jvmarg value="${junit.run.arg1}"/>
          <jvmarg value="${jvmDataModel.arg}"/>
          <jvmarg value="-Djava.library.path=${obj.all.paths}"/>

          <!--
          <jvmarg value="-Djogl.debug=all"/>
          <jvmarg value="-Dgluegen.debug.NativeLibrary=true"/>
          <jvmarg value="-Dgluegen.debug.ProcAddressHelper=true"/>
          <jvmarg value="-Djogl.debug.GLSLState"/>
          <jvmarg value="-Dnativewindow.debug=all"/>
          <jvmarg value="-verbose:jni"/> 
          <jvmarg value="-client"/>
          <jvmarg value="-d32"/>
          -->

          <formatter usefile="false" type="plain"/>
          <formatter usefile="true" type="xml"/>
          <classpath path="${junit_extra_classpath}${junit_jogl_swt.run.jars}"/>

          <batchtest todir="${results.test}">
            <fileset dir="${classes}">
                <include name="${java.dir.junit}/**/Test*SWT*AWT*"/>
                <exclude name="**/*$$*"/>
                <exclude name="**/newt/**"/>
            </fileset>
            <formatter usefile="false" type="brief"/>
            <formatter usefile="true" type="xml"/>
          </batchtest>
      </junit>
    </target>

    <target name="junit.run.newt.awt" depends="test.compile">
        <!-- Test*AWT* -->
        <junit forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
            <jvmarg value="${junit.run.arg0}"/>
            <jvmarg value="${junit.run.arg1}"/>
            <jvmarg value="${jvmDataModel.arg}"/>
            <env key="${system.env.library.path}" path="${obj.all.paths}"/>
            <jvmarg value="-Djava.library.path=${obj.all.paths}"/>

            <!--
            <jvmarg value="-Dnewt.debug.EDT"/>
            <jvmarg value="-Djogl.debug=all"/>
            <jvmarg value="-Dgluegen.debug.NativeLibrary=true"/>
            <jvmarg value="-Dgluegen.debug.ProcAddressHelper=true"/>
            <jvmarg value="-Djogl.debug.GLSLState"/>
            <jvmarg value="-Dnativewindow.debug=all"/>
            <jvmarg value="-Dnewt.debug=all"/>
            <jvmarg value="-verbose:jni"/> 
            <jvmarg value="-client"/>
            <jvmarg value="-d32"/>
            -->

            <formatter usefile="false" type="plain"/>
            <formatter usefile="true" type="xml"/>
            <classpath refid="junit_jogl_awt.run.classpath"/>

            <batchtest todir="${results.test}">
              <fileset dir="${classes}">
                  <include name="${java.dir.junit}/**/newt/**/Test*AWT*"/>
                  <exclude name="**/*$$*"/>
              </fileset>
              <formatter usefile="false" type="brief"/>
              <formatter usefile="true" type="xml"/>
            </batchtest>
        </junit>
    </target>

    <target name="junit.run.local" unless="isCrosscompilation" >
        <antcall target="junit.run.noui"          inheritRefs="true" inheritAll="true"/>
        <antcall target="junit.run.newt.headless" inheritRefs="true" inheritAll="true"/>
        <antcall target="junit.run.awt"           inheritRefs="true" inheritAll="true"/>
        <antcall target="junit.run.newt.awt"      inheritRefs="true" inheritAll="true"/>
        <antcall target="junit.run.swt.headless"  inheritRefs="true" inheritAll="true"/>
        <antcall target="junit.run.swt.awt"       inheritRefs="true" inheritAll="true"/>
    </target>

    <target name="junit.run.local.d32" if="isOSX">
        <var name="jvmDataModel.arg" unset="true"/>
        <var name="jvmDataModel.arg" value="-d32"/>
        <var name="junit_extra_classpath" unset="true"/>
        <var name="junit_extra_classpath" value="${swt-cocoa-macosx-x86_32.jar}:"/>

        <antcall target="junit.run.local" inheritRefs="true" inheritAll="true"/>

        <mkdir dir="${build}/test/results-x32"/>
        <move todir="${build}/test/results-x32">
            <fileset dir="." includes="*.tga" />
        </move>
        <move todir="${build}/test/results-x32">
            <fileset dir="${results.test}" includes="**" />
        </move>
        <mkdir dir="${results.test}"/>

        <var name="jvmDataModel.arg" unset="true"/>
        <var name="jvmDataModel.arg" value="-d64"/>
        <var name="junit_extra_classpath" unset="true"/>
        <var name="junit_extra_classpath" value=""/>
    </target>

    <target name="junit.run.remote.ssh" if="isCrosscompilation" unless="isAndroid">
        <echo message="#! /bin/sh${line.separator}" append="false" file="${build.test}/targetcommand.sh" />
        <echo message="${line.separator}
rsync -av --delete --delete-after --delete-excluded \${line.separator}
      --exclude 'build-x86*/' --exclude 'build-linux-x*/' --exclude 'build-android*/' --exclude 'build-win*/' --exclude 'build-mac*/' \${line.separator}
      --exclude 'classes/' --exclude 'src/' --exclude '.git/' --exclude '*-java-src.zip' \${line.separator}
      ${env.HOST_UID}@${env.HOST_IP}::${env.HOST_RSYNC_ROOT}/${jogl.basename} ${env.TARGET_ROOT} ${line.separator}
cd ${env.TARGET_ROOT}/${jogl.basename}/${env.NODE_LABEL}/make ${line.separator}
" append="true" file="${build.test}/targetcommand.sh" />

        <for param="test.class.path.m" keepgoing="true">
            <!-- results in absolute path -->
            <fileset dir="${classes}">
                <include name="${java.dir.junit}/**/Test*NEWT*"/>
                <exclude name="**/*$$*"/>
            </fileset>
          <sequential>
            <var name="test.class.path" unset="true"/>
            <property name="test.class.path" basedir="${classes}" relative="true" location="@{test.class.path.m}"/>
            <var name="test.class.fqn" unset="true"/>
            <pathconvert property="test.class.fqn">
              <fileset file="${classes}${file.separator}${test.class.path}"/>
              <chainedmapper>
                  <globmapper    from="${classes.path}${file.separator}*" to="*"/> <!-- rel. -->
                  <packagemapper from="*.class"           to="*"/> <!-- FQCN -->
              </chainedmapper>
            </pathconvert>
            <var name="test.class.result.file" value="${results.test}/TEST-${test.class.fqn}.xml"/>
            <echo message="Testing ${test.class.fqn} -- ${test.class.result.file}"/>
            <echo message="${line.separator}
export DISPLAY=:0.0${line.separator}
java \${line.separator}
${junit.run.arg0}\${line.separator}
${junit.run.arg1}\${line.separator}
${jvmDataModel.arg}\${line.separator}
-cp ${junit_jogl_noawt.run.remote.jars}\${line.separator}
${jvmarg.headless}\${line.separator}
com.jogamp.newt.util.MainThread\${line.separator}
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner \${line.separator}
${test.class.fqn} \${line.separator}
filtertrace=true \${line.separator}
haltOnError=false \${line.separator}
haltOnFailure=false \${line.separator}
showoutput=true \${line.separator}
outputtoformatters=true \${line.separator}
logfailedtests=true \${line.separator}
logtestlistenerevents=true \${line.separator}
formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter \${line.separator}
formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.class.result.file} ${line.separator}
${line.separator}
" append="true" file="${build.test}/targetcommand.sh" />
          </sequential>
        </for>
        <exec dir="." executable="sh" logError="true" failonerror="true" failifexecutionfails="true">
            <arg line='-x -c "
            chmod 0755 ${build.test}/targetcommand.sh ;
            scp ${build.test}/targetcommand.sh ${env.TARGET_UID}@${env.TARGET_IP}:${env.TARGET_ROOT}/jogl-targetcommand.sh ;
            ssh -x ${env.TARGET_UID}@${env.TARGET_IP} ${env.TARGET_ROOT}/jogl-targetcommand.sh ;
            scp -pr ${env.TARGET_UID}@${env.TARGET_IP}:${env.TARGET_ROOT}/${jogl.basename}/${env.NODE_LABEL}/make/${results.test}/* ${results.test}/ "'/>
        </exec>
    </target>

    <target name="junit.run.remote.adb" if="isAndroidARMv7">
        <echo message="#! /system/bin/sh${line.separator}" append="false" file="${build.test}/targetcommand.sh" />
        <echo message="${line.separator}
rsync -av --delete --delete-after --delete-excluded \${line.separator}
      --exclude 'build-x86*/' --exclude 'build-linux*/' --exclude 'build-win*/' --exclude 'build-mac*/' \${line.separator}
      --exclude 'classes/' --exclude 'src/' --exclude '.git/' --exclude '*-java-src.zip' \${line.separator}
      ${env.HOST_UID}@${env.HOST_IP}::${env.HOST_RSYNC_ROOT}/${jogl.basename} ${env.TARGET_ROOT} ${line.separator}
cd ${env.TARGET_ROOT}/${jogl.basename}/${env.NODE_LABEL}/make ${line.separator}
export ${system.env.library.path}=/system/lib:${env.TARGET_ROOT}/gluegen/${rootrel.build}/obj:${env.TARGET_ROOT}/gluegen/${rootrel.build}/test/build/natives ${line.separator}
export BOOTCLASSPATH=/system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar ${line.separator}
" append="true" file="${build.test}/targetcommand.sh" />

        <for param="test.class.path.m" keepgoing="true">
            <!-- results in absolute path -->
            <fileset dir="${build_t.java}">
                <include name="${test.junit.rel}/**/*Test*"/>
                <exclude name="**/*$$*"/>
            </fileset>
          <sequential>
            <var name="test.class.path" unset="true"/>
            <property name="test.class.path" basedir="${build_t.java}" relative="true" location="@{test.class.path.m}"/>
            <var name="test.class.fqn" unset="true"/>
            <pathconvert property="test.class.fqn">
              <fileset file="${build_t.java}${file.separator}${test.class.path}"/>
              <chainedmapper>
                  <globmapper    from="${build_t.java.path}${file.separator}*" to="*"/> <!-- rel. -->
                  <packagemapper from="*.class"           to="*"/> <!-- FQCN -->
              </chainedmapper>
            </pathconvert>
            <var name="test.class.result.file" value="${results}/TEST-${test.class.fqn}.xml"/>
            <echo message="Testing ${test.class.fqn} -- ${test.class.result.file}"/>
            <echo message="${line.separator}
dalvikvm \${line.separator}
-Xjnigreflimit:2000 \${line.separator}
-cp ${junit.run.remote.apks} \${line.separator}
-Dgluegen.root=${gluegen.root} \${line.separator}
-Drootrel.build=${rootrel.build} \${line.separator}
com.android.internal.util.WithFramework \${line.separator}
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner \${line.separator}
${test.class.fqn} \${line.separator}
filtertrace=true \${line.separator}
haltOnError=false \${line.separator}
haltOnFailure=false \${line.separator}
showoutput=true \${line.separator}
outputtoformatters=true \${line.separator}
logfailedtests=true \${line.separator}
logtestlistenerevents=true \${line.separator}
formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter \${line.separator}
formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.class.result.file} ${line.separator}
${line.separator}
" append="true" file="${build_t}/targetcommand.sh" />
          </sequential>
        </for>
        <exec dir="." executable="sh" logError="true" failonerror="true" failifexecutionfails="true">
            <arg line='-x -c "
            chmod 0755 ${build_t}/targetcommand.sh ;
            adb push ${build_t}/targetcommand.sh ${env.TARGET_ROOT}/jogl-targetcommand.sh ;
            adb shell ${env.TARGET_ROOT}/jogl-targetcommand.sh ;
            adb pull ${env.TARGET_ROOT}/${jogl.basename}/${env.NODE_LABEL}/make/${results}/ ${results}/ "'/>
        </exec>
    </target>

    <target name="junit.run.tests" depends="junit.run.local.d32, junit.run.local, junit.run.remote.ssh"/>

    <!-- target name="junit.run.tests" depends="junit.run.local.d32, junit.run.local, junit.run.remote.ssh, junit.run.remote.adb"/ -->

    <target name="junit.run.settings">
        <delete quiet="true">
            <fileset dir="${results.test}" includes="**"/>
            <fileset dir="${build}/test/results-x32" includes="**"/>
            <fileset file="${build}/${test.archive.name}.7z"/>
            <fileset dir="." includes="*.tga" />
        </delete>
        <mkdir dir="${results.test}" />
    </target>

    <target name="junit.run" depends="declare.common, junit.run.settings, junit.run.tests">
        <mkdir dir="${results.test}" />
        <move todir="${results.test}">
            <fileset dir="." includes="*.tga" />
        </move>
        <antcall target="test-zip-archive" inheritRefs="true" inheritAll="true"/>
    </target>

    <target name="test.auto.run" depends="junit.run"/>

    <!-- updates / create the test results zip file -->
    <target name="test-zip-archive" depends="declare.common">
        <archive.7z destfile="${build}/${test.archive.name}.7z"
                    basedir="${project.root}" 
                    includes="${rootrel.build}/test/results ${rootrel.build}/test/results-x64 ${rootrel.build}/test/results-x32" />
    </target>

    <!-- ================================================================== -->
    <!--
       - Build everything.
      -->
    <target name="all" description="Build JOGL JUNIT tests" depends="test.compile" />

</project>