OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

xslt-conformance message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: [xslt-conformance] Re: Test Suite Issues/creating test runner






Here is a sketch of how we thought a test lab would take the XML-based
catalog of test cases and produce a script appropriate to their
operating system. In this example, it's a batch file for an MS-DOS
command window. Parts of command lines would be altered to suit the
processor under test. As an alternative, the "check" portion shows how
a lab could choose to produce separate batch files to hide some details
so that this batch file could be more uniform across processors.
.................David Marston

<xsl:output method="text" />

<xsl:template match="/">
  <xsl:text>@ECHO OFF
</xsl:text>
  <!-- Resulting batch file takes an argument to specify where
       output goes. -->
  <xsl:text>set OUTDIR=\results\xalan\%1
</xsl:text>
  <!-- Whatever else goes at the top of the batch file -->
  <xsl:apply-templates select="test-suite/test-catalog/test-case"/>
  <xsl:text>ECHO Done!
</xsl:text>
  <!-- Whatever else goes at the bottom of the batch file -->
</xsl:template>

<xsl:template match="test-case">
  <!-- The path to the directory is used more than once below,
       so assemble it now. Need to change / to \. -->
  <xsl:variable name="dir"
    select="concat(../@submitter,'\',translate(file-path,'/','\'))"/>
  <!-- Also construct the string that will be the path to the output file,
   as written into the batch file. We want %OUTDIR% in the batch file. -->
  <xsl:variable name="out"

select="concat('%OUTDIR%\',$dir,'\',scenario/output-file[@role='principal'])"/>
  <!-- Now start putting out command lines for each test. -->
  <xsl:value-of select="concat('cd \tests\',$dir)"/><xsl:text>
</xsl:text>
  <!-- Could check file existence here. -->
  <xsl:choose>
    <xsl:when test="scenario/@operation='standard'">
      <!-- For xalan-C, command line is xalan (inputXML) (stylesheet)
>(output) -->
      <xsl:text>xalan </xsl:text>
      <xsl:value-of
select="translate(scenario/input-file[@role='principal-data'],
          '/','\')"/><!-- just in case it had a relative path -->
      <xsl:text> </xsl:text>
      <xsl:value-of
select="scenario/input-file[@role='principal-stylesheet']"/>
      <xsl:text> &gt;</xsl:text><!-- redirect standard output (for Win98)
-->
      <xsl:value-of select="$out"/>
      <xsl:text>
</xsl:text>
    </xsl:when>
    <xsl:when test="scenario/@operation='embedded'">
      <!-- For xalan-C, command line is xalan (inputXML) >(output) -->
      <xsl:text>xalan </xsl:text>
      <xsl:value-of select="scenario/input-file[@role='principal-data']"/>
      <!-- can't be a relative path under this scenario -->
      <xsl:text> &gt;</xsl:text><!-- redirect standard output (for Win98)
-->
      <xsl:value-of select="$out"/>
      <xsl:text>
</xsl:text>
    </xsl:when>
    <xsl:otherwise><!-- Other scenarios -->
      <xsl:text>REM test case </xsl:text>
      <xsl:value-of select="@id"/>
      <xsl:text> has a scenario we haven't coded yet.
</xsl:text>
    </xsl:otherwise>
  </xsl:choose>
  <!-- Assume that we have a batch file "check" that normalizes output and
     compares it to the reference output. Arguments: filetype subjectfile
reference -->
  <xsl:for-each select="scenario/output-file">
    <!-- Iterate over both principal and supplemental outputs -->
    <xsl:text>call check </xsl:text>
    <xsl:value-of select="./@compare"/>
    <xsl:text> </xsl:text>
    <xsl:value-of select="concat('%OUTDIR%\',$dir,'\',.)"/>
    <xsl:text> </xsl:text>
    <xsl:value-of select="concat('\gold\',$dir,'\',.)"/>
    <xsl:text>
</xsl:text>
  </xsl:for-each>
</xsl:template>



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC