Skip to content

Commit

Permalink
Fix JENKINS-12832
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed Feb 22, 2012
1 parent dbd49b6 commit 75e70d7
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 28 deletions.
@@ -1,15 +1,32 @@
<!-- from src/main/resources/org/jenkinsci/plugins/xunit/types/check-to-junit-4.xsl -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ck="http://check.sourceforge.net/ns"
exclude-result-prefixes="ck">
<xsl:output method="xml" indent="yes"/>

<xsl:variable name="checkCount" select="count(//ck:suite/ck:test)"/>
<xsl:variable name="checkCountFailure"
select="count(//ck:suite/ck:test[@result='failure'])"/>
<xsl:variable name="suitename" select="//ck:suite/ck:title"/>

<xsl:template match="/">
<testsuites>
<xsl:apply-templates/>
</testsuites>
</xsl:template>

<xsl:template match="//ck:suite">
<!-- we should theoretically have a package attribute, but there's
nothing sensible to set it to (filename?) and Jenkins handles
that being missing anyway
-->
<xsl:variable name="count">
<xsl:number/>
</xsl:variable>
<xsl:variable name="checkCount"
select="count(ck:test)"/>
<xsl:variable name="checkCountFailure"
select="count(ck:test[@result='failure'])"/>
<xsl:variable name="checkCountError"
select="count(ck:test[@result='error'])"/>
<xsl:variable name="suitename"
select="ck:title"/>
<testsuite>
<xsl:attribute name="errors">0</xsl:attribute>
<xsl:attribute name="tests">
Expand All @@ -18,14 +35,23 @@
<xsl:attribute name="failures">
<xsl:value-of select="$checkCountFailure"/>
</xsl:attribute>
<xsl:attribute name="errors">
<xsl:value-of select="$checkCountError"/>
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="$suitename"/>
</xsl:attribute>
<xsl:apply-templates/>
<xsl:attribute name="id">
<xsl:value-of select="$count"/>
</xsl:attribute>
<xsl:apply-templates>
<xsl:with-param name="suitename" select="$suitename"/>
</xsl:apply-templates>
</testsuite>
</xsl:template>

<xsl:template match="//ck:suite/ck:test">
<xsl:template match="ck:test">
<xsl:param name="suitename"/>
<testcase>
<xsl:attribute name="name">
<xsl:value-of select="./ck:id"/>
Expand All @@ -34,13 +60,20 @@
<xsl:value-of select="$suitename"/>
</xsl:attribute>
<xsl:attribute name="time">0</xsl:attribute>
<xsl:if test="@result = 'failure'">
<xsl:if test="@result = 'error'">
<error type="error">
<xsl:attribute name="message">
<xsl:value-of select="./ck:message"/>
</xsl:attribute>
</error>
</xsl:if>
<xsl:if test="@result = 'failure'">
<failure type="failure">
<xsl:attribute name="message">
<xsl:value-of select="./ck:message"/>
</xsl:attribute>
</failure>
</xsl:if>
</testcase>
</xsl:template>

Expand Down
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" tests="5" failures="0" name="test_check1.c">
<testcase name="test_list_3" classname="test_check1.c" time="0"/>
<testcase name="test_single_entry" classname="test_check1.c" time="0"/>
<testcase name="test_allow_spaces" classname="test_check1.c" time="0"/>
<testcase name="test_only_first_entries" classname="test_check1.c" time="0"/>
<testcase name="test_empty" classname="test_check1.c" time="0"/>
</testsuite>
<testsuites>
<testsuite errors="0" tests="5" failures="0" name="test_check1.c" id="1">
<testcase name="test_list_3" classname="test_check1.c" time="0"/>
<testcase name="test_single_entry" classname="test_check1.c" time="0"/>
<testcase name="test_allow_spaces" classname="test_check1.c" time="0"/>
<testcase name="test_only_first_entries" classname="test_check1.c" time="0"/>
<testcase name="test_empty" classname="test_check1.c" time="0"/>
</testsuite>
</testsuites>
@@ -1,14 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" tests="5" failures="3" name="test_check1.c">
<testcase name="test_list_3" classname="test_check1.c" time="0">
<error type="error" message="Should have found 3 hosts"/>
</testcase>
<testcase name="test_single_entry" classname="test_check1.c" time="0"/>
<testcase name="test_allow_spaces" classname="test_check1.c" time="0">
<error type="error" message="Should have found 3 hosts"/>
</testcase>
<testcase name="test_only_first_entries" classname="test_check1.c" time="0">
<error type="error" message="Assertion 'strcmp(&#34;bbb&#34;, mylist[1]) == 0' failed"/>
</testcase>
<testcase name="test_empty" classname="test_check1.c" time="0"/>
</testsuite>
<testsuites>
<testsuite errors="0" tests="5" failures="3" name="test_check1.c" id="1">
<testcase name="test_list_3" classname="test_check1.c" time="0">
<failure type="failure" message="Should have found 3 hosts"/>
</testcase>
<testcase name="test_single_entry" classname="test_check1.c" time="0"/>
<testcase name="test_allow_spaces" classname="test_check1.c" time="0">
<failure type="failure" message="Should have found 3 hosts"/>
</testcase>
<testcase name="test_only_first_entries" classname="test_check1.c" time="0">
<failure type="failure" message="Assertion 'strcmp(&#34;bbb&#34;, mylist[1]) == 0' failed"/>
</testcase>
<testcase name="test_empty" classname="test_check1.c" time="0"/>
</testsuite>
</testsuites>

0 comments on commit 75e70d7

Please sign in to comment.