[Libreoffice-commits] cppunit.git: contrib/xml-xsl

Simon Barth Simon.Pe.Barth at gmail.com
Sun Dec 24 10:16:02 UTC 2017


 contrib/xml-xsl/cppunit2junit.txt |   10 ++++++++--
 contrib/xml-xsl/cppunit2junit.xsl |    7 ++++---
 2 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit a412733438e4a589069f4db2ae17bd6e32d07864
Author: Simon Barth <Simon.Pe.Barth at gmail.com>
Date:   Sun Dec 3 23:42:00 2017 +0100

    contrib:cppunit2junit: parametrize testsuite name
    
    The cppunit2junit XSL stylesheet has a hardcoded name for the testsuite.
    
    Instead of putting a meaningless name, allow users to parametrize this
    name when doing the transformation.
    
    Change-Id: I2d0ebaf92cd0aa4d8ff3b3a2c423f4a8edd94807
    Signed-off-by: Simon Barth <Simon.Pe.Barth at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/46357
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/contrib/xml-xsl/cppunit2junit.txt b/contrib/xml-xsl/cppunit2junit.txt
index 941ecb1..99b9897 100644
--- a/contrib/xml-xsl/cppunit2junit.txt
+++ b/contrib/xml-xsl/cppunit2junit.txt
@@ -1,4 +1,4 @@
- A simple XSLT file to transform cppunit XmlOutputer
+A simple XSLT file to transform cppunit XmlOutputer
 result file, to the same format that the apache Ant
 junit task produce:
 <target name="test">
@@ -9,6 +9,10 @@ fork="true">
 
 This format allows to manage result file with the Ant
 junitreport task.
+example usage with xsltproc:
+
+$ xsltproc -o TEST-cxx-results.xml --stringparam testsuite test.cxx cppunit2junit.xsl temp-cxx-results.xml
+
 example usage inside a ant task:
 
 task similar to the junit task:
@@ -33,8 +37,10 @@ in="${dev.build}/test/data/temp-cxx-results.xml"
 
 out="${dev.build}/test/data/TEST-cxx-results.xml"
 
-style="${dev.lib}/cxx/cppunit/cppunit2junit.xsl"/>
+style="${dev.lib}/cxx/cppunit/cppunit2junit.xsl">
 
+<param name="testsuite" value="test.cxx"/>
+</xslt>
 <fail if="test.failed">
 Unit tests failed. For error messages, check
 the log files in
diff --git a/contrib/xml-xsl/cppunit2junit.xsl b/contrib/xml-xsl/cppunit2junit.xsl
index 832f444..34355be 100644
--- a/contrib/xml-xsl/cppunit2junit.xsl
+++ b/contrib/xml-xsl/cppunit2junit.xsl
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+	<xsl:param name="testsuite" select="'from cppunit'" as="xs:string"/>
 	<xsl:output method="xml" indent="yes"/>
 	<xsl:template match="/">
 		<testsuite>
@@ -12,7 +13,7 @@
 			<xsl:attribute name="tests">
 				<xsl:value-of select="TestRun/Statistics/Tests"/>
 			</xsl:attribute>
-			<xsl:attribute name="name">from cppunit</xsl:attribute>
+			<xsl:attribute name="name"><xsl:value-of select="$testsuite"/></xsl:attribute>
 			<xsl:apply-templates/>
 		</testsuite>
 	</xsl:template>
@@ -35,7 +36,7 @@
 				</xsl:attribute>
 				<xsl:value-of select="Message"/>
 				File:<xsl:value-of select="Location/File"/>
-				Line:<xsl:value-of select="Location/Line"/>			
+				Line:<xsl:value-of select="Location/Line"/>
 			</error>
 		</testcase>
 	</xsl:template>
@@ -45,4 +46,4 @@
 <metaInformation>
 <scenarios ><scenario default="yes" name="test" userelativepaths="yes" url="..\..\..\..\..\Tmp\xml\cppunit.xml" htmlbaseurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperInfo  srcSchemaPath="..\..\..\..\..\Tmp\xml\cppunit.xml" srcSchemaRoot="TestRun" srcSchemaPathIsRelative="yes" destSchemaPath="..\..\..\..\..\Tmp\xml\TEST&#x2D;test.osmoose.license.TestUtils.xml" destSchemaRoot="testsuite" destSchemaPathIsRelative="yes" />
 </metaInformation>
--->
\ No newline at end of file
+-->


More information about the Libreoffice-commits mailing list