[CMake] [ctest] xml output transformation

Maik Beckmann beckmann.maik at googlemail.com
Wed Jun 18 04:58:35 EDT 2008


It works as follows
  1. ctest runs

  2. create an index of all generated xml files 
  {{{
  <Files>
    <file>Update.xml</file>
    <file>Configure.xml</file>
    <file>Test.xml</file>
     ...
  </Files>
  }}}

  3. run an xsl processor on this index with an xsl file sucking in all listed 
result files
  {{{
  <xsl:template match="/">
    <testsuites>
      <xsl:for-each select="/Files">
        <xsl:for-each select="document(File/text())">
          <xsl:apply-templates select="Site"/>
        </xsl:for-each>
      </xsl:for-each>
    </testsuites>
  </xsl:template>
  }}}


- The "create an index of all generated xml files" step in detail:

If ctest performs it's duties a bunch of XML files is stored in
  ${CTEST_BINARY_DIRECTORY}/Testing/${SOME_DATE}/
The value of SOME_DATE is stored in   
  ${CTEST_BINARY_DIRECTORY}/Testing/TAG
SOME_DATE can be extracted via
{{{
  file(STRINGS "${CTEST_BINARY_DIRECTORY}/Testing/TAG" _tag_content)
  list(GET _tag_content 0 SOME_DATE)
}}}
Now 
{{{
  file(GLOB 
_result_files "${CTEST_BINARY_DIRECTORY}/Testing/${SOME_DATE}/*.xml")
}}}
gives the list of the xml files created by ctest during it's last run.  
index.xml is created via file(WRITE and foreach.

For a working example see the attached tarball.

Best,
 -- Maik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ctest_xml_transform.tar.gz
Type: application/x-tgz
Size: 4393 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080618/1ca20a5a/attachment.bin>


More information about the CMake mailing list