You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "stevedlawrence (via GitHub)" <gi...@apache.org> on 2024/04/09 13:34:26 UTC
[PR] Support using saved parsers in TDML tests [daffodil-sbt]
stevedlawrence opened a new pull request, #19:
URL: https://github.com/apache/daffodil-sbt/pull/19
Adds a new setting called daffodilTdmlUsesPackageBin, which if set to true causes the test task to trigger packageDaffodilBin to create saved parsers and put them on the test classpath. This allows TDML tests to reference and use saved parsers instead of re-compiling everytime tests are run.
Closes #18
--
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
Re: [PR] Support using saved parsers in TDML tests [daffodil-sbt]
Posted by "stevedlawrence (via GitHub)" <gi...@apache.org>.
stevedlawrence merged PR #19:
URL: https://github.com/apache/daffodil-sbt/pull/19
--
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
Re: [PR] Support using saved parsers in TDML tests [daffodil-sbt]
Posted by "tuxji (via GitHub)" <gi...@apache.org>.
tuxji commented on PR #19:
URL: https://github.com/apache/daffodil-sbt/pull/19#issuecomment-2047376240
Let's merge a PR bumping the Daffodil version in build.sbt from 3.7.0 to 3.8.0-SNAPSHOT first.
--
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
Re: [PR] Support using saved parsers in TDML tests [daffodil-sbt]
Posted by "stevedlawrence (via GitHub)" <gi...@apache.org>.
stevedlawrence commented on code in PR #19:
URL: https://github.com/apache/daffodil-sbt/pull/19#discussion_r1559363059
##########
README.md:
##########
@@ -94,6 +94,32 @@ If used, one may want to use the first value of this setting to configure
daffodilVersion := daffodilPackageBinVersions.value.head
```
+### Saved Parsers in TDML Tests
+
+For schemas that take a long time to compile, it is often convenient to use a
+saved parser created by the `packageDaffodilBin` task in TDML tests. If this
+is the case, set the following:
+
+```scala
+daffodilTdmlUsesPackageBin := true
+```
+
+When set to `true` , running `sbt test` automatically triggers
+`packageDaffodilBin` and puts the resulting saved parsers on the classpath so
+that TDML files can reference them. Note that when referencing saved parsers
+from a TDML file, version numbers and `daffodilXYZ` are excluded--this way TDML
+files do not need to be updated when a version is changed. For example, a TDML
+file using a saved parser created at `target/format-1.0-file-daffodil350.bin`
+is referenced like this:
+
+```xml
+<parserTestCase ... model="/format-file.bin">
+```
+
+Note that only saved parsers for `daffodilVersion` can be referenced. For this
+reason, `daffodilVersion` must also be defined in `daffodilPackageBinVersions`
+if `daffodilTdmlUsesPackageBin` is `true`.
+
## Layers and User Defined Functions
If your schema project builds a Daffodil layer or user defined function, then
Review Comment:
You actually have to run `sbt scripted` to run the tests, I don't know the reason why it's part of a separate task, but it is confusing. We can probably modify `sbt test` so that is also runs the scripted tests to make things easier. And considering we don't even have any non-scripted tests, this seems more user friendly. I think I'll update the test documentation and change to sbt test in a separate PR.
--
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
Re: [PR] Support using saved parsers in TDML tests [daffodil-sbt]
Posted by "tuxji (via GitHub)" <gi...@apache.org>.
tuxji commented on code in PR #19:
URL: https://github.com/apache/daffodil-sbt/pull/19#discussion_r1559339465
##########
src/sbt-test/sbt-daffodil/tdml-saved-parser-01/test.script:
##########
@@ -0,0 +1,29 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+> packageDaffodilBin
+$ exists target/test-0.1-daffodil350.bin
+$ exists target/test-0.1-daffodil360.bin
+$ exists target/test-0.1-two-daffodil350.bin
+$ exists target/test-0.1-two-daffodil360.bin
+
+> Test/dependencyClasspath
+$ must-mirror target/tdmlparsers/test.bin target/test-0.1-daffodil360.bin
+$ must-mirror target/tdmlparsers/test-two.bin target/test-0.1-two-daffodil360.bin
+
+> test
Review Comment:
I was puzzled by this file, then I noticed daffodil-sbt has other test.script files, I looked at them, and I realized these files help test the daffodil-sbt plugin using a scripted test framework built into sbtPlugin itself.
##########
README.md:
##########
@@ -94,6 +94,32 @@ If used, one may want to use the first value of this setting to configure
daffodilVersion := daffodilPackageBinVersions.value.head
```
+### Saved Parsers in TDML Tests
+
+For schemas that take a long time to compile, it is often convenient to use a
+saved parser created by the `packageDaffodilBin` task in TDML tests. If this
+is the case, set the following:
+
+```scala
+daffodilTdmlUsesPackageBin := true
+```
+
+When set to `true` , running `sbt test` automatically triggers
+`packageDaffodilBin` and puts the resulting saved parsers on the classpath so
+that TDML files can reference them. Note that when referencing saved parsers
+from a TDML file, version numbers and `daffodilXYZ` are excluded--this way TDML
+files do not need to be updated when a version is changed. For example, a TDML
+file using a saved parser created at `target/format-1.0-file-daffodil350.bin`
+is referenced like this:
+
+```xml
+<parserTestCase ... model="/format-file.bin">
+```
+
+Note that only saved parsers for `daffodilVersion` can be referenced. For this
+reason, `daffodilVersion` must also be defined in `daffodilPackageBinVersions`
+if `daffodilTdmlUsesPackageBin` is `true`.
+
## Layers and User Defined Functions
If your schema project builds a Daffodil layer or user defined function, then
Review Comment:
I wasn't aware of the scripted test framework provided by sbtPlugin before I saw this PR. I had to google to find the documentation describing it here: <https://www.scala-sbt.org/release/docs/Testing-sbt-plugins.html>. Can we add a "Tests" section to the end of this README which briefly mentions this plugin has several scripted tests, mentions what command ("sbt test", right?) runs these script tests, and points programmers to that documentation page for further details?
--
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