[CMake] Fwd: Re: [ctest] xml output transformation

Maik Beckmann beckmann.maik at googlemail.com
Sat Jun 14 05:57:35 EDT 2008


I got my head around this stuff and realized that the solution is far simpler 
than I thought before.  No changes to the cmake codebase are needed.  I will 
continue this thread during the next days...


Am Donnerstag 22 Mai 2008 16:29:51 schrieb Maik Beckmann:
> Hello again,
>
> Doing it via xsl transformations will lead to a nice separation into the
> following two tasks:
>
>   1. Teach CMake/CTest about xslt processors
> A bunch of .cmake files in the Modules dir for the common xslt processors
> out there (xsltproc, xalan...) will show cmake how to use each of them.
>
>   2. Write xsl files for the ctest-{update/configure/build/test/...}.xml to
>     fooUnit.xml or BarControl.xml formats
> This task can itself naturally divided into subtasks:
>     2a. Ant-Junit xml
>     2b. Bitten xml
>     ...
> I've started creating ctest-xml pseudo specs by read the ctest code.  These
> can be used by the xsl authors to write towards their target format.  I'll
> upload them here
>  - http://www.cmake.org/Wiki/CTest:OpenTasks
> as soon as their state is good enough.
>
> Best,
>  -- Maik


Just a little progress report.  


The work flow I have in mind is as follows.  CTest performs it's duties as 
usual, which results in a bunch of XML files at at 
${CMAKE_BINARY_DIR}/Testing/${SOME_DATE}/.  
If the users requests the to junit-an-xml transformation ctest scans this dir 
and writes a simple XML file which lists these files
{{{
<Files>
  <file>Update.xml</file>
  <file>Configure.xml</file>
  <file>Test.xml</file>
   ...
</Files>
}}}
Lets call it index.xml for now.  The XSLT processor actually runs on this 
index.xml and XSL pulls in every file listed in it
{{{
<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>
}}}

This way all the code doing the real work in ctest doesn't  even know about 
any to foobar-XML transformation.  The interface between the ctest output and 
foobar-XML is defined by an single XSL file.  Pretty straight forward, isn't 
it? :)

I learned xsl to some extend and coded the attached to_junit.xsl.  Its not 
finished but might show you a spirit of what I have in mind.

I coded an example project which I will use to tinker around.  It is attached 
as well.


The next step I'll do is to take a look at ctest and how the XSLT processor 
run can be triggered by it nicely.  A  test during configuration time to make 
sure "${CMAKE_XSLT_PROCESSOR} or "${CTEST_XSLT_PROCESSOR}" is working at all 
would be nice as well.  This item might be of interest for the boost-cmake 
people, since boostbook is XSL as well.



Best Regards,
 -- Maik


-------------- next part --------------
A non-text attachment was scrubbed...
Name: to_junit.xsl
Type: text/x-xslt
Size: 2934 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080614/40896293/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ctest-test.tar.gz
Type: application/x-tgz
Size: 2284 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080614/40896293/attachment-0001.bin>


More information about the CMake mailing list