cart-elc

Source code for CART-ELC
git clone git://git.laack.co/cart-elc.git
Log | Files | Refs | README | LICENSE

CTest2JUnit.xsl (6736B)


      1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      2 <xsl:output method="xml" indent="yes"/>
      3     <xsl:template match="/Site">
      4 	<xsl:variable name="Name"><xsl:value-of select="@Name"/></xsl:variable>
      5 	<xsl:variable name="Hostname"><xsl:value-of select="@Hostname"/></xsl:variable>
      6 	<xsl:variable name="TestCount"><xsl:value-of select="count(//TestList/Test)"/> </xsl:variable>
      7 	<xsl:variable name="ErrorCount"><xsl:value-of select="count(//TestList/Test[@Status='error'])"/> </xsl:variable>
      8 	<xsl:variable name="FailureCount"><xsl:value-of select="count(//Testing/Test[@Status='failed'])"/> </xsl:variable>
      9 	<testsuite name="{$Name}" hostname="{$Hostname}" errors="0" failures="{$FailureCount}" tests="{$TestCount}">
     10 	    <xsl:variable name="BuildName"><xsl:value-of select="@BuildName"/></xsl:variable>
     11 	    <xsl:variable name="BuildStamp"><xsl:value-of select="@BuildStamp"/></xsl:variable>
     12 	    <xsl:variable name="Generator"><xsl:value-of select="@Generator"/></xsl:variable>
     13 	    <xsl:variable name="CompilerName"><xsl:value-of select="@CompilerName"/></xsl:variable>
     14 	    <xsl:variable name="OSName"><xsl:value-of select="@OSName"/></xsl:variable>
     15 	    <xsl:variable name="OSRelease"><xsl:value-of select="@OSRelease"/></xsl:variable>
     16 	    <xsl:variable name="OSVersion"><xsl:value-of select="@OSVersion"/></xsl:variable>
     17 	    <xsl:variable name="OSPlatform"><xsl:value-of select="@OSPlatform"/></xsl:variable>
     18 	    <xsl:variable name="Is64Bits"><xsl:value-of select="@Is64Bits"/></xsl:variable>
     19 	    <xsl:variable name="VendorString"><xsl:value-of select="@VendorString"/></xsl:variable>
     20 	    <xsl:variable name="VendorID"><xsl:value-of select="@VendorID"/></xsl:variable>
     21 	    <xsl:variable name="FamilyID"><xsl:value-of select="@FamilyID"/></xsl:variable>
     22 	    <xsl:variable name="ModelID"><xsl:value-of select="@ModelID"/></xsl:variable>
     23 	    <xsl:variable name="ProcessorCacheSize"><xsl:value-of select="@ProcessorCacheSize"/></xsl:variable>
     24 	    <xsl:variable name="NumberOfLogicalCPU"><xsl:value-of select="@NumberOfLogicalCPU"/></xsl:variable>
     25 	    <xsl:variable name="NumberOfPhysicalCPU"><xsl:value-of select="@NumberOfPhysicalCPU"/></xsl:variable>
     26 	    <xsl:variable name="TotalVirtualMemory"><xsl:value-of select="@TotalVirtualMemory"/></xsl:variable>
     27 	    <xsl:variable name="TotalPhysicalMemory"><xsl:value-of select="@TotalPhysicalMemory"/></xsl:variable>
     28 	    <xsl:variable name="LogicalProcessorsPerPhysical"><xsl:value-of select="@LogicalProcessorsPerPhysical"/></xsl:variable>
     29 	    <xsl:variable name="ProcessorClockFrequency"><xsl:value-of select="@ProcessorClockFrequency"/></xsl:variable>
     30 	    <properties>
     31 		<property name="BuildName" value="{$BuildName}" />
     32 		<property name="BuildStamp" value="{$BuildStamp}" />
     33 		<property name="Name" value="{$Name}" />
     34 		<property name="Generator" value="{$Generator}" />
     35 		<property name="CompilerName" value="{$CompilerName}" />
     36 		<property name="OSName" value="{$OSName}" />
     37 		<property name="Hostname" value="{$Hostname}" />
     38 		<property name="OSRelease" value="{$OSRelease}" />
     39 		<property name="OSVersion" value="{$OSVersion}" />
     40 		<property name="OSPlatform" value="{$OSPlatform}" />
     41 		<property name="Is64Bits" value="{$Is64Bits}" />
     42 		<property name="VendorString" value="{$VendorString}" />
     43 		<property name="VendorID" value="{$VendorID}" />
     44 		<property name="FamilyID" value="{$FamilyID}" />
     45 		<property name="ModelID" value="{$ModelID}" />
     46 		<property name="ProcessorCacheSize" value="{$ProcessorCacheSize}" />
     47 		<property name="NumberOfLogicalCPU" value="{$NumberOfLogicalCPU}" />
     48 		<property name="NumberOfPhysicalCPU" value="{$NumberOfPhysicalCPU}" />
     49 		<property name="TotalVirtualMemory" value="{$TotalVirtualMemory}" />
     50 		<property name="TotalPhysicalMemory" value="{$TotalPhysicalMemory}" />
     51 		<property name="LogicalProcessorsPerPhysical" value="{$LogicalProcessorsPerPhysical}" />
     52 		<property name="ProcessorClockFrequency" value="{$ProcessorClockFrequency}" />
     53 	    </properties>
     54 	    <xsl:apply-templates select="Testing/Test"/>
     55 
     56 	    <system-out>
     57 		BuildName: <xsl:value-of select="$BuildName" />
     58 		BuildStamp: <xsl:value-of select="$BuildStamp" />
     59 		Name: <xsl:value-of select="$Name" />
     60 		Generator: <xsl:value-of select="$Generator" />
     61 		CompilerName: <xsl:value-of select="$CompilerName" />
     62 		OSName: <xsl:value-of select="$OSName" />
     63 		Hostname: <xsl:value-of select="$Hostname" />
     64 		OSRelease: <xsl:value-of select="$OSRelease" />
     65 		OSVersion: <xsl:value-of select="$OSVersion" />
     66 		OSPlatform: <xsl:value-of select="$OSPlatform" />
     67 		Is64Bits: <xsl:value-of select="$Is64Bits" />
     68 		VendorString: <xsl:value-of select="$VendorString" />
     69 		VendorID: <xsl:value-of select="$VendorID" />
     70 		FamilyID: <xsl:value-of select="$FamilyID" />
     71 		ModelID: <xsl:value-of select="$ModelID" />
     72 		ProcessorCacheSize: <xsl:value-of select="$ProcessorCacheSize" />
     73 		NumberOfLogicalCPU: <xsl:value-of select="$NumberOfLogicalCPU" />
     74 		NumberOfPhysicalCPU: <xsl:value-of select="$NumberOfPhysicalCPU" />
     75 		TotalVirtualMemory: <xsl:value-of select="$TotalVirtualMemory" />
     76 		TotalPhysicalMemory: <xsl:value-of select="$TotalPhysicalMemory" />
     77 		LogicalProcessorsPerPhysical: <xsl:value-of select="$LogicalProcessorsPerPhysical" />
     78 		ProcessorClockFrequency: <xsl:value-of select="$ProcessorClockFrequency" />
     79 	    </system-out>
     80 	</testsuite>
     81     </xsl:template>
     82 
     83     <xsl:template match="Testing/Test">
     84 	<xsl:variable name="testcasename"><xsl:value-of select= "Name"/></xsl:variable>
     85 	<xsl:variable name="testclassname"><xsl:value-of select= " concat('this', substring(Path,2))"/></xsl:variable>
     86 	<xsl:variable name="exectime">
     87 	    <xsl:for-each select="Results/NamedMeasurement">
     88 		<xsl:if test="@name = 'Execution Time'">
     89 		    <xsl:value-of select="."/>
     90 		</xsl:if>
     91 	    </xsl:for-each>
     92 	</xsl:variable>
     93 
     94 	<testcase name="{$testcasename}" classname="{$testclassname}" time="{$exectime}">
     95 	    <xsl:if test="@Status = 'passed'">
     96 	    </xsl:if>
     97 	    <xsl:if test="@Status = 'failed'">
     98 		<xsl:variable name="failtype">
     99 		    <xsl:for-each select="Results/NamedMeasurement">
    100 			<xsl:if test="@name = 'Exit Code'">
    101 			    <xsl:value-of select="."/>
    102 			</xsl:if>
    103 		    </xsl:for-each>
    104 		</xsl:variable>
    105 		<xsl:variable name="failcode">
    106 		    <xsl:for-each select="Results/NamedMeasurement">
    107 			<xsl:if test="@name = 'Exit Value'">
    108 			    <xsl:value-of select="."/>
    109 			</xsl:if>
    110 		    </xsl:for-each>
    111 		</xsl:variable>
    112 		<failure message="{$failtype} ({$failcode})"><xsl:value-of select="Results/Measurement/Value/text()" /></failure>
    113 	    </xsl:if>
    114 	    <xsl:if test="@Status = 'notrun'">
    115 		<skipped><xsl:value-of select="Results/Measurement/Value/text()" /></skipped>
    116 	    </xsl:if>
    117 	</testcase>
    118     </xsl:template>
    119 
    120 </xsl:stylesheet>