Project

Profile

Help

Maintenance. Planio will be undergoing a scheduled maintenance this weekend. Between Saturday, July 24 at 9:00 UTC and Sunday, July 25, 22:00 UTC your account might observe occasional downtimes which may last up to several minutes in some cases.

How to connect?
Download (30.4 KB) Statistics
| Branch: | Revision:

he / test-suites.gradle @ saxon10

1
// ============================================================
2
// Run the whole shebang!
3
task testSuitesJava(
4
  dependsOn: ["hejTestSuitesJava", "pejTestSuitesJava", "eejTestSuitesJava"]
5
) {
6
  // Just somewhere to hang dependencies
7
}
8

    
9
task hejTestSuitesJava() {
10
  // Just somewhere to hang dependencies
11
}
12

    
13
task pejTestSuitesJava() {
14
  // Just somewhere to hang dependencies
15
}
16

    
17
task eejTestSuitesJava() {
18
  // Just somewhere to hang dependencies
19
}
20

    
21
// This task will generate the test suite report from
22
// whatever results are lying around
23
task testSuiteReportsJava(
24
  type: JavaExec
25
) {
26
  def rundate = project.findProperty('rundate')
27

    
28
  inputs.files fileTree(dir: "${buildDir}/test-results")
29
  inputs.file "${projectDir}/tools/test-suites/report.xsl"
30
  outputs.file "${buildDir}/report.xml"
31
  outputs.file "${buildDir}/report.html"
32
  classpath = configurations.preprocessor
33
  workingDir = buildDir
34
  main = "net.sf.saxon.Transform"
35

    
36
  def arglist = ["-it:main",
37
                 "-xsl:${projectDir}/tools/test-suites/report.xsl",
38
                 "-ns:##any"]
39

    
40
  if (rundate != null) {
41
    arglist += ["rundate=${rundate}"]
42
  }
43
  
44
  args arglist
45
}
46

    
47
// This task *runs all the tests* and then generates the
48
// test suite report from the results
49
task runTestSuiteReportsJava(
50
  type: JavaExec,
51
  dependsOn: ["testSuitesJava"]
52
) {
53
  def rundate = project.findProperty('rundate')
54

    
55
  inputs.files fileTree(dir: "${buildDir}/test-results")
56
  inputs.file "${projectDir}/tools/test-suites/report.xsl"
57
  outputs.file "${buildDir}/report.xml"
58
  outputs.file "${buildDir}/report.html"
59
  classpath = configurations.preprocessor
60
  workingDir = buildDir
61
  main = "net.sf.saxon.Transform"
62

    
63
  def arglist = ["-it:main",
64
                 "-xsl:${projectDir}/tools/test-suites/report.xsl",
65
                 "-ns:##any"]
66

    
67
  if (rundate != null) {
68
    arglist += ["rundate=${rundate}"]
69
  }
70
  
71
  args arglist
72
}
73

    
74
// ============================================================
75

    
76
def langCodeMap = ["XP20": "XPath2.0",
77
                   "XP30": "XPath3.0",
78
                   "XP31": "XPath3.1",
79
                   "XT30": "XSLT3.0",
80
                   "XT40": "XSLT4.0",
81
                   "XP31": "XPath3.1",
82
                   "XQ20": "XQuery2.0",
83
                   "XQ30": "XQuery3.0",
84
                   "XQ31": "XQuery3.1"]
85

    
86
// N.B. These tasks cannot be run in parallel because the
87
// test suite drivers write to filenames that are not distinct
88
// based on the options used to run them (e.g, whether or not
89
// the bytecode option is enabled doesn't change the output
90
// filename).
91
//
92
// ============================================================
93
// Tasks to build the test drivers and setup the test suite results directories
94

    
95
["he", "pe", "ee"].each { release ->
96
  def RELEASE = release.toUpperCase()
97
  fileTree(dir: "src/test/exceptions").each { fn ->
98
    def pos = fn.toString().lastIndexOf(pathSeparator)
99
    def base = fn.toString().substring(pos+1)
100
    base = base.substring(0, base.length() - 4)
101

    
102
    def schema11 = (base == "xsd11" || base == "xsd-extra11")
103
    def schema = schema11 || (base == "xsd" || base == "xsd-extra")
104
    if (schema11 && release == "ee") {
105
      // These are a special case, they need to be renamed 'exceptions11.xml'
106
      // in the corresponding base directory. See "dependsOn" below this loop.
107
      def bdir = "xsd"
108
      if (base == "xsd-extra11") {
109
        bdir = "xsd-extra"
110
      }
111
      task "${release}j_setup_${base}_TestResults"(
112
        type: Copy,
113
        description: "Sets up the test results directory the ${base} tests for ${RELEASE}"
114
      ) {
115
        into "${buildDir}/test-results/${release}j/${bdir}/${DSTAMP}"
116
        from "src/test/exceptions/${base}.xml"
117
        rename { "exceptions11.xml" }
118
      }
119
    } else {
120
      // The schema tests only run on EE
121
      if (!schema || release == "ee") {
122
        task "${release}j_setup_${base}_TestResults"(
123
          type: Copy,
124
          description: "Sets up the test results directory the ${base} tests for ${RELEASE}"
125
        ) {
126
          into "${buildDir}/test-results/${release}j/${base}/${DSTAMP}"
127
          from "src/test/exceptions/${base}.xml"
128
          rename { "exceptions.xml" }
129
        }
130
      }
131
    }
132
  }
133

    
134
  task "${release}j_compileTestDrivers"(
135
    type: JavaCompile,
136
    dependsOn: ["${release}j_copyTestDrivers", "${release}jCompile"],
137
    description: "Compile the test classes for ${RELEASE}"
138
  ) {
139
    classpath = configurations.testDrivers + files("${buildDir}/classes/${release}j")
140
    source = "${buildDir}/src/testdrivers/${release}j"
141
    destinationDirectory = new File("${buildDir}/testdriver_classes/${release}j")
142
  }
143
}
144

    
145
tasks.findByName("eej_setup_xsd_TestResults").dependsOn "eej_setup_xsd11_TestResults"
146
tasks.findByName("eej_setup_xsd-extra_TestResults").dependsOn "eej_setup_xsd-extra11_TestResults"
147

    
148
task eej_setup_xsd_transformations(
149
  type: Copy,
150
  description: "Copy the transformations used by the XSD test driver"
151
) {
152
  into "${buildDir}/test-results/eej/xsd/${DSTAMP}"
153
  from "src/test/extra/tools"
154
}
155
tasks.findByName("eej_setup_xsd_TestResults").dependsOn "eej_setup_xsd_transformations"
156

    
157
task eej_setup_xsd_extra_transformations(
158
  type: Copy,
159
  description: "Copy the transformations used by the XSD test driver"
160
) {
161
  into "${buildDir}/test-results/eej/xsd-extra/${DSTAMP}"
162
  from "src/test/extra/tools"
163
}
164
tasks.findByName("eej_setup_xsd-extra_TestResults").dependsOn "eej_setup_xsd_extra_transformations"
165

    
166
// ============================================================
167
// Tasks to run QT3 test driver with a variety of options
168

    
169
task qt3TestsJava() {
170
  // Just somewhere to hang dependencies
171
}
172

    
173
["he", "pe", "ee"].each { release ->
174
  def RELEASE = release.toUpperCase()
175
  def jpackage = "com.saxonica.testdriver"
176
  if (release == "he") {
177
    jpackage = "net.sf.saxon.testdriver"
178
  }
179

    
180
  def resdir = "${buildDir}/test-results/${release}j/qt3/${DSTAMP}"
181

    
182
  def languages = ["XP20", "XP31", "XQ30", "XQ31"]
183
  if (release == "ee") {
184
    languages = ["XP20", "XP30", "XP31", "XQ10", "XQ30", "XQ31"]
185
  }
186

    
187
  def bytecodes = [""]
188
  if (release == "ee") {
189
    bytecodes = ["off", "on"]
190
  }
191

    
192
  languages.each { language ->
193
    bytecodes.each { bytecode ->
194

    
195
      def unfolded = [""]
196
      if (release == "ee" && (language == "XQ30" || language == "XQ31")) {
197
        unfolded = ["", "yes"]
198
      }
199

    
200
      unfolded.each { uoption ->
201
        def reportFilename = "report_${langCodeMap[language]}_${saxonVersion}"
202
        def taskname = "${release}_runQT3TestSuite_${language}"
203
        if (bytecode != "") {
204
          taskname = "${taskname}_bc${bytecode}"
205
          reportFilename = reportFilename + "_bc${bytecode}"
206
        }
207
        if (uoption != "") {
208
          taskname = "${taskname}_un"
209
          reportFilename = reportFilename + "_un"
210
        }
211

    
212
        if (bytecode == "off" && uoption != "") {
213
          // ignore this combination
214
        } else {
215
          task "run_${taskname}"(
216
            type: JavaExec,
217
            dependsOn: ["${release}jCompile", "${release}j_compileTestDrivers", "cloneQT3TestSuite"],
218
            description: "Run the QT3 test suite driver for ${RELEASE}/${language}/${bytecode}/${uoption}"
219
          ) {
220
            inputs.files fileTree(dir: "src")
221
            outputs.file "${resdir}/results_${langCodeMap[language]}_${saxonVersion}.xml"
222

    
223
            classpath = configurations.testDrivers \
224
            + files("${buildDir}/classes/${release}j") \
225
            + files("${buildDir}/testdriver_classes/${release}j")
226

    
227
            main = "${jpackage}.QT3TestDriver${RELEASE}"
228
            def testargs = [w3cQT3TestSuiteDir,
229
                            "catalog.xml",
230
                            "-exceptions:${projectDir}/src/test/exceptions/qt3.xml",
231
                            "-reportfilename:${reportFilename}.xml",
232
                            "-o:${resdir}",
233
                            "-lang:${language}"]
234
            if (bytecode != "") {
235
              testargs += [ "-bytecode:${bytecode}" ]
236
            }
237
            if (uoption != "") {
238
              testargs += [ "-unfolded:${uoption}" ]
239
            }
240

    
241
            args testargs
242
          }
243

    
244
          task "${taskname}"(
245
            type: Copy,
246
            dependsOn: "run_${taskname}"
247
          ) {
248
            def bflag = ""
249
            if (bytecode != "") {
250
              bflag = "-${bytecode}"
251
            }
252
            def uflag = ""
253
            if (uoption != "") {
254
              uflag = "-unfolded"
255
            }
256
            into "${resdir}/results"
257
            from resdir
258
            include "${reportFilename}.xml"
259
            rename { filename ->
260
              "saxon-${saxonVersion}-${language}${bflag}${uflag}.xml"
261
            }
262
          }
263
          qt3TestsJava.dependsOn taskname
264
          tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
265
        }
266
      }
267
    }
268
  }
269
}
270

    
271
// ============================================================
272
// Tasks to run QT3 extra test driver with a variety of options
273

    
274
task qt3ExtraTestsJava() {
275
  // Just somewhere to hang dependencies
276
}
277

    
278
// These tests are not run for "he".
279
["pe", "ee"].each { release ->
280
  def RELEASE = release.toUpperCase()
281
  def jpackage = "com.saxonica.testdriver"
282
  if (release == "he") {
283
    jpackage = "net.sf.saxon.testdriver"
284
  }
285

    
286
  def resdir = "${buildDir}/test-results/${release}j/qt3extra/${DSTAMP}"
287

    
288
  def languages = ["XP20", "XP31", "XQ30", "XQ31"]
289
  if (release == "ee") {
290
    languages = ["XP20", "XP30", "XP31", "XQ10", "XQ30", "XQ31"]
291
  }
292

    
293
  def bytecodes = [""]
294
  if (release == "ee") {
295
    bytecodes = ["off", "on"]
296
  }
297

    
298
  languages.each { language ->
299
    bytecodes.each { bytecode ->
300
      def taskname = "${release}_runQT3ExtraTestSuite_${language}"
301
      def reportFilename = "results_${langCodeMap[language]}_${saxonVersion}"
302

    
303
      if (bytecode != "") {
304
        taskname = "${taskname}_bc${bytecode}"
305
        reportFilename = "${reportFilename}_bc${bytecode}"
306
      }
307

    
308
      task "run_${taskname}"(
309
        type: JavaExec,
310
        dependsOn: ["${release}jCompile",
311
                    "${release}j_compileTestDrivers"],
312
        description: "Run the QT3 extra test suite driver for ${RELEASE}/${language}/${bytecode}"
313
      ) {
314
        inputs.files fileTree(dir: "src")
315
        outputs.file "${resdir}/results_${langCodeMap[language]}_${saxonVersion}.xml"
316

    
317
        classpath = configurations.testDrivers \
318
        + files("${buildDir}/classes/${release}j") \
319
        + files("${buildDir}/testdriver_classes/${release}j")
320

    
321
        main = "${jpackage}.QT3TestDriver${RELEASE}"
322
        def testargs = ["${projectDir}/src/test/extra/qt3",
323
                        "catalog.xml",
324
                        "-exceptions:${projectDir}/src/test/exceptions/qt3extra.xml",
325
                        "-reportfilename:${reportFilename}.xml",
326
                        "-o:${resdir}",
327
                        "-lang:${language}"]
328
        if (bytecode != "") {
329
          testargs += [ "-bytecode:${bytecode}" ]
330
        }
331

    
332
        args testargs
333
      }
334

    
335
      task "${taskname}"(
336
        type: Copy,
337
        dependsOn: "run_${taskname}"
338
      ) {
339
        def bflag = ""
340
        if (bytecode != "") {
341
          bflag = "-${bytecode}"
342
        }
343
        into "${resdir}/results"
344
        from resdir
345
        include "${reportFilename}.xml"
346
        rename { filename ->
347
          "saxon-${saxonVersion}-${language}${bflag}.xml"
348
        }
349
      }
350
      qt3ExtraTestsJava.dependsOn taskname
351
      tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
352
    }
353
  }
354
}
355

    
356
// ============================================================
357
// Tasks to run XSLT3.0 test driver with a variety of options
358

    
359
task xslt30TestsJava() {
360
  // Just somewhere to hang dependencies
361
}
362

    
363
["he", "pe", "ee"].each { release ->
364
  def RELEASE = release.toUpperCase()
365
  def jpackage = "com.saxonica.testdriver"
366
  if (release == "he") {
367
    jpackage = "net.sf.saxon.testdriver"
368
  }
369

    
370
  def resdir = "${buildDir}/test-results/${release}j/xslt30/${DSTAMP}"
371

    
372
  def languages = ["XT30"]
373
  def bytecodes = [""]
374
  def exports = [""]
375
  def jits = [""]
376
  if (release == "ee") {
377
    bytecodes = ["off", "on"]
378
    exports = ["", "-export"]
379
    jits = ["", "-jit"]
380
  }
381

    
382
  languages.each { language ->
383
    bytecodes.each { bytecode ->
384
      exports.each { export ->
385
        jits.each { jit ->
386

    
387
          def skipThisCombo = ((export == "-export" && bytecode == "on")
388
                               || (jit == "-jit" && bytecode == "off"))
389

    
390
          if (!skipThisCombo) {
391
            def taskname = "${release}_runXslt30TestSuite_${language}"
392
            def reportFilename = "results_${langCodeMap[language]}_${saxonVersion}"
393

    
394
            if (bytecode != "") {
395
              taskname = "${taskname}_bc${bytecode}"
396
              reportFilename = "${reportFilename}_bc${bytecode}"
397
            }
398
            if (export != "") {
399
              taskname = "${taskname}_export"
400
              reportFilename = "${reportFilename}_export"
401
            }
402
            if (jit != "") {
403
              taskname = "${taskname}_jit"
404
              reportFilename = "${reportFilename}_jit"
405
            }
406

    
407
            task "run_${taskname}"(
408
              type: JavaExec,
409
              dependsOn: ["${release}jCompile",
410
                          "${release}j_compileTestDrivers",
411
                          "cloneXslt30TestSuite"],
412
              description: "Run the XSLT 3.0 test suite driver for ${RELEASE}/${language}/${bytecode}/${export}/${jit}"
413
            ) {
414
              inputs.files fileTree(dir: "src")
415
              outputs.file "${resdir}/results_XSLT3.0_${saxonVersion}.xml"
416

    
417
              classpath = configurations.testDrivers \
418
              + files("${buildDir}/classes/${release}j") \
419
              + files("${buildDir}/testdriver_classes/${release}j")
420

    
421
              main = "${jpackage}.Xslt30TestSuiteDriver${RELEASE}"
422
              def testargs = [w3cXslt30TestSuiteDir,
423
                              "catalog.xml",
424
                              "-exceptions:${projectDir}/src/test/exceptions/xslt30.xml",
425
                              "-reportfilename:${reportFilename}.xml",
426
                              "-o:${resdir}",
427
                              "-lang:${language}",
428
                              "-ps:off"]
429
              if (testSuiteDebug != "") {
430
                testargs += [ testSuiteDebug ]
431
              }
432
              if (bytecode != "") {
433
                testargs += [ "-bytecode:${bytecode}" ]
434
              }
435
              if (export != "") {
436
                testargs += [ export ]
437
              }
438
              if (jit != "") {
439
                testargs += [ jit ]
440
              }
441

    
442
              args testargs
443
            }
444

    
445
            task "${taskname}"(
446
              type: Copy,
447
              dependsOn: "run_${taskname}"
448
            ) {
449
              def bflag = ""
450
              if (bytecode != "") {
451
                bflag = "-${bytecode}"
452
              }
453
              into "${resdir}/results"
454
              from resdir
455
              include "${reportFilename}.xml"
456
              rename { filename ->
457
                "saxon-${saxonVersion}-${language}${bflag}${export}${jit}.xml"
458
              }
459
            }
460
            xslt30TestsJava.dependsOn taskname
461
            tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
462
          }
463
        }
464
      }
465
    }
466
  }
467
}
468

    
469
// ============================================================
470
// Tasks to run XSLT3.0 extra test driver with a variety of options
471

    
472
task xslt30ExtraTestsJava() {
473
  // Just somewhere to hang dependencies
474
}
475

    
476
["he", "pe", "ee"].each { release ->
477
  def RELEASE = release.toUpperCase()
478
  def jpackage = "com.saxonica.testdriver"
479
  if (release == "he") {
480
    jpackage = "net.sf.saxon.testdriver"
481
  }
482

    
483
  def resdir = "${buildDir}/test-results/${release}j/xslt30extra/${DSTAMP}"
484

    
485
  def languages = ["XT30"]
486
  def bytecodes = [""]
487
  if (release == "ee") {
488
    bytecodes = ["off", "on"]
489
  }
490

    
491
  languages.each { language ->
492
    bytecodes.each { bytecode ->
493
      def taskname = "${release}_runXslt30ExtraTestSuite_${language}"
494
      def reportFilename = "results_${langCodeMap[language]}_${saxonVersion}"
495

    
496
      if (bytecode != "") {
497
        taskname = "${taskname}_bc${bytecode}"
498
        reportFilename = "${reportFilename}_bc${bytecode}"
499
      }
500

    
501
      task "run_${taskname}"(
502
        type: JavaExec,
503
        dependsOn: ["${release}jCompile",
504
                    "${release}j_compileTestDrivers"],
505
        description: "Run the XSLT 3.0 extra test suite driver for ${RELEASE}/${language}/${bytecode}"
506
      ) {
507
        inputs.files fileTree(dir: "src")
508
        outputs.file "${resdir}/results_XSLT3.0_${saxonVersion}.xml"
509

    
510
        classpath = configurations.testDrivers \
511
        + files("${buildDir}/classes/${release}j") \
512
        + files("${buildDir}/testdriver_classes/${release}j")
513

    
514
        main = "${jpackage}.Xslt30TestSuiteDriver${RELEASE}"
515
        def testargs = ["${projectDir}/src/test/extra/xslt30",
516
                        "catalog.xml",
517
                        "-exceptions:${projectDir}/src/test/exceptions/xslt30extra.xml",
518
                        "-reportfilename:${reportFilename}.xml",
519
                        "-o:${resdir}",
520
                        "-lang:${language}",
521
                        "-ps:off"]
522
        if (testSuiteDebug != "") {
523
          testargs += [ testSuiteDebug ]
524
        }
525
        if (bytecode != "") {
526
          testargs += [ "-bytecode:${bytecode}" ]
527
        }
528

    
529
    languages.each { language ->
530
        bytecodes.each { bytecode ->
531
            exports.each { export ->
532
                jits.each { jit ->
533
                    def skipThisCombo = ((export == "-export" && bytecode == "on")
534
                            || (jit == "-jit" && bytecode == "off"))
535

    
536
                    if (!skipThisCombo) {
537
                        def reportFilename = "${buildDir}/test-results/${release}j/xslt30extra/${DSTAMP}"
538
                        reportFilename = "${reportFilename}/results_${langCodeMap[language]}_${saxonVersion}"
539

    
540
                        def taskname = "${release}_runXslt30ExtraTestSuite_${language}"
541
                        if (bytecode != "") {
542
                            taskname = "${taskname}_bc${bytecode}"
543
                            reportFilename = "${reportFilename}_bc${bytecode}"
544
                        }
545
                        if (export != "") {
546
                          taskname = "${taskname}_export"
547
                          reportFilename = "${reportFilename}_export"
548
                        }
549
                        if (jit != "") {
550
                          taskname = "${taskname}_jit"
551
                          reportFilename = "${reportFilename}_jit"
552
                        }
553

    
554
                        task "${taskname}"(
555
                                type: JavaExec,
556
                                dependsOn: ["${release}jCompile",
557
                                            "${release}j_compileTestDrivers"],
558
                                description: "Run the XSLT 3.0 extra test suite driver for ${RELEASE}/${language}/${bytecode}"
559
                        ) {
560
                            inputs.files fileTree(dir: "src")
561
                            outputs.file "${reportFilename}.xml"
562

    
563
                            classpath = configurations.testDrivers \
564
         + files("${buildDir}/classes/${release}j") \
565
         + files("${buildDir}/testdriver_classes/${release}j")
566

    
567
                            main = "${jpackage}.Xslt30TestSuiteDriver${RELEASE}"
568
                            def testargs = ["${projectDir}/src/test/extra/xslt30",
569
                                            "catalog.xml",
570
                                            "-exceptions:${projectDir}/src/test/exceptions/xslt30extra.xml",
571
                                            "-reportfilename:${getReportFilename(reportFilename)}.xml",
572
                                            "-o:${getReportDirectory(reportFilename)}",
573
                                            "-lang:${language}",
574
                                            "-ps:off"]
575
                            if (testSuiteDebug != "") {
576
                                testargs += [testSuiteDebug]
577
                            }
578
                            if (bytecode != "") {
579
                                testargs += ["-bytecode:${bytecode}"]
580
                            }
581

    
582
                            if (export != "") {
583
                                testargs += [export]
584
                            }
585
                            if (jit != "") {
586
                                testargs += [jit]
587
                            }
588

    
589
                            qt3OptionMap.keySet().each { key ->
590
                                def opt = project.findProperty(key)
591
                                if (opt != null) {
592
                                    testargs += ["${qt3OptionMap[key]}:${opt}"]
593
                                }
594
                            }
595

    
596
                            args testargs
597
                        }
598

    
599
      task "${taskname}"(
600
        type: Copy,
601
        dependsOn: "run_${taskname}"
602
      ) {
603
        def bflag = ""
604
        if (bytecode != "") {
605
          bflag = "-${bytecode}"
606
        }
607
        into "${resdir}/results"
608
        from resdir
609
        include "${reportFilename}.xml"
610
        rename { filename ->
611
          "saxon-${saxonVersion}-${language}${bflag}.xml"
612
        }
613
      }
614
      xslt30ExtraTestsJava.dependsOn taskname
615
      tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
616
    }
617
  }
618
}
619

    
620
// ============================================================
621
// Tasks to run XSD test driver with a variety of options
622

    
623
task xsdTestsJava() {
624
  // Just somewhere to hang dependencies
625
}
626

    
627
// Only applies to EE
628
["ee"].each { release ->
629
  def RELEASE = release.toUpperCase()
630
  def jpackage = "com.saxonica.testdriver.ee"
631

    
632
  def resdir = "${buildDir}/test-results/${release}j/xsd/${DSTAMP}"
633

    
634
  def languages = ["1.0", "1.1"]
635
  def bytecodes = ["off", "on"]
636

    
637
  languages.each { language ->
638
    bytecodes.each { bytecode ->
639
      def taskname = "${release}_runXsdTestSuite_${language}_bc${bytecode}"
640
      def reportFilename = "SaxonResults${saxonVersion}-${language}_bc${bytecode}"
641
      def errorFilename = "SaxonFailures${saxonVersion}-${language}_bc${bytecode}"
642
      def exceptions = "${projectDir}/src/test/exceptions/xsd.xml"
643
      if (language == "1.1") {
644
        exceptions = "${projectDir}/src/test/exceptions/xsd11.xml"
645
      }
646

    
647
      task "run_${taskname}"(
648
        type: JavaExec,
649
        dependsOn: ["${release}jCompile",
650
                    "${release}j_compileTestDrivers",
651
                    "cloneXsdTestSuite"],
652
        description: "Run the XSD test suite driver for ${RELEASE}/${language}/${bytecode}"
653
      ) {
654
        inputs.files fileTree(dir: "src")
655
        outputs.file "${resdir}/SaxonFailures${saxonVersion}.xml"
656
        outputs.file "${resdir}/SaxonResults${saxonVersion}-${language}.xml"
657

    
658
        classpath = configurations.testDrivers \
659
        + files("${buildDir}/classes/${release}j") \
660
        + files("${buildDir}/testdriver_classes/${release}j")
661

    
662
        main = "${jpackage}.SchemaTestSuiteDriver"
663
        def testargs = [w3cXsdTestSuiteDir,
664
                        "-exceptions:${exceptions}",
665
                        "-reportfilename:${reportFilename}.xml",
666
                        "-errorfilename:${errorFilename}.xml",
667
                        "-summarizeresults:${projectDir}/src/test/extra/tools/summarize-results.xsl",
668
                        "-local:${resdir}",
669
                        "-v:${language}"]
670
        if (bytecode != "") {
671
          testargs += [ "-bytecode:${bytecode}" ]
672
        }
673

    
674
        args testargs
675
      }
676

    
677
      task "${taskname}"(
678
        type: Copy,
679
        dependsOn: "run_${taskname}"
680
      ) {
681
        def bflag = ""
682
        if (bytecode != "off") {
683
          bflag = "-${bytecode}"
684
        }
685
        into "${resdir}/results"
686
        from resdir
687
        include "${reportFilename}.xml"
688
        rename { filename ->
689
          "saxon-${saxonVersion}-XSD${language}${bflag}.xml"
690
        }
691
      }
692
      xsdTestsJava.dependsOn taskname
693
      tasks.findByName("${release}jTestSuitesJava").dependsOn taskname
694
    }
695
  }
696
}
697

    
698
// ============================================================
699
// Tasks to run XSD extra test driver with a variety of options
700

    
701
task xsdExtraTestsJava() {
702
  // Just somewhere to hang dependencies
703
}
704

    
705
// Not currently enabled.
706

    
707
// ============================================================
708

    
709
// ============================================================
710

    
711
["h", "p", "e"].each { initial ->
712
  def release = initial + "e"
713
  def RELEASE = release.toUpperCase()
714

    
715
  task "${release}_samples_common"(
716
    type: Copy,
717
    dependsOn: ["${release}_samples", "${release}_samples_cs"]
718
  ) {
719
    into "${buildDir}/output/${release}/resources/use-cases"
720
    from "${projectDir}/src/use-cases"
721
  }
722

    
723
  task "${release}_samples"(
724
    type: Copy
725
  ) {
726
    into "${buildDir}/output/${release}/resources/samples"
727
    from ("${projectDir}/src/samples") {
728
      include "config/config.xml"
729
      include "config/config-HE.xml"
730
      include "config/config.xsd"
731
      include "config/saxon-attributes.xsd"
732
      include "data/books.xml"
733
      include "data/books-invalid.xml"
734
      include "data/more-books.xml"
735
      include "data/othello.xml"
736
      include "data/books.xsd"
737
      include "data/books.dtd"
738
      include "data/play.dtd"
739
      include "query/tour.xq"
740
      include "query/books.xq"
741
      include "query/books-to-html.xq"
742
      include "scm/scmschema.*"
743
      include "schemas/validation-reports.xsd"
744
      include "styles/add-ids.xsl"
745
      include "styles/bible.xsl"
746
      include "styles/books.xsl"
747
      include "styles/books.txt"
748
      include "styles/play.xsl"
749
      include "styles/identity.xsl"
750
      include "styles/books-csv.xsl"
751
      include "styles/books-sql.xsl"
752
      include "styles/rename-to-lowercase.xsl"
753
      include "styles/total.xsl"
754
      include "styles/tour.xsl"
755
      include "styles/summarize.xsl"
756
    }
757
  }
758

    
759
  // TODO reinstate to include CS samples when releasing for .NET
760
  task "${release}_samples_cs"(
761
    type: Copy
762
  ) {
763
    into "${buildDir}/output/${release}/resources/samples/cs"
764
    from "${projectDir}/src/samples/cs"
765
  }
766
}
767

    
768
task config_sample(
769
  type: JavaExec,
770
  dependsOn: ["hej_featureKeys"],
771
  description: "Construct the configuration file XSD"
772
) {
773
  inputs.files fileTree(dir: "${projectDir}/tools/featureKeys")
774
  inputs.files "${projectDir}/src/samples/config/config-raw.xsd"
775
  outputs.file "${buildDir}/output/he/resources/samples/config/config.xsd"
776
  classpath = configurations.preprocessor
777
  main = "net.sf.saxon.Transform"
778
  args "-xsl:${projectDir}/tools/featureKeys/FeatureKeysToSchema.xsl",
779
    "-o:${buildDir}/output/he/resources/samples/config/config.xsd",
780
    "-it:main",
781
    "FeatureKeys=FeatureKeys.xml",
782
    "AdditionalFeatures=AdditionalFeatures.xml",
783
    "ConfigSchema=${projectDir}/src/samples/config/config-raw.xsd"
784
}
785

    
786
task hej_setup_samples(
787
  type: Copy,
788
  dependsOn: ["config_sample", "he_samples_common"]
789
) {
790
  into "${buildDir}/output/he/resources/samples/java/he"
791
  from ("${projectDir}/src/samples/java/he") {
792
    include "ApplyXPathJAXP.java"
793
    include "ExampleContentHandler.java"
794
    include "QueryAPIExamples.java"
795
    include "S9APIExamples.java"
796
    include "S9APIExamplesOM.java"
797
    include "SaxonServlet.java"
798
    include "JAXPExamples.java"
799
    include "XPathExample.java"
800
    include "XPathExampleDOM.java"
801
    include "XPathExampleServlet.java"
802
  }
803
}
804

    
805
task hej_samples(
806
  type: JavaCompile,
807
  dependsOn: ["hej_setup_samples", "hejCompile"]
808
) {
809
  classpath = configurations.samples + files("${buildDir}/classes/hej")
810
  source = "${buildDir}/output/he/resources/samples/java/he"
811
  destinationDirectory = new File("${buildDir}/output/he/resources/samples/java/classes")
812
  doFirst {
813
    mkdir "${buildDir}/output/he/resources/samples/java/classes"
814
  }
815
}
816

    
817
task eej_setup_samples(
818
  type: Copy,
819
  dependsOn: ["config_sample", "ee_samples_common"]
820
) {
821
  into "${buildDir}/output/he/resources/samples/java/ee"
822
  from ("${projectDir}/src/samples/java/ee") {
823
    include "JDOM2Example.java"
824
    include "PullExamples.java"
825
    include "QuickValidator.java"
826
    include "SaxonSAServlet.java"
827
    include "SchemaValidatorExample.java"
828
    include "SchemaValidatorHandlerExample.java"
829
    include "XMarkBenchmark.java"
830
    include "XPathExampleSA.java"
831
    include "XQJExamples.java"
832
  }
833
}
834

    
835
task eej_samples(
836
  type: JavaCompile,
837
  dependsOn: ["eej_setup_samples", "eejCompile", "hej_samples"]
838
) {
839
  classpath = configurations.samples + (files("${buildDir}/classes/eej")
840
              + files("${buildDir}/output/he/resources/samples/java/classes"))
841
  source = "${buildDir}/output/he/resources/samples/java/ee"
842
  destinationDirectory = new File("${buildDir}/output/ee/resources/samples/java/classes")
843
  doFirst {
844
    mkdir "${buildDir}/output/ee/resources/samples/java/classes"
845
  }
846
}
847

    
848
// ============================================================
849

    
850
task he_samples_JAXPExamples(
851
  type: Exec,
852
  dependsOn: ["hej_samples", "hejJar"],
853
  description: "Run test of JAXPExamples for he"
854
) {
855
  inputs.files fileTree(dir: "${buildDir}/output/he/resources/samples/java/classes/he")
856
  inputs.files "${projectDir}/src/samples/java/he"
857
  workingDir = "${buildDir}/output/he/resources/samples"
858

    
859
  def args = ["java",
860
              "-cp",
861
              "${buildDir}/libs/saxon-he-${saxonVersion}.jar:${buildDir}/output/he/resources/samples/java/classes",
862
              "he/JAXPExamples", "all"]
863

    
864
  commandLine args
865
}
866

    
867
/*
868

    
869
    <macrodef name="samples-JAXPExamples"
870
              description="Run test of JAXPExamples samples">
871
        <attribute name="version"/>
872
        <attribute name="target"/>
873
        <sequential>
874
            <exec executable="java"
875
                  dir="${build-resources.dir}/samples"
876
                  failonerror="true">
877
                <arg line="-cp ${basedir}/${build-resources.dir}/samples/java/classes${Z}${basedir}/${build-@{version}j.dir}/saxon-@{version}-${major.version}.jar${Z}${license.dir}"/>
878
                <arg line="he/JAXPExamples"/>
879
                <arg line="@{target}"/>
880
            </exec>
881
        </sequential>
882
    </macrodef>
883

    
884
    <target name="test-samples-JAXPExamples-j" depends="samples-j">
885
        <samples-JAXPExamples version="he" target="all"/>
886
        <samples-JAXPExamples version="pe" target="all"/>
887
        <samples-JAXPExamples version="ee" target="all"/>
888
    </target>
889

    
890

    
891
/*
892
}
893

    
894
    <!-- S9APIExamples sample tests -->
895
    <macrodef name="samples-s9api"
896
        description="Run test of s9api samples">
897
        <attribute name="version"
898
        <attribute name="target"
899
        <sequential>
900
            <exec executable="java"
901
                dir="${build-resources.dir}/samples"
902
                failonerror="true">
903
                <arg line="-cp ${basedir}/${build-resources.dir}/samples/java/classes${Z}${basedir}/${build-@{version}j.dir}/saxon-@{version}-${major.version}.jar${Z}${license.dir}"
904
                <arg line="he/S9APIExamples"
905
                <arg line="@{target}"
906
            </exec>
907
        </sequential>
908
    </macrodef>
909

    
910
        <samples-s9api version="he" target="QueryA"
911
*/
(14-14/14)