]> begriffs open source - cmsis/blob - CMSIS/CoreValidation/Project/validation.xsl
Migrate CMSIS-CoreValidation to CMSIS-Toolbox build system
[cmsis] / CMSIS / CoreValidation / Project / validation.xsl
1 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2     <xsl:output method="xml" indent="yes"/>
3     <xsl:template match="/">
4         <testsuites>
5             <xsl:variable name="buildName" select="//report/test/title"/>
6             <xsl:variable name="numberOfTests" select="//report/test/summary/tcnt"/>
7             <xsl:variable name="numberOfExecutes" select="//report/test/summary/exec"/>
8             <xsl:variable name="numberOfPasses" select="//report/test/summary/pass"/>
9             <xsl:variable name="numberOfFailures" select="//report/test/summary/fail"/>
10                         <xsl:variable name="numberOfSkips" select="$numberOfTests - $numberOfExecutes"/>
11                         <xsl:variable name="numberOfErrors" select="0"/>
12             <testsuite name="{$buildName}"
13                        tests="{$numberOfTests}" time="0"
14                        failures="{$numberOfFailures}" errors="{$numberOfErrors}"
15                        skipped="{$numberOfSkips}">
16                 <xsl:for-each select="//report/test/test_cases/tc">
17                     <xsl:variable name="testName" select="func"/>
18                     <xsl:variable name="status" select="res"/>
19                     <testcase name="{$testName}">
20                         <xsl:choose>
21                             <xsl:when test="res='PASSED'"/>
22                                                         <xsl:when test="res='NOT EXECUTED'">
23                                                                 <skipped/>
24                                                         </xsl:when>
25                             <xsl:otherwise>
26                                 <failure>
27                                     <xsl:for-each select="dbgi/detail">
28                                         <xsl:variable name="file" select="module"/>
29                                         <xsl:variable name="line" select="line"/>
30                                         <xsl:text>&#10;        </xsl:text>
31                                         <xsl:value-of select="$file"/>:<xsl:value-of select="$line"/>
32                                     </xsl:for-each>
33                                     <xsl:text>&#10;      </xsl:text>
34                                  </failure>
35                             </xsl:otherwise>
36                         </xsl:choose>
37                     </testcase>
38                 </xsl:for-each>
39             </testsuite>
40         </testsuites>
41     </xsl:template>
42 </xsl:stylesheet>