kszbcss / xspec

Private backup of the xspec project at google code, as google code is going to disappear.
MIT License
1 stars 0 forks source link

Using ANT to run multiple XSpec tests from same target runs out of memory #63

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If you run an ANT script which has a target that invokes multiple XSpec tests, 
the system can rapidly run out of memory. 

This appears to be an underly bug in the ANT xslt task used by XSpec. This 
seems to hold on to memory at least until the entire target has completed. 
Therefore if you are running many tests from one target memory can quickly 
become exhausted.

A basic workaround would be to define an alternative to the "xslt" ANT task by 
adding to the XSpec "build.xml" a new macrodef such as:

<macrodef name="AlternateXslt">
    <attribute name="in"/>
    <attribute name="out"/>
    <attribute name="style"/>
    <attribute name="classpath"/>
    <sequential>
      <java classpath="@{classpath}" classname="net.sf.saxon.Transform" fork="true">
        <arg value="-s:@{in}"/>
        <arg value="-xsl:@{style}"/>
        <arg value="-o:@{out}"/>
      </java>
    </sequential>
  </macrodef>

Then replace the occurrences of the <xslt> task with <AlternativeXslt> e.g.

 <AlternateXslt in="${xspec.xml}" 
             out="${xspec.xsl}"
             style="${xspec.project.dir}/src/compiler/generate-xspec-tests.xsl"
             classpath="${saxon.jar}"/>

and 

 <AlternateXslt in="${xspec.result.xml}" 
             out="${xspec.result.html}"
             style="${xspec.project.dir}/src/reporter/format-xspec-report.xsl"
             classpath="${saxon.jar}"/>

This solution relies on saxon being available as the XSLT processor.

Original issue reported on code.google.com by neil.cro...@gmail.com on 7 Oct 2013 at 3:50