You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by GitBox <gi...@apache.org> on 2022/08/22 01:33:42 UTC

[GitHub] [daffodil] tuxji commented on a diff in pull request #831: Added TDML with precompiled binary schema feature.

tuxji commented on code in PR #831:
URL: https://github.com/apache/daffodil/pull/831#discussion_r950939129


##########
daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/DaffodilTDMLDFDLProcessor.scala:
##########
@@ -160,9 +160,15 @@ final class TDMLDFDLProcessorFactory private (
     optRootName: Option[String],
     optRootNamespace: Option[String],
     tunables: Map[String, String]): TDML.CompileResult = {
-
-    val res = compileProcessor(schemaSource, useSerializedProcessor, optRootName, optRootNamespace)
-    res
+    if (schemaSource.isXSD) {
+      val res = compileProcessor(schemaSource, useSerializedProcessor, optRootName, optRootNamespace)
+      res
+    } else {
+      val dp = compiler.reload(schemaSource)
+      val diags = dp.getDiagnostics
+      Assert.invariant(diags.forall{! _.isError })
+      Right((diags, new DaffodilTDMLDFDLProcessor(dp)))
+    }

Review Comment:
   You've added a test that takes us to line 167 and calls compiler.reload but the test forces that method to throw an InvalidParserException("The saved parser is only compatible with Daffodil " + savedVersion + ". Current version is " + curVersion) and we never get to lines 168 and 170, hence the coverage check warnings on these lines.  
   
   You could write a test `testNonXSDModelPositiveGoodCompiledFile` which creates a parser, saves it to a temporary file (deleted automatically later), interpolates that temporary file's path into the test suite, and then runs the test suite like `testNonXSDModelNegativeBadCompiledFile` does except this test suite reloads the compiled parser successfully.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org