[ 
https://issues.apache.org/jira/browse/DAFFODIL-1300?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Beckerle updated DAFFODIL-1300:
---------------------------------------
    Issue Type: Improvement  (was: Task)

> Fix Test Scala files to not create the test suite repeatedly
> ------------------------------------------------------------
>
>                 Key: DAFFODIL-1300
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-1300
>             Project: Daffodil
>          Issue Type: Improvement
>          Components: QA
>            Reporter: Michael Beckerle
>            Priority: Major
>
> Running tests seemed to be awfully slow.
> So I learned today that for every single test case line in our test scala 
> files (e.g, TestFacets.scala), it reloads the entire test suite TDML from 
> scratch. This makes the tests much slower of course, particularly so for the 
> large TDML files (Functions.tdml for example).
> The fix to this is to look at how TestFacets.scala is now (just pushed to 
> 1.1.0 branch). 
> This is the recipe for loading up the test suite exactly once, but also 
> releasing it at the end of the job so that these things don't build up 
> endlessly in memory. Basically, all those variables that hold the test runner 
> objects, all those go in the associated peer object, not in the test class. 
> E.g., from TestFacets.scala:
> object TestFacets {
>   val testDir = "/edu/illinois/ncsa/daffodil/section05/facets/"
>   val aa = testDir + "Facets.tdml"
>   var runner = new DFDLTestSuite(Misc.getRequiredResource(aa), 
>                                                         validateTDMLFile = 
> false, validateDFDLSchemas = false)
>   /**
>    * Avoid memory leak of adding more and more test suites to static objects 
> as we run more and more test suites.
>    */
>   @AfterClass def tearDown() { runner = null }
> }
> class TestFacets {
>   import TestFacets._  // Imports all of the definitions in the object so we 
> don't have to edit the test lines.
>   @Test def test_minMaxInExdateTime01() { 
> runner.runOneTest("minMaxInExdateTime01") }
>   ...
> }
> Tests run much faster once this is done.
> For now I have retained noisy messages which illustrate how often we are 
> reloading the TDML files to construct the test suite objects. 
> There are also warnings to stderr for duplicate test cases in the same tdml 
> file -(see JIRA Ticket DFDL-1298 and DFDL-1299. )
> We should make a pass and fix all the TDML running scala test files to use 
> this technique.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to