Project

Profile

Help

How to connect?
Download (10.1 KB) Statistics
| Branch: | Revision:

he / tools / test-suites / report.xsl @ b2ef1409

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
                xmlns:t="http://www.w3.org/2012/08/qt-fots-results"
4
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
5
                exclude-result-prefixes="xs"
6
                version="3.0">
7

    
8
  <xsl:param name="rundate" select="()"/>
9

    
10
  <xsl:variable name="input-docs-uri" as="xs:anyURI*">
11
    <xsl:for-each select="uri-collection('../../build/test-results?recurse=yes')">
12
      <!-- This stylesheet operates on the raw output, not the formatted results. -->
13
      <xsl:if test="not(contains(., '/results/'))
14
                    and not(contains(., '/xsd/'))
15
                    and not(ends-with(., '/exceptions.xml'))
16
                    and ends-with(., '.xml')">
17
        <xsl:sequence select="."/>
18
      </xsl:if>
19
    </xsl:for-each>
20
  </xsl:variable>
21

    
22
  <xsl:variable name="run-dates"
23
                select="distinct-values($input-docs-uri
24
                                        ! substring-after(., 'build/test-results/')
25
                                        ! tokenize(., '/')[3])"/>
26

    
27
  <!-- This stylesheet only expects to format the results of a single day. -->
28
  <xsl:variable name="reportdate"
29
                select="if (empty($rundate))
30
                        then sort($run-dates)[last()]
31
                        else $run-dates[. = $rundate]"/>
32

    
33
  <xsl:output indent="yes"/>
34

    
35
  <xsl:template name="xmain">
36
    <xsl:for-each select="$input-docs-uri">
37
      <xsl:message select="."/>
38
    </xsl:for-each>
39
    <xsl:sequence select="$run-dates"/>
40
    <xsl:sequence select="'R:', $reportdate"/>
41
    <doc/>
42
  </xsl:template>
43

    
44
  <xsl:template name="main">
45
    <xsl:if test="empty($reportdate)">
46
      <xsl:message terminate="yes">
47
        <xsl:text>No reports exist for </xsl:text>
48
        <xsl:sequence select="$rundate"/>
49
      </xsl:message>
50
    </xsl:if>
51

    
52
    <xsl:variable name="xmlReport" as="element()*">
53
      <xsl:call-template name="ToXml" />
54
    </xsl:variable>
55

    
56
    <xsl:result-document href="report.xml">
57
      <out>
58
        <xsl:comment>
59
          Generated - <xsl:value-of select="current-dateTime()"/>
60
        </xsl:comment>
61
        <xsl:copy-of select="$xmlReport" />
62
      </out>
63
    </xsl:result-document>
64

    
65
    <xsl:call-template name="ToHtml">
66
      <xsl:with-param name="xmlReport" select="$xmlReport" />
67
    </xsl:call-template>
68
  </xsl:template>
69

    
70
  <xsl:template name="ToXml" as="element()*">
71
      <xsl:for-each select="$input-docs-uri[contains(., '/' || $reportdate || '/')]">
72
        <xsl:variable name="input-docs" select="doc(.)"/>
73
        <xsl:variable name="test-cases"
74
                      select="$input-docs/test-suite-result/test-set/test-case"/>
75
        <xsl:variable name="failures" select="$test-cases[@result='fail']"/>
76
        <xsl:variable name="product" as="element(product)">
77
          <xsl:element name="product">
78
            <xsl:choose>
79
              <xsl:when test="exists($input-docs//product)">
80

    
81
                <xsl:choose>
82
                  <xsl:when test="contains(., 'extra')">
83
                    <xsl:attribute name="test-suite" select="'saxon-extra'" />
84
                  </xsl:when>
85
                  <xsl:when test="not(contains(., 'extra'))">
86
                    <xsl:attribute name="test-suite" select="'w3c'" />
87
                  </xsl:when>
88
                </xsl:choose>
89

    
90
                <xsl:attribute name="name" select="$input-docs//product/@name" />
91
                <xsl:attribute name="version" select="$input-docs//product/@version" />
92
                <xsl:attribute name="bytecode" select="$input-docs//product/@bytecode" />
93
                <xsl:attribute name="language" select="$input-docs//product/@language" />
94
                <xsl:attribute name="date-run" select="$input-docs//test-run/@date-run"/>
95

    
96
              </xsl:when>
97
              <xsl:when test="exists($input-docs//implementation)">
98

    
99
                <xsl:choose>
100
                  <xsl:when test="contains(., 'extra')">
101
                    <xsl:attribute name="test-suite" select="'saxon-extra'" />
102
                  </xsl:when>
103
                  <xsl:when test="not(contains(., 'extra'))">
104
                    <xsl:attribute name="test-suite" select="'w3c'" />
105
                  </xsl:when>
106
                </xsl:choose>
107

    
108
                <xsl:attribute name="name" select="$input-docs//implementation/@name" />
109
                <xsl:attribute name="version" select="$input-docs//implementation/@version" />
110
                <xsl:attribute name="bytecode" select="$input-docs//implementation/configuration/@bytecode" />
111
                <xsl:attribute name="language" select="$input-docs//implementation/configuration/@lang" />
112
                <xsl:attribute name="jit" select="$input-docs//implementation/configuration/@jit" />
113
                <xsl:attribute name="date-run" select="$input-docs//test-run/@dateRun"/>
114

    
115
              </xsl:when>
116
              <xsl:otherwise>
117
                <xsl:message>UNKNOWN Found with uri=<xsl:value-of select="."/></xsl:message>
118
                <xsl:attribute name="name" select="'UNKNOWN'" />
119
                <xsl:attribute name="bytecode" select="'NA'" />
120
                <xsl:attribute name="langauge" select="'NA'" />
121

    
122
              </xsl:otherwise>
123
            </xsl:choose>
124
          </xsl:element>
125
        </xsl:variable>
126

    
127
        <product edition="{$product/@name}" bytecode="{$product/@bytecode}"
128
                 lang="{$product/@language}" version="{$product/@version}">
129
          <xsl:if test="exists($product/@jit)">
130
            <xsl:attribute name="jit" select="$product/@jit"/>
131
          </xsl:if>
132
          <xsl:if test="contains(., 'unfolded')">
133
            <xsl:attribute name="unfolded" select="'yes'"/>
134
          </xsl:if>
135
          <test-run date="{$product/@date-run}" test-suite="{$product/@test-suite}"/>
136
          <tests successes="{count($test-cases[@result='pass'])}"
137
                 failures="{count($failures)}"
138
                 incorrect-errorcode="{count($test-cases[@result='wrongError'])}"
139
                 not-run="{count($test-cases[@result='n/a'])}"/>
140
          <xsl:if test="count($failures) gt 30">
141
            <failure-distribution>
142
              <xsl:for-each-group select="$failures" group-by="../@name">
143
                <test-set-failures name="{current-grouping-key()}"
144
                                   no="{count(current-group())}"/>
145
              </xsl:for-each-group>
146
            </failure-distribution>
147
          </xsl:if>
148
          <xsl:for-each select="$failures">
149
            <test-case-fail name="{@name}" comment="{@comment}"/>
150
          </xsl:for-each>
151
        </product>
152
      </xsl:for-each>
153
  </xsl:template>
154

    
155
  <xsl:template name="ToHtml">
156
    <xsl:param name="xmlReport" as="element()*" />
157
    <xsl:result-document href="report.html">
158
      <html>
159
        <head><title>Saxon Release reports</title>
160

    
161
        <style type="text/css">
162
          .tg  {border-collapse:collapse;border-spacing:0;}
163
          .tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
164
          overflow:hidden;padding:10px 5px;word-break:normal;}
165
          .tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
166
          font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
167
          .tg .tg-1wig{font-weight:bold;text-align:left;vertical-align:top}
168
          .tg .tg-mnhx{background-color:#fe0000;text-align:left;vertical-align:top}
169
          .tg .tg-fd62{background-color:#32cb00;text-align:left;vertical-align:top}
170
          .tg .tg-s7ni{background-color:#f8ff00;text-align:left;vertical-align:top}
171
          .tg .tg-0lax{text-align:left;vertical-align:top}
172
        </style>
173
        </head>
174
        <body>
175
          <h1>Saxon Release Reports</h1>
176
          <p>
177
            <b>Saxon Version: <xsl:value-of select="string(($xmlReport[1])/@version)"/></b>
178
          </p>
179
          <p>Date: <xsl:value-of select="$reportdate"/></p>
180

    
181
          <table class="tg">
182
            <thead>
183
              <th class="tg-1wig">Product</th>
184
              <th class="tg-fd62"><b>Pass</b></th>
185
              <th class="tg-mnhx"><b>Fail</b></th>
186
              <th class="tg-s7ni"><b>Incorrect Error code</b></th>
187
              <th class="tg-0lax"><b>Skip</b></th>
188
              <th class="tg-0lax"><b>Test Failures</b></th>
189
            </thead>
190
            <!--Count=<xsl:value-of select="count($input-docs)"/> -->
191
            <xsl:for-each select="$xmlReport">
192
              <xsl:sort select="@edition" />
193
              <xsl:sort select="@lang" />
194
              <!-- Dir=<xsl:value-of select="string(document-uri(.))"/> -->
195

    
196
              <xsl:element name="tr">
197
                <td  class="tg-1wig" width="50">
198
                  <xsl:value-of select="@edition"/>
199
                  <br/>
200
                  Bytecode=<xsl:value-of select="@bytecode"/>
201
                  <br/>
202
                  <xsl:if test="exists(@jit)">
203
                    JIT=<xsl:value-of select="@jit"/>
204
                    <br/>
205
                  </xsl:if>
206

    
207
                  Lang=<xsl:value-of select="@lang"/>
208
                  <br/>
209
                  Test-Suite= <xsl:value-of select="./test-run/@test-suite"/>
210
                  <br/>
211
                  <xsl:if test="exists(@export)">
212
                    Export= <xsl:value-of select="@export"/>
213
                    <br/>
214
                  </xsl:if>
215

    
216
                  <!--Dir=<xsl:value-of select="../@dir"/> -->
217

    
218
                </td>
219
                <td  class="tg-fd62">
220
                  <xsl:value-of select="tests/@successes"/>
221
                </td>
222
                <td class="tg-mnhx">
223
                  <xsl:value-of select="tests/@failures"/>
224
                </td>
225
                <td class="tg-s7ni">
226
                  <xsl:value-of select="tests/@incorrect-errorcode"/>
227
                </td>
228
                <td class="tg-0lax">
229
                  <xsl:value-of select="tests/@not-run"/>
230
                </td>
231
                <td class="tg-0lax">
232
                  <xsl:for-each select="test-case-fail">
233
                    <xsl:value-of select="@name"/>, &#x20;
234

    
235
                  </xsl:for-each>
236
                </td>
237

    
238

    
239

    
240
              </xsl:element>
241

    
242

    
243

    
244

    
245
            </xsl:for-each>
246
          </table>
247
        </body>
248

    
249
      </html>
250
    </xsl:result-document>
251

    
252
  </xsl:template>
253

    
254

    
255
</xsl:stylesheet>
    (1-1/1)