Warning, /acts/CI/ctest2junit.xsl is written in an unsupported language. File is not indexed.
0001 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
0002 <xsl:output method="xml" indent="yes"/>
0003 <!-- convert ctest output to junit format -->
0004 <!--
0005 Inspired by https://stackoverflow.com/questions/6329215/how-to-get-ctest-results-in-hudson-jenkins
0006 Based on https://github.com/zanata/zanata-tests/blob/master/scripts/CTest2JUnit.xsl
0007 Extended by providing total Start date, total time, total test stats
0008 -->
0009 <xsl:template match="/Site">
0010 <xsl:variable name="StartDate"><xsl:value-of select="Testing/StartDateTime"/></xsl:variable>
0011 <xsl:variable name="DoTime"><xsl:value-of select="Testing/EndTestTime - Testing/StartTestTime"/></xsl:variable>
0012 <xsl:variable name="TotalTests"><xsl:value-of select="count(Testing/Test)"/></xsl:variable>
0013 <xsl:variable name="Skipped"><xsl:value-of select="count(Testing/Test[@Status='notrun'])"/></xsl:variable>
0014 <xsl:variable name="Disabled"><xsl:value-of select="count(Testing/Test/Results/Measurement[Value='Disabled'])"/></xsl:variable>
0015 <xsl:variable name="Failed"><xsl:value-of select="count(Testing/Test[@Status='failed'])"/></xsl:variable>
0016
0017 <testsuite time="{$DoTime}" timestamp="{$StartDate}" tests="{$TotalTests}" failures="{$Failed}" skipped="{$Skipped}" disabled="{$Disabled}">
0018
0019 <xsl:variable name="BuildName"><xsl:value-of select="@BuildName"/></xsl:variable>
0020 <xsl:variable name="BuildStamp"><xsl:value-of select="@BuildStamp"/></xsl:variable>
0021 <xsl:variable name="Name"><xsl:value-of select="@Name"/></xsl:variable>
0022 <xsl:variable name="Generator"><xsl:value-of select="@Generator"/></xsl:variable>
0023 <xsl:variable name="CompilerName"><xsl:value-of select="@CompilerName"/></xsl:variable>
0024 <xsl:variable name="OSName"><xsl:value-of select="@OSName"/></xsl:variable>
0025 <xsl:variable name="Hostname"><xsl:value-of select="@Hostname"/></xsl:variable>
0026 <xsl:variable name="OSRelease"><xsl:value-of select="@OSRelease"/></xsl:variable>
0027 <xsl:variable name="OSVersion"><xsl:value-of select="@OSVersion"/></xsl:variable>
0028 <xsl:variable name="OSPlatform"><xsl:value-of select="@OSPlatform"/></xsl:variable>
0029 <xsl:variable name="Is64Bits"><xsl:value-of select="@Is64Bits"/></xsl:variable>
0030 <xsl:variable name="VendorString"><xsl:value-of select="@VendorString"/></xsl:variable>
0031 <xsl:variable name="VendorID"><xsl:value-of select="@VendorID"/></xsl:variable>
0032 <xsl:variable name="FamilyID"><xsl:value-of select="@FamilyID"/></xsl:variable>
0033 <xsl:variable name="ModelID"><xsl:value-of select="@ModelID"/></xsl:variable>
0034 <xsl:variable name="ProcessorCacheSize"><xsl:value-of select="@ProcessorCacheSize"/></xsl:variable>
0035 <xsl:variable name="NumberOfLogicalCPU"><xsl:value-of select="@NumberOfLogicalCPU"/></xsl:variable>
0036 <xsl:variable name="NumberOfPhysicalCPU"><xsl:value-of select="@NumberOfPhysicalCPU"/></xsl:variable>
0037 <xsl:variable name="TotalVirtualMemory"><xsl:value-of select="@TotalVirtualMemory"/></xsl:variable>
0038 <xsl:variable name="TotalPhysicalMemory"><xsl:value-of select="@TotalPhysicalMemory"/></xsl:variable>
0039 <xsl:variable name="LogicalProcessorsPerPhysical"><xsl:value-of select="@LogicalProcessorsPerPhysical"/></xsl:variable>
0040 <xsl:variable name="ProcessorClockFrequency"><xsl:value-of select="@ProcessorClockFrequency"/></xsl:variable>
0041 <properties>
0042 <property name="BuildName" value="{$BuildName} {$DoTime}" />
0043 <property name="BuildStamp" value="{$BuildStamp}" />
0044 <property name="Name" value="{$Name}" />
0045 <property name="Generator" value="{$Generator}" />
0046 <property name="CompilerName" value="{$CompilerName}" />
0047 <property name="OSName" value="{$OSName}" />
0048 <property name="Hostname" value="{$Hostname}" />
0049 <property name="OSRelease" value="{$OSRelease}" />
0050 <property name="OSVersion" value="{$OSVersion}" />
0051 <property name="OSPlatform" value="{$OSPlatform}" />
0052 <property name="Is64Bits" value="{$Is64Bits}" />
0053 <property name="VendorString" value="{$VendorString}" />
0054 <property name="VendorID" value="{$VendorID}" />
0055 <property name="FamilyID" value="{$FamilyID}" />
0056 <property name="ModelID" value="{$ModelID}" />
0057 <property name="ProcessorCacheSize" value="{$ProcessorCacheSize}" />
0058 <property name="NumberOfLogicalCPU" value="{$NumberOfLogicalCPU}" />
0059 <property name="NumberOfPhysicalCPU" value="{$NumberOfPhysicalCPU}" />
0060 <property name="TotalVirtualMemory" value="{$TotalVirtualMemory}" />
0061 <property name="TotalPhysicalMemory" value="{$TotalPhysicalMemory}" />
0062 <property name="LogicalProcessorsPerPhysical" value="{$LogicalProcessorsPerPhysical}" />
0063 <property name="ProcessorClockFrequency" value="{$ProcessorClockFrequency}" />
0064 </properties>
0065 <xsl:apply-templates select="Testing/Test"/>
0066
0067 <system-out>
0068 BuildName: <xsl:value-of select="$BuildName" />
0069 BuildStamp: <xsl:value-of select="$BuildStamp" />
0070 Name: <xsl:value-of select="$Name" />
0071 Generator: <xsl:value-of select="$Generator" />
0072 CompilerName: <xsl:value-of select="$CompilerName" />
0073 OSName: <xsl:value-of select="$OSName" />
0074 Hostname: <xsl:value-of select="$Hostname" />
0075 OSRelease: <xsl:value-of select="$OSRelease" />
0076 OSVersion: <xsl:value-of select="$OSVersion" />
0077 OSPlatform: <xsl:value-of select="$OSPlatform" />
0078 Is64Bits: <xsl:value-of select="$Is64Bits" />
0079 VendorString: <xsl:value-of select="$VendorString" />
0080 VendorID: <xsl:value-of select="$VendorID" />
0081 FamilyID: <xsl:value-of select="$FamilyID" />
0082 ModelID: <xsl:value-of select="$ModelID" />
0083 ProcessorCacheSize: <xsl:value-of select="$ProcessorCacheSize" />
0084 NumberOfLogicalCPU: <xsl:value-of select="$NumberOfLogicalCPU" />
0085 NumberOfPhysicalCPU: <xsl:value-of select="$NumberOfPhysicalCPU" />
0086 TotalVirtualMemory: <xsl:value-of select="$TotalVirtualMemory" />
0087 TotalPhysicalMemory: <xsl:value-of select="$TotalPhysicalMemory" />
0088 LogicalProcessorsPerPhysical: <xsl:value-of select="$LogicalProcessorsPerPhysical" />
0089 ProcessorClockFrequency: <xsl:value-of select="$ProcessorClockFrequency" />
0090 </system-out>
0091 </testsuite>
0092 </xsl:template>
0093
0094 <xsl:template match="Testing/Test">
0095 <xsl:variable name="testcasename"><xsl:value-of select="Name"/></xsl:variable>
0096 <xsl:variable name="testclassname"><xsl:value-of select=" concat('this', substring(Path,2))"/></xsl:variable>
0097 <xsl:variable name="exectime">
0098 <xsl:for-each select="Results/NamedMeasurement">
0099 <xsl:if test="@name='Execution Time'">
0100 <xsl:value-of select="Value"/>
0101 </xsl:if>
0102 </xsl:for-each>
0103 </xsl:variable>
0104
0105 <testcase name="{$testcasename}" classname="{$testclassname}" time="{$exectime}">
0106 <xsl:if test="@Status = 'passed'">
0107 <system-out><xsl:value-of select="Results/Measurement/Value/text()"/></system-out>
0108 </xsl:if>
0109 <xsl:if test="@Status = 'failed'">
0110 <xsl:variable name="failtype">
0111 <xsl:for-each select="Results/NamedMeasurement">
0112 <xsl:if test="@name = 'Exit Code'">
0113 <xsl:value-of select="Value"/>
0114 </xsl:if>
0115 </xsl:for-each>
0116 </xsl:variable>
0117 <xsl:variable name="failcode">
0118 <xsl:for-each select="Results/NamedMeasurement">
0119 <xsl:if test="@name = 'Exit Value'">
0120 <xsl:value-of select="Value"/>
0121 </xsl:if>
0122 </xsl:for-each>
0123 </xsl:variable>
0124 <failure message="{$failtype} ({$failcode})"><xsl:value-of select="Results/Measurement/Value/text()" /></failure>
0125 </xsl:if>
0126 <xsl:if test="@Status = 'notrun'">
0127 <skipped><xsl:value-of select="Results/Measurement/Value/text()" /></skipped>
0128 </xsl:if>
0129 </testcase>
0130 </xsl:template>
0131
0132 </xsl:stylesheet>