This is an automated email from the ASF dual-hosted git repository.
jinterrante pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil.git
The following commit(s) were added to refs/heads/main by this push:
new 382d870d6 Run TDML tests with user-chosen TDML implementation
382d870d6 is described below
commit 382d870d640995bbb05280f3f5c1c1eb854aff71
Author: John Interrante <[email protected]>
AuthorDate: Mon Jun 6 11:09:10 2022 -0400
Run TDML tests with user-chosen TDML implementation
Define TDMLImplementation using simple enumerated type in dafext.xsd.
Add TDML implementation option to Daffodil's CLI test subcommand and
pass Option[TDMLImplementation] argument to Runner to allow CLI to run
TDML tests with different TDMLImplementations (formerly we had to edit
the TDML file, but that become undesirable). Remove tunable
tdmlImplementation from dafext.xsd and runtime2 TDML files. Modify
runtime2 Scala tests to pass TDMLImplementation.DaffodilC to Runner
instead. Look up TDML_IMPLEMENTATION environment variable in
DFDLTestSuite to allow "sbt test" to run tests with different TDML
implementations too. Add CLI integration tests to increase test
coverage of new and changed lines.
Interaction between environment variable, CLI option, and JUnit tests
is simple to understand. CLI option or JUnit argument passed to
Runner always specifies TDML implementation. In their absence,
environment variable specifies TDML implementation. Otherwise, tests
run with TDMLImplementation.Daffodil (runtime1).
Also fix some inconsistencies with fill bits overlooked by a previous
pull request which extended runtime2 to read and write N-bit numbers.
See more detailed changelog below.
DAFFODIL-2697
testNonCompatibleImplementation.tdml: Add another test schema and test
case to increase test coverage of "daffodil test -I" option.
Util.scala: Use standard Scala idioms for getting DAFFODIL_HOME
environment variable and composing environment variables.
TestCLIexecuting.scala: Add new error and normal test cases to
increase test coverage of "daffodil test -I" option. Update "not
compatible" error test case due to change in error message.
Main.scala: Import TDMLImplementation (defined in dafext.xsd) to tell
CLI and user which TDML implementations Daffodil supports. Add TDML
implementation option to CLI test subcommand. Pass specified TDML
implementation or None to Runner for TDML file's tests. Include TDML
implementation's name in "not compatible with implementation" message.
tdml.xsd: Update names of TDML implementations to match names of TDML
implementations in dafext.xsd. Change runtime2 implementation name
from "daffodil-runtime2" to "daffodilC" because a TDML implementation
name must be a valid identifier in both XML and Scala and you can't
embed a dash within a Scala identifier.
dafext.xsd: Remove tdmlImplementation tunable to avoid overly
complicated interaction between tunable, environment variable, and CLI
-I option. Add TunableTDMLImplementation simple type (can't remove
"Tunable" from its name because TunableGenerator filters out types not
beginning with "Tunable") with enumerations listing every TDML
implementation Daffodil supports, which also creates a
TDMLImplementation enumerated type we can import into Scala files.
Add comment to clarify you still need different classpaths to call ibm
as a cross tester. Change all enumerated simple types to use standard
xs:token idiom instead of xs:string.
parsers.c: Rename parse_fill_bytes to parse_fill_bits and make it read
exactly N fill bits (no more, no less).
parsers.h: Rename parse_fill_bytes to parse_fill_bits and rename its
first parameter to correct name end_bitPos0b (not end_bytePos0b).
unparsers.c: Rename unparse_fill_bytes to unparse_fill_bits and make
it write exactly N fill bits (no more, no less).
unparsers.h: Rename unparse_fill_bytes to unparse_fill_bits and rename
its first parameter to correct name end_bitPos0b (not end_bytePos0b).
CodeGenerator.scala: Use standard Scala idiom for getting CC and PATH
environment variables.
CodeGeneratorState.scala: Rename calls of (un)parse_fill_bytes to
(un)parse_fill_bits in generated C code.
ex_nums.tdml: Make comments show how to run CLI test subcommand with
both daffodil and daffodilC implementations. Remove config-runtime1
and config-runtime2 since tunable tdmlImplementation doesn't exist
anymore. Add implementation-specific error tests with
implementations="daffodil" and implementations="daffodilC" to
demonstrate how runtime1 and runtime2 handle non-fixed values in
elements with fixed attributes slightly differently depending on
validation levels. Combine runtime2 error_limited and error_on tests
into error_parse since runtime2 doesn't have a validation option.
nested.tdml: Replace tdmlImplementation configs with comments showing
how to run CLI test subcommand with different TDML implementations.
RunnerFactory.scala: Extend Runner API with TDMLImplementation
parameter in first apply method, Option[TDMLImplementation] parameter
in new two-argument apply method, and Option[TDMLImplementation]
parameter in base constructor to allow CLI and JUnit code to pass TDML
implementation to Runner(...) if they choose to. Put all known TDML
implementations in defaultImplementationsDefaultDefault to make it
easier to run TDML tests with any TDML implementation.
TDMLRunner.scala: Extend DFDLTestSuite constructor with
Option[TDMLImplementation] parameter to allow Runner to pass TDML
implementation, also remove __nl parameter which was only difference
between first and second constructors since second constructor isn't
called anymore and can be removed. Make DFDLTestSuite responsible for
defining defaultTDMLImplementation (either
sys.env.get("TDML_IMPLEMENTATION") or daffodil) and
tdmlDFDLProcessorFactory (moved to DFDLTestSuite from TestCase) to try
to minimize number of times code looks up TDML_IMPLEMENTATION and
matching TDMLDFDLProcessorFactory class and constructs new factory.
Unfortunately, both CLI Main class and JUnit tests run individual TDML
test cases one by one, not en masse, and each individual test calls
Runner.getTS which always creates a new DFDLTestSuite, so every single
test will fail and throw TDMLException if TDML_IMPLEMENTATION names an
invalid TDML implementation. Didn't try it, but maybe could move
defaultTDMLImplementation and tdmlDFDLProcessorFactory to Runner and
pass tdmlDFDLProcessorFactory instead of optTDMLImplementation to
DFDLTestSuite. Then only first test might fail and rest of tests
might run with daffodil implementation.
Runtime2TDMLDFDLProcessor.scala: Don't set implementationName to
"daffodil-runtime2" literal string, set it to
TDMLImplementation.DaffodilC.toString to get the correct name instead.
TestRunnerFactory.java: Pass Option.apply(null) [closest Java
equivalent to passing None] to Runner in first test case. Noticed
that IDEA complains TestRunnerFactory is calling private Runner
constructor, but sbt still compiles TestRunnerFactory with no problem.
ISRM_green_to_orange_60000.tdml: Replace tunable configs with comments
showing how to run CLI test subcommand with different TDML
implementations.
ISRM_orange_to_green_60002.tdml: Replace tunable configs with comments
showing how to run CLI test subcommand with different TDML
implementations.
MPU_green_to_orange_60004.tdml: Replace tunable configs with comments
showing how to run CLI test subcommand with different TDML
implementations.
MPU_orange_to_green_60006.tdml: Replace tunable configs with comments
showing how to run CLI test subcommand with different TDML
implementations.
collisions.tdml: Replace tunable configs with comments showing how to
run CLI test subcommand with different TDML implementations.
egress_xdcc_bw.tdml: Replace tunable configs with comments showing how
to run CLI test subcommand with different TDML implementations.
ingress_xdcc_bw.tdml: Replace tunable configs with comments showing
how to run CLI test subcommand with different TDML implementations.
orion.tdml: Replace tunable configs with comments showing how to run
CLI test subcommand with different TDML implementations.
TestCollisions.scala: Pass TDMLImplementation.DaffodilC to Runner.
TestEgressXdccBw.scala: Pass TDMLImplementation.DaffodilC to Runner.
TestExNums.scala: Pass TDMLImplementation.Daffodil and
TDMLImplementation.DaffodilC to two Runners to run both runtime1 and
runtime2 tests side by side. Combine runtime2 error_limited and
error_on tests into error_parse since runtime2 doesn't have a
validation option.
TestIngressXdccBw.scala: Pass TDMLImplementation.DaffodilC to Runner.
TestIsrmGreenToOrange60000.scala: Pass TDMLImplementation.DaffodilC to
Runner.
TestIsrmOrangeToGreen60002.scala: Pass TDMLImplementation.DaffodilC to
Runner.
TestMpuGreenToOrange60004.scala: Pass TDMLImplementation.DaffodilC to
Runner.
TestMpuOrangeToGreen60006.scala: Pass TDMLImplementation.DaffodilC to
Runner.
TestNested.scala: Pass TDMLImplementation.DaffodilC to Runner.
TestOrion.scala: Pass TDMLImplementation.DaffodilC to Runner.
---
.../CLI/testNonCompatibleImplementation.tdml | 29 ++++-
.../it/scala/org/apache/daffodil/CLI/Util.scala | 5 +-
.../daffodil/executing/TestCLIexecuting.scala | 42 ++++++-
.../src/main/scala/org/apache/daffodil/Main.scala | 22 +++-
.../resources/org/apache/daffodil/xsd/tdml.xsd | 2 +-
.../resources/org/apache/daffodil/xsd/dafext.xsd | 26 ++--
.../daffodil/runtime2/c/libruntime/parsers.c | 25 ++--
.../daffodil/runtime2/c/libruntime/parsers.h | 4 +-
.../daffodil/runtime2/c/libruntime/unparsers.c | 25 ++--
.../daffodil/runtime2/c/libruntime/unparsers.h | 4 +-
.../apache/daffodil/runtime2/CodeGenerator.scala | 4 +-
.../runtime2/generators/CodeGeneratorState.scala | 4 +-
.../org/apache/daffodil/runtime2/ex_nums.tdml | 131 +++++++++++++--------
.../org/apache/daffodil/runtime2/nested.tdml | 17 +--
.../org/apache/daffodil/tdml/RunnerFactory.scala | 38 ++++--
.../org/apache/daffodil/tdml/TDMLRunner.scala | 108 ++++++++---------
.../tdml/processor/Runtime2TDMLDFDLProcessor.scala | 2 +-
.../apache/daffodil/tdml/TestRunnerFactory.java | 2 +
.../runtime2/ISRM_green_to_orange_60000.tdml | 19 +--
.../runtime2/ISRM_orange_to_green_60002.tdml | 17 +--
.../runtime2/MPU_green_to_orange_60004.tdml | 17 +--
.../runtime2/MPU_orange_to_green_60006.tdml | 19 +--
.../org/apache/daffodil/runtime2/collisions.tdml | 17 +--
.../apache/daffodil/runtime2/egress_xdcc_bw.tdml | 20 ++--
.../apache/daffodil/runtime2/ingress_xdcc_bw.tdml | 18 +--
.../org/apache/daffodil/runtime2/orion.tdml | 17 +--
.../apache/daffodil/runtime2/TestCollisions.scala | 5 +-
.../daffodil/runtime2/TestEgressXdccBw.scala | 3 +-
.../org/apache/daffodil/runtime2/TestExNums.scala | 23 ++--
.../daffodil/runtime2/TestIngressXdccBw.scala | 3 +-
.../runtime2/TestIsrmGreenToOrange60000.scala | 3 +-
.../runtime2/TestIsrmOrangeToGreen60002.scala | 3 +-
.../runtime2/TestMpuGreenToOrange60004.scala | 3 +-
.../runtime2/TestMpuOrangeToGreen60006.scala | 3 +-
.../org/apache/daffodil/runtime2/TestNested.scala | 3 +-
.../org/apache/daffodil/runtime2/TestOrion.scala | 5 +-
36 files changed, 390 insertions(+), 298 deletions(-)
diff --git
a/daffodil-cli/src/it/resources/org/apache/daffodil/CLI/testNonCompatibleImplementation.tdml
b/daffodil-cli/src/it/resources/org/apache/daffodil/CLI/testNonCompatibleImplementation.tdml
index d62a18507..adb663afd 100644
---
a/daffodil-cli/src/it/resources/org/apache/daffodil/CLI/testNonCompatibleImplementation.tdml
+++
b/daffodil-cli/src/it/resources/org/apache/daffodil/CLI/testNonCompatibleImplementation.tdml
@@ -27,10 +27,20 @@
<tdml:defineSchema name="s1">
<xs:include
schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<dfdl:format ref="ex:GeneralFormat" />
-
<xs:element name="e1" dfdl:lengthKind="explicit"
dfdl:length="2" type="xs:int" />
+ </tdml:defineSchema>
+ <tdml:defineSchema name="s2">
+ <xs:include
schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <dfdl:format ref="ex:GeneralFormat" representation="binary" />
+ <xs:element name="e1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="e2" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
</tdml:defineSchema>
<tdml:parserTestCase name="testNotCompatibleImplementation1" root="e1"
@@ -44,4 +54,19 @@
</tdml:infoset>
</tdml:parserTestCase>
-</tdml:testSuite>
\ No newline at end of file
+ <tdml:parserTestCase name="testDaffodilCImplementation1" root="e1"
+ model="s2" description="this test specifies daffodilC as implementation."
+ implementations="daffodilC">
+ <tdml:document>
+ <tdml:documentPart type="byte">0000002a</tdml:documentPart>
+ </tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <e1>
+ <e2>42</e2>
+ </e1>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+</tdml:testSuite>
diff --git a/daffodil-cli/src/it/scala/org/apache/daffodil/CLI/Util.scala
b/daffodil-cli/src/it/scala/org/apache/daffodil/CLI/Util.scala
index fc1d2586a..0442d0fd6 100644
--- a/daffodil-cli/src/it/scala/org/apache/daffodil/CLI/Util.scala
+++ b/daffodil-cli/src/it/scala/org/apache/daffodil/CLI/Util.scala
@@ -26,7 +26,6 @@ import org.apache.daffodil.Main.ExitCode
import java.nio.file.Paths
import java.io.{File, PrintWriter}
-import scala.collection.JavaConverters._
import java.util.concurrent.TimeUnit
import org.apache.daffodil.xml.XMLUtils
import org.junit.Assert.fail
@@ -39,7 +38,7 @@ object Util {
val isWindows =
System.getProperty("os.name").toLowerCase().startsWith("windows")
- val dafRoot = sys.env.get("DAFFODIL_HOME").getOrElse(".")
+ val dafRoot = sys.env.getOrElse("DAFFODIL_HOME", ".")
def daffodilPath(dafRelativePath: String): String = {
XMLUtils.slashify(dafRoot) + dafRelativePath
@@ -82,7 +81,7 @@ object Util {
// The inputStream will be at index 0
// The errorStream will be at index 1
def getShell(cmd: String, spawnCmd: String, envp: Map[String, String] =
Map.empty[String, String], timeout: Long): Expect = {
- val newEnv = System.getenv().asScala ++ envp
+ val newEnv = sys.env ++ envp
val envAsArray = newEnv.toArray.map { case (k, v) => k + "=" + v }
val process = Runtime.getRuntime().exec(spawnCmd, envAsArray)
diff --git
a/daffodil-cli/src/it/scala/org/apache/daffodil/executing/TestCLIexecuting.scala
b/daffodil-cli/src/it/scala/org/apache/daffodil/executing/TestCLIexecuting.scala
index 4506d3911..0fd008f48 100644
---
a/daffodil-cli/src/it/scala/org/apache/daffodil/executing/TestCLIexecuting.scala
+++
b/daffodil-cli/src/it/scala/org/apache/daffodil/executing/TestCLIexecuting.scala
@@ -194,7 +194,47 @@ class TestCLIexecuting {
val cmd = String.format("%s test %s testNotCompatibleImplementation1",
Util.binPath, testTdmlFile)
println(cmd)
shell.sendLine(cmd)
- shell.expect(contains("[Skipped] testNotCompatibleImplementation1 (Not
compatible implementation.)"))
+ shell.expect(contains("[Skipped] testNotCompatibleImplementation1 (not
compatible"))
+
+ Util.expectExitCode(ExitCode.Success, shell)
+ shell.sendLine("exit")
+ } finally {
+ shell.close()
+ }
+ }
+
+ @Test def test_CLI_catch_TestBadArguments(): Unit = {
+ val tdmlFile =
Util.daffodilPath("daffodil-cli/src/it/resources/org/apache/daffodil/CLI/testNonCompatibleImplementation.tdml")
+
+ val testTdmlFile = if (Util.isWindows) Util.cmdConvert(tdmlFile) else
tdmlFile
+
+ val shell = Util.start("")
+
+ try {
+ val cmd = String.format("%s test -I notDaffodilC %s", Util.binPath,
testTdmlFile)
+ println(cmd)
+ shell.sendLine(cmd)
+ shell.expectIn(1, contains("[error] Bad arguments for option
'implementation'"))
+
+ Util.expectExitCode(ExitCode.Usage, shell)
+ shell.sendLine("exit")
+ } finally {
+ shell.close()
+ }
+ }
+
+ @Test def test_CLI_Executing_implementation(): Unit = {
+ val tdmlFile =
Util.daffodilPath("daffodil-cli/src/it/resources/org/apache/daffodil/CLI/testNonCompatibleImplementation.tdml")
+
+ val testTdmlFile = if (Util.isWindows) Util.cmdConvert(tdmlFile) else
tdmlFile
+
+ val shell = Util.start("")
+
+ try {
+ val cmd = String.format("%s test -I daffodilC %s
testDaffodilCImplementation1", Util.binPath, testTdmlFile)
+ println(cmd)
+ shell.sendLine(cmd)
+ shell.expect(contains("[Pass] testDaffodilCImplementation1"))
Util.expectExitCode(ExitCode.Success, shell)
shell.sendLine("exit")
diff --git a/daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
b/daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
index adc504688..7002d5b74 100644
--- a/daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
+++ b/daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
@@ -57,6 +57,7 @@ import org.apache.daffodil.api.DFDL.ParseResult
import org.apache.daffodil.api.DFDL.UnparseResult
import org.apache.daffodil.api.DaffodilConfig
import org.apache.daffodil.api.DaffodilTunables
+import org.apache.daffodil.api.TDMLImplementation
import org.apache.daffodil.api.URISchemaSource
import org.apache.daffodil.api.ValidationMode
import org.apache.daffodil.api.WithDiagnostics
@@ -199,6 +200,15 @@ class CLIConf(arguments: Array[String]) extends
scallop.ScallopConf(arguments) {
}
})
+ implicit def implementationConverter =
singleArgConverter[TDMLImplementation]((s: String) => {
+ val optImplementation =
TDMLImplementation.optionStringToEnum("implementation", s)
+ if (!optImplementation.isDefined) {
+ throw new Exception("Unrecognized TDML implementation '%s'. Must be one
of %s"
+ .format(s, TDMLImplementation.allValues.mkString(", ")))
+ }
+ optImplementation.get
+ })
+
def qnameConvert(s: String): RefQName = {
val eQN = QName.refQNameFromExtendedSyntax(s)
eQN.get
@@ -388,7 +398,7 @@ class CLIConf(arguments: Array[String]) extends
scallop.ScallopConf(arguments) {
// Test Subcommand Options
object test extends scallop.Subcommand("test") {
- banner("""|Usage: daffodil test [-l] [-r] [-i] <tdmlfile> [testnames...]
+ banner("""|Usage: daffodil test [-I <implementation>] [-l] [-r] [-i]
<tdmlfile> [testnames...]
|
|List or execute tests in a TDML file
|
@@ -397,6 +407,10 @@ class CLIConf(arguments: Array[String]) extends
scallop.ScallopConf(arguments) {
descr("List or execute TDML tests")
helpWidth(width)
+ val implementation = opt[TDMLImplementation](short = 'I', argName =
"implementation",
+ descr = "Implementation to run TDML tests. Choose one of %s. Defaults to
%s."
+ .format(TDMLImplementation.allValues.mkString(", "),
TDMLImplementation.Daffodil.toString),
+ default = None)
val info = tally(descr = "Increment test result information output level,
one level for each -i")
val list = opt[Boolean](descr = "Show names and descriptions instead of
running test cases")
val regex = opt[Boolean](descr = "Treat <testnames...> as regular
expressions")
@@ -1257,7 +1271,8 @@ object Main {
val testOpts = conf.test
val tdmlFile = testOpts.tdmlfile()
- val tdmlRunner = new Runner(new java.io.File(tdmlFile))
+ val optTDMLImplementation = testOpts.implementation.toOption
+ val tdmlRunner = Runner(tdmlFile, optTDMLImplementation)
val tests = {
if (testOpts.testnames.isDefined) {
@@ -1330,7 +1345,8 @@ object Main {
case s: scala.util.control.ControlThrowable => throw s
case u: UnsuppressableException => throw u
case e: TDMLTestNotCompatibleException => {
- println("[Skipped] %s (Not compatible
implementation.)".format(name))
+ println("[Skipped] %s (not compatible with implementation
%s)"
+ .format(name, e.implementation.getOrElse("<none>")))
}
case e: Throwable => {
println("[Fail] %s".format(name))
diff --git a/daffodil-lib/src/main/resources/org/apache/daffodil/xsd/tdml.xsd
b/daffodil-lib/src/main/resources/org/apache/daffodil/xsd/tdml.xsd
index 81a0d6043..5a9c157e3 100644
--- a/daffodil-lib/src/main/resources/org/apache/daffodil/xsd/tdml.xsd
+++ b/daffodil-lib/src/main/resources/org/apache/daffodil/xsd/tdml.xsd
@@ -101,7 +101,7 @@
<simpleType name="implementationItem">
<restriction base="xs:token">
<enumeration value="daffodil"/>
- <enumeration value="daffodil-runtime2"/>
+ <enumeration value="daffodilC"/>
<enumeration value="ibm"/>
</restriction>
</simpleType>
diff --git
a/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
b/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
index c70bbb88d..55258eb9b 100644
--- a/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
+++ b/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
@@ -45,7 +45,7 @@
</xs:complexType>
<xs:simpleType name="PropertyNameType">
- <xs:restriction base="xs:string">
+ <xs:restriction base="xs:token">
<xs:enumeration value="parseUnparsePolicy"/>
</xs:restriction>
</xs:simpleType>
@@ -502,14 +502,6 @@
</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="tdmlImplementation" type="xs:string"
default="daffodil" minOccurs="0">
- <xs:annotation>
- <xs:documentation>
- TDMLDFDLProcessorFactory implementation to use when running TDML
tests.
- Allowed values are "daffodil" (default), "daffodil-runtime2",
and "ibm".
- </xs:documentation>
- </xs:annotation>
- </xs:element>
<xs:element name="tempFilePath" type="xs:string" default="This string
is ignored. Default value is taken from java.io.tmpdir property" minOccurs="0">
<xs:annotation>
<xs:documentation>
@@ -587,15 +579,27 @@
<xs:restriction base="dfdlx:ParseUnparsePolicyEnum" />
</xs:simpleType>
<xs:simpleType>
- <xs:restriction base="xs:string">
+ <xs:restriction base="xs:token">
<xs:enumeration value="fromRoot" />
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
+ <!--
+ TDML implementation to use when running TDML tests. Currently daffodil and
ibm use the
+ same classname, so you still need different classpaths to call ibm as a
cross tester.
+ -->
+ <xs:simpleType name="TunableTDMLImplementation">
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="daffodil" />
+ <xs:enumeration value="daffodilC" />
+ <xs:enumeration value="ibm" />
+ </xs:restriction>
+ </xs:simpleType>
+
<xs:simpleType name="TunableUnqualifiedPathStepPolicy">
- <xs:restriction base="xs:string">
+ <xs:restriction base="xs:token">
<xs:enumeration value="defaultNamespace" />
<xs:enumeration value="noNamespace" />
<xs:enumeration value="preferDefaultNamespace" />
diff --git
a/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/parsers.c
b/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/parsers.c
index d1ca788bf..c92e58a22 100644
---
a/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/parsers.c
+++
b/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/parsers.c
@@ -507,26 +507,25 @@ parse_le_uint8(uint8_t *number, size_t num_bits, PState
*pstate)
*number = (uint8_t)integer;
}
-// Skip fill bytes until end bitPos0b is reached
+// Parse fill bits until end bitPos0b is reached
void
-parse_fill_bytes(size_t end_bitPos0b, PState *pstate)
+parse_fill_bits(size_t end_bitPos0b, PState *pstate)
{
- union
- {
- uint8_t bytes[1];
- } buffer;
+ assert(pstate->bitPos0b <= end_bitPos0b);
- // Update our last successful parse position only if this loop
- // finishes without any errors
- size_t current_bitPos0b = pstate->bitPos0b;
- while (current_bitPos0b < end_bitPos0b)
+ size_t fill_bits = end_bitPos0b - pstate->bitPos0b;
+ uint8_t bytes[1];
+ while (fill_bits)
{
- read_bits(buffer.bytes, BYTE_WIDTH, pstate);
+ size_t num_bits = (fill_bits >= BYTE_WIDTH) ? BYTE_WIDTH : fill_bits;
+ read_bits(bytes, num_bits, pstate);
if (pstate->error) return;
- current_bitPos0b += BYTE_WIDTH;
+ fill_bits -= num_bits;
}
- pstate->bitPos0b = current_bitPos0b;
+
+ // If we got all the way here, update our last successful parse position
+ pstate->bitPos0b = end_bitPos0b;
}
// Allocate memory for hexBinary array
diff --git
a/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/parsers.h
b/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/parsers.h
index 52e08d5cb..bacf63496 100644
---
a/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/parsers.h
+++
b/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/parsers.h
@@ -57,9 +57,9 @@ extern void parse_le_uint32(uint32_t *number, size_t
num_bits, PState *pstate);
extern void parse_le_uint64(uint64_t *number, size_t num_bits, PState *pstate);
extern void parse_le_uint8(uint8_t *number, size_t num_bits, PState *pstate);
-// Parse fill bytes until end bytePos0b is reached
+// Parse fill bits until end bitPos0b is reached
-extern void parse_fill_bytes(size_t end_bytePos0b, PState *pstate);
+extern void parse_fill_bits(size_t end_bitPos0b, PState *pstate);
// Allocate memory for hexBinary array
diff --git
a/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/unparsers.c
b/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/unparsers.c
index fd3639f70..e3210b8ff 100644
---
a/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/unparsers.c
+++
b/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/unparsers.c
@@ -401,27 +401,24 @@ unparse_le_uint8(uint8_t number, size_t num_bits, UState
*ustate)
unparse_endian_uint64(LITTLE_ENDIAN_DATA, number, num_bits, ustate);
}
-// Add fill bytes until end bitPos0b is reached
+// Unparse fill bits until end bitPos0b is reached
void
-unparse_fill_bytes(size_t end_bitPos0b, const uint8_t fill_byte, UState
*ustate)
+unparse_fill_bits(size_t end_bitPos0b, const uint8_t fill_byte, UState *ustate)
{
- union
- {
- uint8_t bytes[1];
- } buffer;
- buffer.bytes[0] = fill_byte;
+ assert(ustate->bitPos0b <= end_bitPos0b);
- // Update our last successful write position only if this loop
- // finishes without any errors
- size_t current_bitPos0b = ustate->bitPos0b;
- while (current_bitPos0b < end_bitPos0b)
+ size_t fill_bits = end_bitPos0b - ustate->bitPos0b;
+ while (fill_bits)
{
- write_bits(buffer.bytes, BYTE_WIDTH, ustate);
+ size_t num_bits = (fill_bits >= BYTE_WIDTH) ? BYTE_WIDTH : fill_bits;
+ write_bits(&fill_byte, num_bits, ustate);
if (ustate->error) return;
- current_bitPos0b += BYTE_WIDTH;
+ fill_bits -= num_bits;
}
- ustate->bitPos0b = current_bitPos0b;
+
+ // If we got all the way here, update our last successful write position
+ ustate->bitPos0b = end_bitPos0b;
}
// Unparse opaque bytes from hexBinary field
diff --git
a/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/unparsers.h
b/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/unparsers.h
index b1d56b9a4..fc53a8403 100644
---
a/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/unparsers.h
+++
b/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libruntime/unparsers.h
@@ -57,9 +57,9 @@ extern void unparse_le_uint32(uint32_t number, size_t
num_bits, UState *ustate);
extern void unparse_le_uint64(uint64_t number, size_t num_bits, UState
*ustate);
extern void unparse_le_uint8(uint8_t number, size_t num_bits, UState *ustate);
-// Unparse fill bytes until end bytePos0b is reached
+// Unparse fill bits until end bitPos0b is reached
-extern void unparse_fill_bytes(size_t end_bytePos0b, const uint8_t fill_byte,
UState *ustate);
+extern void unparse_fill_bits(size_t end_bitPos0b, const uint8_t fill_byte,
UState *ustate);
// Unparse opaque bytes from hexBinary field
diff --git
a/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/CodeGenerator.scala
b/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/CodeGenerator.scala
index 54acfecc6..c7497b119 100644
---
a/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/CodeGenerator.scala
+++
b/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/CodeGenerator.scala
@@ -161,9 +161,9 @@ class CodeGenerator(root: Root) extends DFDL.CodeGenerator {
* sequence if no compiler could be found in the user's PATH.
*/
lazy val pickCompiler: Seq[String] = {
- val ccEnv = System.getenv("CC")
+ val ccEnv = sys.env.getOrElse("CC", "zig cc")
val compilers = Seq(ccEnv, "zig cc", "cc", "clang", "gcc")
- val path = System.getenv("PATH").split(File.pathSeparatorChar)
+ val path = sys.env.getOrElse("PATH", ".").split(File.pathSeparatorChar)
def inPath(compiler: String): Boolean = {
(compiler != null) && {
val exec = compiler.takeWhile(_ != ' ')
diff --git
a/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/generators/CodeGeneratorState.scala
b/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/generators/CodeGeneratorState.scala
index 0e09ccf5c..d6505f5ff 100644
---
a/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/generators/CodeGeneratorState.scala
+++
b/daffodil-runtime2/src/main/scala/org/apache/daffodil/runtime2/generators/CodeGeneratorState.scala
@@ -331,10 +331,10 @@ class CodeGeneratorState(private val root: ElementBase) {
if (context.maybeFixedLengthInBits.isDefined &&
context.maybeFixedLengthInBits.get > 0) {
val octalFillByte = context.fillByteEv.constValue.toByte.toOctalString
val parseStatement =
- s""" parse_fill_bytes(end_bitPos0b, pstate);
+ s""" parse_fill_bits(end_bitPos0b, pstate);
| if (pstate->error) return;""".stripMargin
val unparseStatement =
- s""" unparse_fill_bytes(end_bitPos0b, '\\$octalFillByte', ustate);
+ s""" unparse_fill_bits(end_bitPos0b, '\\$octalFillByte', ustate);
| if (ustate->error) return;""".stripMargin
structs.top.parserStatements += parseStatement
diff --git
a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.tdml
b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.tdml
index 9c4927e4b..4389248da 100644
---
a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.tdml
+++
b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.tdml
@@ -17,42 +17,32 @@
-->
<tdml:testSuite
- defaultImplementations="daffodil daffodil-runtime2"
- defaultRoundTrip="onePass"
+ defaultRoundTrip="none"
description="TDML tests for ex_nums.dfdl.xsd"
xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData">
<!--
- Can run all tests in this file with:
+ Run all tests:
- daffodil test -i ex_nums.tdml
- -->
-
- <tdml:defineConfig name="config-runtime1">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ daffodil test -i -I daffodil ex_nums.tdml
+ daffodil test -i -I daffodilC ex_nums.tdml
- <tdml:defineConfig name="config-runtime2">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil-runtime2</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
-
- <!--
- Can run individual daffodil commands for easier debugging:
+ Or you can debug specific steps in isolation:
daffodil parse -s ex_nums.dfdl.xsd -o ex_nums.dat.xml ex_nums.dat
daffodil unparse -s ex_nums.dfdl.xsd -o ex_nums.dat ex_nums.dat.xml
+
+ daffodil generate c -s ex_nums.dfdl.xsd && cd c && make
+ c/daffodil parse -o ex_nums.dat.xml ex_nums.dat
+ c/daffodil unparse -o ex_nums.dat ex_nums.dat.xml
-->
<tdml:parserTestCase
- config="config-runtime1"
model="ex_nums.dfdl.xsd"
- name="ex_nums_runtime1">
+ name="ex_nums"
+ roundTrip="onePass">
<tdml:document>
<tdml:documentPart type="file">ex_nums.dat</tdml:documentPart>
</tdml:document>
@@ -62,57 +52,80 @@
</tdml:parserTestCase>
<!--
- Can run individual daffodil commands for easier debugging:
-
- daffodil generate c -s ex_nums.dfdl.xsd && cd c && make
- c/daffodil parse -o ex_nums.dat.xml ex_nums.dat
- c/daffodil unparse -o ex_nums.dat ex_nums.dat.xml
+ In runtime1, parse with validation="off" or "limited" reads
+ non-fixed values with no validation diagnostics, while parse
+ with validation="on" reads non-fixed values with validation
+ diagnostics
+
+ daffodil parse -s ex_nums.dfdl.xsd -o /dev/null -V off ex_nums.error.dat
+ daffodil parse -s ex_nums.dfdl.xsd -o /dev/null -V limited
ex_nums.error.dat
+ daffodil parse -s ex_nums.dfdl.xsd -o /dev/null -V on ex_nums.error.dat
-->
<tdml:parserTestCase
- config="config-runtime2"
+ implementations="daffodil"
model="ex_nums.dfdl.xsd"
- name="ex_nums_runtime2">
+ name="runtime1_error_limited"
+ validation="limited">
<tdml:document>
- <tdml:documentPart type="file">ex_nums.dat</tdml:documentPart>
+ <tdml:documentPart type="file">ex_nums.error.dat</tdml:documentPart>
</tdml:document>
<tdml:infoset>
- <tdml:dfdlInfoset type="file">ex_nums.dat.xml</tdml:dfdlInfoset>
+ <tdml:dfdlInfoset type="file">ex_nums.error.dat.xml</tdml:dfdlInfoset>
</tdml:infoset>
</tdml:parserTestCase>
- <!--
- validation="limited" will report no validation errors, while
- validation="on" will report errors which cannot be captured
- -->
-
<tdml:parserTestCase
- config="config-runtime1"
model="ex_nums.dfdl.xsd"
- name="ex_nums_runtime1_error"
- roundTrip="none"
- validation="limited">
+ name="runtime1_error_on"
+ validation="on">
<tdml:document>
<tdml:documentPart type="file">ex_nums.error.dat</tdml:documentPart>
</tdml:document>
<tdml:infoset>
<tdml:dfdlInfoset type="file">ex_nums.error.dat.xml</tdml:dfdlInfoset>
</tdml:infoset>
+ <tdml:validationErrors>
+ <tdml:error>value</tdml:error>
+ <tdml:error>boolean_false</tdml:error>
+ <tdml:error>does not match</tdml:error>
+ </tdml:validationErrors>
</tdml:parserTestCase>
<!--
- Note that when unparsing (needs a separate test case since
- roundtripping is turned off), runtime2 should write fixed values
- instead of writing error values with validation diagnostics
- (change still to be done)
+ In runtime1, unparse writes non-fixed values with no error or
+ validation diagnostics regardless of validation setting
+
+ daffodil unparse -s ex_nums.dfdl.xsd -o /dev/null -V off
ex_nums.error.dat.xml
+ daffodil unparse -s ex_nums.dfdl.xsd -o /dev/null -V limited
ex_nums.error.dat.xml
+ daffodil unparse -s ex_nums.dfdl.xsd -o /dev/null -V on
ex_nums.error.dat.xml
+ -->
+
+ <tdml:unparserTestCase
+ implementations="daffodil"
+ model="ex_nums.dfdl.xsd"
+ name="runtime1_error_unparse">
+ <tdml:infoset>
+ <tdml:dfdlInfoset type="file">ex_nums.error.dat.xml</tdml:dfdlInfoset>
+ </tdml:infoset>
+ <tdml:document>
+ <tdml:documentPart type="file">ex_nums.error.dat</tdml:documentPart>
+ </tdml:document>
+ </tdml:unparserTestCase>
+
+ <!--
+ In runtime2, parse always reads non-fixed values with validation
+ diagnostics (parse doesn't even have a validation option, but
+ test must pass validation="on" so TDMLRunner can expect errors)
+
+ c/daffodil parse -o c/ex_nums.error.dat.xml ex_nums.error.dat
-->
<tdml:parserTestCase
- config="config-runtime2"
+ implementations="daffodilC"
model="ex_nums.dfdl.xsd"
- name="ex_nums_runtime2_error"
- roundTrip="none"
- validation="limited">
+ name="runtime2_error_parse"
+ validation="on">
<tdml:document>
<tdml:documentPart type="file">ex_nums.error.dat</tdml:documentPart>
</tdml:document>
@@ -158,4 +171,28 @@
</tdml:validationErrors>
</tdml:parserTestCase>
+ <!--
+ In runtime2, unparse always writes non-fixed values with error
+ diagnostics (unparse doesn't even have a validation option)
+
+ c/daffodil unparse -o c/ex_nums.error.dat ex_nums.error.dat.xml
+ -->
+
+ <tdml:unparserTestCase
+ implementations="daffodilC"
+ model="ex_nums.dfdl.xsd"
+ name="runtime2_error_unparse">
+ <tdml:infoset>
+ <tdml:dfdlInfoset type="file">ex_nums.error.dat.xml</tdml:dfdlInfoset>
+ </tdml:infoset>
+ <tdml:document>
+ <tdml:documentPart type="file">ex_nums.error.dat</tdml:documentPart>
+ </tdml:document>
+ <tdml:errors>
+ <tdml:error>value</tdml:error>
+ <tdml:error>boolean_false</tdml:error>
+ <tdml:error>does not match</tdml:error>
+ </tdml:errors>
+ </tdml:unparserTestCase>
+
</tdml:testSuite>
diff --git
a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/nested.tdml
b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/nested.tdml
index 66565e6f0..36a6516a1 100644
---
a/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/nested.tdml
+++
b/daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/nested.tdml
@@ -17,25 +17,18 @@
-->
<tdml:testSuite
- defaultConfig="config-runtime2"
- defaultImplementations="daffodil daffodil-runtime2"
defaultRoundTrip="onePass"
description="TDML tests for nested.dfdl.xsd"
xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData">
- <tdml:defineConfig name="config-runtime1">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ <!--
+ Run all tests:
- <tdml:defineConfig name="config-runtime2">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil-runtime2</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ daffodil test -i -I daffodil nested.tdml
+ daffodil test -i -I daffodilC nested.tdml
+ -->
<tdml:parserTestCase model="nested.dfdl.xsd" name="nested_struct">
<tdml:document>
diff --git
a/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/RunnerFactory.scala
b/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/RunnerFactory.scala
index 01d54d371..8d230016c 100644
---
a/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/RunnerFactory.scala
+++
b/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/RunnerFactory.scala
@@ -17,6 +17,8 @@
package org.apache.daffodil.tdml
+import java.nio.file.Paths
+import org.apache.daffodil.api.TDMLImplementation
import org.apache.daffodil.util.Misc
/**
@@ -37,6 +39,7 @@ import org.apache.daffodil.util.Misc
*/
object Runner {
def apply(dir: String, file: String,
+ tdmlImplementation: TDMLImplementation = TDMLImplementation.Daffodil,
validateTDMLFile: Boolean = true,
validateDFDLSchemas: Boolean = true,
compileAllTopLevel: Boolean = false,
@@ -44,21 +47,40 @@ object Runner {
defaultValidationDefault: String = defaultValidationDefaultDefault,
defaultImplementationsDefault: Seq[String] =
defaultImplementationsDefaultDefault): Runner = {
- val resourceDir = if (dir.startsWith("/")) dir else "/" + dir
- val resourcePath = if (resourceDir.endsWith("/")) resourceDir + file else
resourceDir + "/" + file
+ // Prepend forward slash to turn dir/file into classpath resource
+ val resourceDir = if (dir.startsWith("/"))
+ dir
+ else
+ "/" + dir
+ val resourcePath = if (resourceDir.endsWith("/"))
+ resourceDir + file
+ else
+ resourceDir + "/" + file
- new Runner(Right(resourcePath), validateTDMLFile, validateDFDLSchemas,
compileAllTopLevel,
- defaultRoundTripDefault, defaultValidationDefault,
defaultImplementationsDefault)
+ new Runner(Right(resourcePath), Some(tdmlImplementation),
validateTDMLFile, validateDFDLSchemas,
+ compileAllTopLevel, defaultRoundTripDefault, defaultValidationDefault,
defaultImplementationsDefault)
}
+ // Scala 2 allows only one apply method to have default arguments,
+ // so we must overload the next pair of apply methods both with and
+ // without optTDMLImplementation
+
def apply(path: String): Runner =
new Runner(path)
+ def apply(path: String, optTDMLImplementation: Option[TDMLImplementation]):
Runner =
+ // Don't turn path into classpath resource; we want to open a real file
+ new Runner(Right(Paths.get(path).toUri.toString), optTDMLImplementation)
+
+ // Scala 2 allows only one apply method to have default arguments,
+ // so we must overload the next pair of apply methods (generally
+ // used only for testing) both w/ and w/o validateTDMLFile
+
def apply(elem: scala.xml.Elem): Runner =
new Runner(elem)
def apply(elem: scala.xml.Elem, validateTDMLFile: Boolean): Runner =
- new Runner(Left(elem), validateTDMLFile)
+ new Runner(Left(elem), validateTDMLFile = validateTDMLFile)
// Yes, that's a lot of defaults.....
// but really it is 3-tiers deep:
@@ -76,7 +98,7 @@ object Runner {
* A test or test suite can override this to specify more or different
implementations
* that the test should pass for.
*/
- def defaultImplementationsDefaultDefault = Seq("daffodil", "ibm")
+ def defaultImplementationsDefaultDefault =
TDMLImplementation.allValues.map(_.toString)
/**
* By default we don't run Daffodil negative TDML tests against
cross-testers.
@@ -106,6 +128,7 @@ object Runner {
*/
class Runner private (
source: Either[scala.xml.Elem, String],
+ optTDMLImplementation: Option[TDMLImplementation] = None,
validateTDMLFile: Boolean = true,
validateDFDLSchemas: Boolean = true,
compileAllTopLevel: Boolean = false,
@@ -113,7 +136,6 @@ class Runner private (
defaultValidationDefault: String = Runner.defaultValidationDefaultDefault,
defaultImplementationsDefault: Seq[String] =
Runner.defaultImplementationsDefaultDefault) {
-
/**
* Create a runner for the path. This constructor requires this path be on
* the classpath. A forward slash is prepended to ensure this path always
@@ -172,8 +194,8 @@ class Runner private (
case Right(r) => if (r.startsWith("/")) Misc.getRequiredResource(r)
else new java.net.URI(r)
}
ts = new DFDLTestSuite(
- null,
elemOrURI,
+ optTDMLImplementation,
validateTDMLFile,
validateDFDLSchemas,
compileAllTopLevel,
diff --git
a/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
b/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
index f7747505b..a1b3d9353 100644
--- a/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
+++ b/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
@@ -41,6 +41,7 @@ import org.apache.daffodil.api.DaffodilSchemaSource
import org.apache.daffodil.api.DaffodilTunables
import org.apache.daffodil.api.DataLocation
import org.apache.daffodil.api.EmbeddedSchemaSource
+import org.apache.daffodil.api.TDMLImplementation
import org.apache.daffodil.api.URISchemaSource
import org.apache.daffodil.api.UnitTestSchemaSource
import org.apache.daffodil.api.ValidationMode
@@ -140,6 +141,7 @@ private[tdml] object DFDLTestSuite {
* E.g., it should only need an API specified as a collection of Scala traits,
and some simple way to inject
* dependency on one factory to create processors.
*
+ * Use the optTDMLImplementation arg to override which TDML implementation
runs the test.
*
* Use the validateTDMLFile arg to bypass validation of the TDML document
itself.
*
@@ -166,10 +168,8 @@ private[tdml] object DFDLTestSuite {
*/
class DFDLTestSuite private[tdml] (
- // this extra arg allows us to make this primary constructor
- // package private so we can deprecate the one generally used.
- val __nl: Null,
aNodeFileOrURL: Any,
+ val optTDMLImplementation: Option[TDMLImplementation],
validateTDMLFile: Boolean,
val validateDFDLSchemas: Boolean,
val compileAllTopLevel: Boolean,
@@ -180,27 +180,6 @@ class DFDLTestSuite private[tdml] (
val shouldDoWarningComparisonOnCrossTests: Boolean)
extends HasSetDebugger {
- // Uncomment to force conversion of all test suites to use Runner(...)
instead.
- // That avoids creating the test suites repeatedly, but also leaks memory
unless
- // you have an @AfterClass shutdown method in the object that calls
runner.reset() at end.
- @deprecated("Use Runner(...) instead.", "3.2.0")
- def this(
- aNodeFileOrURL: Any,
- validateTDMLFile: Boolean = true,
- validateDFDLSchemas: Boolean = true,
- compileAllTopLevel: Boolean = false,
- defaultRoundTripDefault: RoundTrip = Runner.defaultRoundTripDefaultDefault,
- defaultValidationDefault: String = Runner.defaultValidationDefaultDefault,
- defaultImplementationsDefault: Seq[String] =
Runner.defaultImplementationsDefaultDefault,
- shouldDoErrorComparisonOnCrossTests: Boolean =
Runner.defaultShouldDoErrorComparisonOnCrossTests,
- shouldDoWarningComparisonOnCrossTests: Boolean =
Runner.defaultShouldDoWarningComparisonOnCrossTests) =
- this(null, aNodeFileOrURL, validateTDMLFile, validateDFDLSchemas,
compileAllTopLevel,
- defaultRoundTripDefault,
- defaultValidationDefault,
- defaultImplementationsDefault,
- shouldDoErrorComparisonOnCrossTests,
- shouldDoWarningComparisonOnCrossTests)
-
val TMP_DIR = System.getProperty("java.io.tmpdir", ".")
aNodeFileOrURL match {
@@ -231,6 +210,53 @@ class DFDLTestSuite private[tdml] (
overhead of creating the one we're running.
*/
+ // Use optTDMLImplementation if it was passed in, otherwise use our
+ // default TDML implementation (normally daffodil unless overridden
+ // by setting the environment variable TDML_IMPLEMENTATION)
+ lazy val defaultTDMLImplementation: TDMLImplementation = {
+ val envName = "TDML_IMPLEMENTATION"
+ val value = sys.env.getOrElse(envName, "")
+ val optImpl = TDMLImplementation.optionStringToEnum(envName, value)
+ // Warn if value of environment variable is not a valid implementation
+ if (value.nonEmpty && optImpl.isEmpty)
+ throw TDMLException(s"$envName=$value does not give a valid TDML
implementation", None)
+ optImpl.getOrElse(TDMLImplementation.Daffodil)
+ }
+
+ lazy val tdmlDFDLProcessorFactory: AbstractTDMLDFDLProcessorFactory = {
+ import scala.language.existentials
+
+ // Let optTDMLImplementation override defaultTDMLImplementation
+ val tdmlImplementation =
optTDMLImplementation.getOrElse(defaultTDMLImplementation)
+
+ // Right now both daffodil and ibm use the same classname loaded from
different
+ // classpaths, but we may find a better way to cross test with ibm in the
future
+ val className = tdmlImplementation match {
+ case TDMLImplementation.Daffodil =>
"org.apache.daffodil.tdml.processor.TDMLDFDLProcessorFactory"
+ case TDMLImplementation.DaffodilC =>
"org.apache.daffodil.tdml.processor.Runtime2TDMLDFDLProcessorFactory"
+ case TDMLImplementation.Ibm =>
"org.apache.daffodil.tdml.processor.TDMLDFDLProcessorFactory"
+ }
+
+ // If you haven't seen it before. Check out this Try(...) idiom.
+ // Much cleaner than the messy nest of individual try/catches for each
case.
+ //
+ // We're not catching anything here, but we could have surrounded the
tryInstance.get call with a
+ // single tier of catch, with cases for all the various throws that could
have happened anywhere on
+ // the three lines of actions that can throw various things.
+ //
+ // of course this will allocate an object, so not for tightest inner
loops, but the code
+ // cleanup is substantial.
+ //
+ val clazz = Try(Class.forName(className))
+ val constructor = clazz.map { _.getDeclaredConstructor() }
+ val tryInstance = constructor.map {
_.newInstance().asInstanceOf[AbstractTDMLDFDLProcessorFactory] }
+ val res = tryInstance.recover {
+ // encapsulate exception as TDMLException and throw
+ case e => throw TDMLException(e, None)
+ }.get
+ res
+ }
+
lazy val errorHandler = new org.xml.sax.ErrorHandler {
def warning(exception: SAXParseException) = {
loadingExceptions += exception
@@ -563,38 +589,6 @@ abstract class TestCase(testCaseXML: NodeSeq, val parent:
DFDLTestSuite) {
final def isNegativeTest = optExpectedErrors.isDefined
- lazy val tdmlDFDLProcessorFactory: AbstractTDMLDFDLProcessorFactory = {
- import scala.language.existentials
-
- // tdmlImplementation is a tunable choice with three values.
- val className = tunableObj.tdmlImplementation match {
- // Right now daffodil and ibm use the same ProcessFactory name
- case "daffodil" | "ibm" =>
"org.apache.daffodil.tdml.processor.TDMLDFDLProcessorFactory"
- case "daffodil-runtime2" =>
"org.apache.daffodil.tdml.processor.Runtime2TDMLDFDLProcessorFactory"
- case other => Assert.invariantFailed("'%s' not valid for
tdmlImplementation".format(other))
- }
-
- //
- // If you haven't seen it before. Check out this Try(...) idiom.
- // Much cleaner than the messy nest of individual try/catches for each
case.
- //
- // We're not catching anything here, but we could have surrounded the
tryInstance.get call with a
- // single tier of catch, with cases for all the various throws that could
have happened anywhere on
- // the three lines of actions that can throw various things.
- //
- // of course this will allocate an object, so not for tightest inner
loops, but the code
- // cleanup is substantial.
- //
- val clazz = Try(Class.forName(className))
- val constructor = clazz.map { _.getDeclaredConstructor() }
- val tryInstance = constructor.map {
_.newInstance().asInstanceOf[AbstractTDMLDFDLProcessorFactory] }
- val res = tryInstance.recover {
- case th =>
- toss(th, None) // encapsulates as TDMLException and throws.
- }.get
- res
- }
-
lazy val document = (testCaseXML \ "document").headOption.map { node =>
Document(node, this) }
lazy val optExpectedOrInputInfoset = (testCaseXML \
"infoset").headOption.map { node => new Infoset(node, this) }
lazy val optExpectedErrors: Option[ExpectedErrors] = (testCaseXML \
"errors").headOption.map { node => ExpectedErrors(node, this) }
@@ -805,7 +799,7 @@ abstract class TestCase(testCaseXML: NodeSeq, val parent:
DFDLTestSuite) {
def run(): Unit = {
val suppliedSchema = getSuppliedSchema()
- var impl: AbstractTDMLDFDLProcessorFactory = this.tdmlDFDLProcessorFactory
+ var impl: AbstractTDMLDFDLProcessorFactory =
parent.tdmlDFDLProcessorFactory
val implString = Some(impl.implementationName)
//
// Should we run the test?
diff --git
a/daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/Runtime2TDMLDFDLProcessor.scala
b/daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/Runtime2TDMLDFDLProcessor.scala
index 72cb7acd6..927bc99d6 100644
---
a/daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/Runtime2TDMLDFDLProcessor.scala
+++
b/daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/Runtime2TDMLDFDLProcessor.scala
@@ -38,7 +38,7 @@ final class Runtime2TDMLDFDLProcessorFactory private(
override type R = Runtime2TDMLDFDLProcessorFactory
- override def implementationName = "daffodil-runtime2"
+ override def implementationName = TDMLImplementation.DaffodilC.toString
def this() = this(compiler = Compiler(validateDFDLSchemas = true),
checkAllTopLevel = false,
diff --git
a/daffodil-tdml-processor/src/test/java/org/apache/daffodil/tdml/TestRunnerFactory.java
b/daffodil-tdml-processor/src/test/java/org/apache/daffodil/tdml/TestRunnerFactory.java
index fc75cf117..b8899cb27 100644
---
a/daffodil-tdml-processor/src/test/java/org/apache/daffodil/tdml/TestRunnerFactory.java
+++
b/daffodil-tdml-processor/src/test/java/org/apache/daffodil/tdml/TestRunnerFactory.java
@@ -24,6 +24,7 @@ import org.apache.daffodil.util.Misc;
import org.junit.Test;
import org.xml.sax.InputSource;
+import scala.Option;
import scala.collection.JavaConverters;
import scala.xml.Elem;
import scala.xml.XML;
@@ -39,6 +40,7 @@ public class TestRunnerFactory {
Right<scala.xml.Elem, String> rightURI = new Right<>(tdmlUri.toString());
Runner runner = new Runner(
rightURI,
+ Option.apply(null),
true,
true,
false,
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/ISRM_green_to_orange_60000.tdml
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/ISRM_green_to_orange_60000.tdml
index 9e69c35af..c37806ab0 100644
---
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/ISRM_green_to_orange_60000.tdml
+++
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/ISRM_green_to_orange_60000.tdml
@@ -17,8 +17,6 @@
-->
<tdml:testSuite
- defaultConfig="config-runtime2"
- defaultImplementations="daffodil daffodil-runtime2"
defaultRoundTrip="onePass"
defaultValidation="on"
description="TDML tests for ISRM_green_to_orange_60000.dfdl.xsd"
@@ -26,17 +24,12 @@
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData">
- <tdml:defineConfig name="config-runtime1">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
-
- <tdml:defineConfig name="config-runtime2">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil-runtime2</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ <!--
+ Run all tests:
+
+ daffodil test -i -I daffodil ISRM_green_to_orange_60000.tdml
+ daffodil test -i -I daffodilC ISRM_green_to_orange_60000.tdml
+ -->
<tdml:parserTestCase model="ISRM_green_to_orange_60000.dfdl.xsd"
name="ISRM_green_to_orange_60000_0">
<tdml:document>
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/ISRM_orange_to_green_60002.tdml
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/ISRM_orange_to_green_60002.tdml
index c1484b146..250d93588 100644
---
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/ISRM_orange_to_green_60002.tdml
+++
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/ISRM_orange_to_green_60002.tdml
@@ -17,8 +17,6 @@
-->
<tdml:testSuite
- defaultConfig="config-runtime2"
- defaultImplementations="daffodil daffodil-runtime2"
defaultRoundTrip="onePass"
defaultValidation="on"
description="TDML tests for ISRM_orange_to_green_60002.dfdl.xsd"
@@ -26,17 +24,12 @@
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData">
- <tdml:defineConfig name="config-runtime1">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ <!--
+ Run all tests:
- <tdml:defineConfig name="config-runtime2">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil-runtime2</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ daffodil test -i -I daffodil ISRM_orange_to_green_60002.tdml
+ daffodil test -i -I daffodilC ISRM_orange_to_green_60002.tdml
+ -->
<tdml:parserTestCase model="ISRM_orange_to_green_60002.dfdl.xsd"
name="ISRM_orange_to_green_60002">
<tdml:document>
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/MPU_green_to_orange_60004.tdml
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/MPU_green_to_orange_60004.tdml
index 314eb2e1e..ea360faf9 100644
---
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/MPU_green_to_orange_60004.tdml
+++
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/MPU_green_to_orange_60004.tdml
@@ -17,8 +17,6 @@
-->
<tdml:testSuite
- defaultConfig="config-runtime2"
- defaultImplementations="daffodil daffodil-runtime2"
defaultRoundTrip="onePass"
defaultValidation="on"
description="TDML tests for MPU_green_to_orange_60004.dfdl.xsd"
@@ -26,17 +24,12 @@
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData">
- <tdml:defineConfig name="config-runtime1">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ <!--
+ Run all tests:
- <tdml:defineConfig name="config-runtime2">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil-runtime2</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ daffodil test -i -I daffodil MPU_green_to_orange_60004.tdml
+ daffodil test -i -I daffodilC MPU_green_to_orange_60004.tdml
+ -->
<tdml:parserTestCase model="MPU_green_to_orange_60004.dfdl.xsd"
name="MPU_green_to_orange_60004">
<tdml:document>
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/MPU_orange_to_green_60006.tdml
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/MPU_orange_to_green_60006.tdml
index afc342287..442291f89 100644
---
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/MPU_orange_to_green_60006.tdml
+++
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/MPU_orange_to_green_60006.tdml
@@ -17,8 +17,6 @@
-->
<tdml:testSuite
- defaultConfig="config-runtime2"
- defaultImplementations="daffodil daffodil-runtime2"
defaultRoundTrip="onePass"
defaultValidation="on"
description="TDML tests for MPU_orange_to_green_60006.dfdl.xsd"
@@ -26,17 +24,12 @@
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData">
- <tdml:defineConfig name="config-runtime1">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
-
- <tdml:defineConfig name="config-runtime2">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil-runtime2</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ <!--
+ Run all tests:
+
+ daffodil test -i -I daffodil MPU_orange_to_green_60006.tdml
+ daffodil test -i -I daffodilC MPU_orange_to_green_60006.tdml
+ -->
<tdml:parserTestCase model="MPU_orange_to_green_60006.dfdl.xsd"
name="MPU_orange_to_green_60006_0">
<tdml:document>
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/collisions.tdml
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/collisions.tdml
index 30bead7eb..67ddcc617 100644
---
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/collisions.tdml
+++
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/collisions.tdml
@@ -17,23 +17,16 @@
-->
<tdml:testSuite
- defaultConfig="config-runtime2"
- defaultImplementations="daffodil daffodil-runtime2"
defaultRoundTrip="true"
xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData">
- <tdml:defineConfig name="config-runtime1">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ <!--
+ Run all tests:
- <tdml:defineConfig name="config-runtime2">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil-runtime2</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ daffodil test -i -I daffodil collisions.tdml
+ daffodil test -i -I daffodilC collisions.tdml
+ -->
<tdml:parserTestCase name="collisions" root="collisions"
model="collisions.dfdl.xsd">
<tdml:document>
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/egress_xdcc_bw.tdml
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/egress_xdcc_bw.tdml
index ff20e9b9c..ea4414ee6 100644
---
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/egress_xdcc_bw.tdml
+++
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/egress_xdcc_bw.tdml
@@ -17,25 +17,19 @@
-->
<tdml:testSuite
- defaultConfig="config-runtime2"
- defaultImplementations="daffodil daffodil-runtime2"
defaultRoundTrip="onePass"
+ defaultValidation="on"
description="TDML tests for egress_xdcc_bw.dfdl.xsd"
xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData">
- <tdml:defineConfig name="config-runtime1">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
-
- <tdml:defineConfig name="config-runtime2">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil-runtime2</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ <!--
+ Run all tests:
+
+ daffodil test -i -I daffodil egress_xdcc_bw.tdml
+ daffodil test -i -I daffodilC egress_xdcc_bw.tdml
+ -->
<tdml:parserTestCase model="egress_xdcc_bw.dfdl.xsd"
name="egress_xdcc_bw_11">
<tdml:document>
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/ingress_xdcc_bw.tdml
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/ingress_xdcc_bw.tdml
index 2b2beded1..573974b00 100644
---
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/ingress_xdcc_bw.tdml
+++
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/ingress_xdcc_bw.tdml
@@ -17,25 +17,19 @@
-->
<tdml:testSuite
- defaultConfig="config-runtime2"
- defaultImplementations="daffodil daffodil-runtime2"
defaultRoundTrip="onePass"
+ defaultValidation="on"
description="TDML tests for ingress_xdcc_bw.dfdl.xsd"
xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData">
- <tdml:defineConfig name="config-runtime1">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ <!--
+ Run all tests:
- <tdml:defineConfig name="config-runtime2">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil-runtime2</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ daffodil test -i -I daffodil ingress_xdcc_bw.tdml
+ daffodil test -i -I daffodilC ingress_xdcc_bw.tdml
+ -->
<tdml:parserTestCase model="ingress_xdcc_bw.dfdl.xsd"
name="ingress_xdcc_bw_111">
<tdml:document>
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/orion.tdml
b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/orion.tdml
index 0bd312c34..9583df44d 100644
--- a/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/orion.tdml
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/runtime2/orion.tdml
@@ -17,8 +17,6 @@
-->
<tdml:testSuite
- defaultConfig="config-runtime2"
- defaultImplementations="daffodil daffodil-runtime2"
defaultRoundTrip="onePass"
defaultValidation="on"
description="TDML tests for orion.dfdl.xsd"
@@ -26,17 +24,12 @@
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData">
- <tdml:defineConfig name="config-runtime1">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ <!--
+ Run all tests:
- <tdml:defineConfig name="config-runtime2">
- <daf:tunables>
- <daf:tdmlImplementation>daffodil-runtime2</daf:tdmlImplementation>
- </daf:tunables>
- </tdml:defineConfig>
+ daffodil test -i -I daffodil orion.tdml
+ daffodil test -i -I daffodilC orion.tdml
+ -->
<tdml:parserTestCase model="orion.dfdl.xsd" name="orion_aptina">
<tdml:document>
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestCollisions.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestCollisions.scala
index 2c5d02f53..69da8442a 100644
---
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestCollisions.scala
+++
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestCollisions.scala
@@ -17,13 +17,14 @@
package org.apache.daffodil.runtime2
-import org.junit.Test
+import org.apache.daffodil.api.TDMLImplementation
import org.apache.daffodil.tdml.Runner
import org.junit.AfterClass
+import org.junit.Test
object TestCollisions {
val testDir = "/org/apache/daffodil/runtime2/"
- val runner = Runner(testDir, "collisions.tdml")
+ val runner = Runner(testDir, "collisions.tdml", TDMLImplementation.DaffodilC)
@AfterClass def shutDown(): Unit = { runner.reset }
}
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestEgressXdccBw.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestEgressXdccBw.scala
index 7181df129..81accd72a 100644
---
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestEgressXdccBw.scala
+++
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestEgressXdccBw.scala
@@ -17,13 +17,14 @@
package org.apache.daffodil.runtime2
+import org.apache.daffodil.api.TDMLImplementation
import org.apache.daffodil.tdml.Runner
import org.junit.AfterClass
import org.junit.Test
object TestEgressXdccBw {
val testDir = "/org/apache/daffodil/runtime2/"
- val runner = Runner(testDir, "egress_xdcc_bw.tdml")
+ val runner = Runner(testDir, "egress_xdcc_bw.tdml",
TDMLImplementation.DaffodilC)
@AfterClass def shutDown(): Unit = { runner.reset }
}
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestExNums.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestExNums.scala
index 28c5930c9..1e4741ffb 100644
--- a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestExNums.scala
+++ b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestExNums.scala
@@ -17,22 +17,31 @@
package org.apache.daffodil.runtime2
-import org.junit.Test
+import org.apache.daffodil.api.TDMLImplementation
import org.apache.daffodil.tdml.Runner
import org.junit.AfterClass
+import org.junit.Test
object TestExNums {
val testDir = "/org/apache/daffodil/runtime2/"
- val runner = Runner(testDir, "ex_nums.tdml")
+ val runner1 = Runner(testDir, "ex_nums.tdml", TDMLImplementation.Daffodil)
+ val runner2 = Runner(testDir, "ex_nums.tdml", TDMLImplementation.DaffodilC)
- @AfterClass def shutDown(): Unit = { runner.reset }
+ @AfterClass def shutDown(): Unit = {
+ runner1.reset
+ runner2.reset
+ }
}
class TestExNums {
import TestExNums._
- @Test def test_ex_nums_runtime1(): Unit = {
runner.runOneTest("ex_nums_runtime1") }
- @Test def test_ex_nums_runtime1_error(): Unit = {
runner.runOneTest("ex_nums_runtime1_error") }
- @Test def test_ex_nums_runtime2(): Unit = {
runner.runOneTest("ex_nums_runtime2") }
- @Test def test_ex_nums_runtime2_error(): Unit = {
runner.runOneTest("ex_nums_runtime2_error") }
+ @Test def runtime1_ex_nums(): Unit = { runner1.runOneTest("ex_nums") }
+ @Test def runtime1_error_limited(): Unit = {
runner1.runOneTest("runtime1_error_limited") }
+ @Test def runtime1_error_on(): Unit = {
runner1.runOneTest("runtime1_error_on") }
+ @Test def runtime1_error_unparse(): Unit = {
runner1.runOneTest("runtime1_error_unparse") }
+
+ @Test def runtime2_ex_nums(): Unit = { runner2.runOneTest("ex_nums") }
+ @Test def runtime2_error_parse(): Unit = {
runner2.runOneTest("runtime2_error_parse") }
+ @Test def runtime2_error_unparse(): Unit = {
runner2.runOneTest("runtime2_error_unparse") }
}
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestIngressXdccBw.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestIngressXdccBw.scala
index 75211d1a4..4392ffdfa 100644
---
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestIngressXdccBw.scala
+++
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestIngressXdccBw.scala
@@ -17,13 +17,14 @@
package org.apache.daffodil.runtime2
+import org.apache.daffodil.api.TDMLImplementation
import org.apache.daffodil.tdml.Runner
import org.junit.AfterClass
import org.junit.Test
object TestIngressXdccBw {
val testDir = "/org/apache/daffodil/runtime2/"
- val runner = Runner(testDir, "ingress_xdcc_bw.tdml")
+ val runner = Runner(testDir, "ingress_xdcc_bw.tdml",
TDMLImplementation.DaffodilC)
@AfterClass def shutDown(): Unit = { runner.reset }
}
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestIsrmGreenToOrange60000.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestIsrmGreenToOrange60000.scala
index 63525ec35..f4571a093 100644
---
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestIsrmGreenToOrange60000.scala
+++
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestIsrmGreenToOrange60000.scala
@@ -17,13 +17,14 @@
package org.apache.daffodil.runtime2
+import org.apache.daffodil.api.TDMLImplementation
import org.apache.daffodil.tdml.Runner
import org.junit.AfterClass
import org.junit.Test
object TestIsrmGreenToOrange60000 {
val testDir = "/org/apache/daffodil/runtime2/"
- val runner = Runner(testDir, "ISRM_green_to_orange_60000.tdml")
+ val runner = Runner(testDir, "ISRM_green_to_orange_60000.tdml",
TDMLImplementation.DaffodilC)
@AfterClass def shutDown(): Unit = { runner.reset }
}
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestIsrmOrangeToGreen60002.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestIsrmOrangeToGreen60002.scala
index 35f26ee2b..19edbbcee 100644
---
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestIsrmOrangeToGreen60002.scala
+++
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestIsrmOrangeToGreen60002.scala
@@ -17,13 +17,14 @@
package org.apache.daffodil.runtime2
+import org.apache.daffodil.api.TDMLImplementation
import org.apache.daffodil.tdml.Runner
import org.junit.AfterClass
import org.junit.Test
object TestIsrmOrangeToGreen60002 {
val testDir = "/org/apache/daffodil/runtime2/"
- val runner = Runner(testDir, "ISRM_orange_to_green_60002.tdml")
+ val runner = Runner(testDir, "ISRM_orange_to_green_60002.tdml",
TDMLImplementation.DaffodilC)
@AfterClass def shutDown(): Unit = { runner.reset }
}
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestMpuGreenToOrange60004.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestMpuGreenToOrange60004.scala
index 6dc178882..58ef7e49e 100644
---
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestMpuGreenToOrange60004.scala
+++
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestMpuGreenToOrange60004.scala
@@ -17,13 +17,14 @@
package org.apache.daffodil.runtime2
+import org.apache.daffodil.api.TDMLImplementation
import org.apache.daffodil.tdml.Runner
import org.junit.AfterClass
import org.junit.Test
object TestMpuGreenToOrange60004 {
val testDir = "/org/apache/daffodil/runtime2/"
- val runner = Runner(testDir, "MPU_green_to_orange_60004.tdml")
+ val runner = Runner(testDir, "MPU_green_to_orange_60004.tdml",
TDMLImplementation.DaffodilC)
@AfterClass def shutDown(): Unit = { runner.reset }
}
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestMpuOrangeToGreen60006.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestMpuOrangeToGreen60006.scala
index 1e97542e8..df48c6a65 100644
---
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestMpuOrangeToGreen60006.scala
+++
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestMpuOrangeToGreen60006.scala
@@ -17,13 +17,14 @@
package org.apache.daffodil.runtime2
+import org.apache.daffodil.api.TDMLImplementation
import org.apache.daffodil.tdml.Runner
import org.junit.AfterClass
import org.junit.Test
object TestMpuOrangeToGreen60006 {
val testDir = "/org/apache/daffodil/runtime2/"
- val runner = Runner(testDir, "MPU_orange_to_green_60006.tdml")
+ val runner = Runner(testDir, "MPU_orange_to_green_60006.tdml",
TDMLImplementation.DaffodilC)
@AfterClass def shutDown(): Unit = { runner.reset }
}
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestNested.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestNested.scala
index 6716c6753..cd9e4891b 100644
--- a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestNested.scala
+++ b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestNested.scala
@@ -17,13 +17,14 @@
package org.apache.daffodil.runtime2
+import org.apache.daffodil.api.TDMLImplementation
import org.apache.daffodil.tdml.Runner
import org.junit.AfterClass
import org.junit.Test
object TestNested {
val testDir = "/org/apache/daffodil/runtime2/"
- val runner: Runner = Runner(testDir, "nested.tdml")
+ val runner: Runner = Runner(testDir, "nested.tdml",
TDMLImplementation.DaffodilC)
@AfterClass def shutDown(): Unit = { runner.reset }
}
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestOrion.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestOrion.scala
index 35678df39..34a6c5e9c 100644
--- a/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestOrion.scala
+++ b/daffodil-test/src/test/scala/org/apache/daffodil/runtime2/TestOrion.scala
@@ -17,13 +17,14 @@
package org.apache.daffodil.runtime2
-import org.junit.Test
+import org.apache.daffodil.api.TDMLImplementation
import org.apache.daffodil.tdml.Runner
import org.junit.AfterClass
+import org.junit.Test
object TestOrion {
val testDir = "/org/apache/daffodil/runtime2/"
- val runner = Runner(testDir, "orion.tdml")
+ val runner = Runner(testDir, "orion.tdml", TDMLImplementation.DaffodilC)
@AfterClass def shutDown(): Unit = { runner.reset }
}