]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/atf/atf-report/tests-results.xsl
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / contrib / atf / atf-report / tests-results.xsl
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE xsl:stylesheet [<!ENTITY nbsp "&#160;">]>
3
4 <!--
5   ++ Automated Testing Framework (atf)
6   ++
7   ++ Copyright (c) 2007 The NetBSD Foundation, Inc.
8   ++ All rights reserved.
9   ++
10   ++ Redistribution and use in source and binary forms, with or without
11   ++ modification, are permitted provided that the following conditions
12   ++ are met:
13   ++ 1. Redistributions of source code must retain the above copyright
14   ++    notice, this list of conditions and the following disclaimer.
15   ++ 2. Redistributions in binary form must reproduce the above copyright
16   ++    notice, this list of conditions and the following disclaimer in the
17   ++    documentation and/or other materials provided with the distribution.
18   ++
19   ++ THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
20   ++ CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21   ++ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22   ++ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23   ++ IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
24   ++ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25   ++ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26   ++ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   ++ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
28   ++ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29   ++ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
30   ++ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31   -->
32
33 <xsl:stylesheet version="1.0"
34                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
35
36   <!-- Parameters that can be overriden by the user. -->
37   <xsl:param name="global.css">tests-results.css</xsl:param>
38   <xsl:param name="global.title">ATF Tests Results</xsl:param>
39
40   <xsl:variable name="ntps"
41                 select="count(tests-results/tp)" />
42   <xsl:variable name="ntps-failed"
43                 select="count(tests-results/tp/failed)" />
44   <xsl:variable name="ntcs"
45                 select="count(tests-results/tp/tc)" />
46   <xsl:variable name="ntcs-passed"
47                 select="count(tests-results/tp/tc/passed)" />
48   <xsl:variable name="ntcs-failed"
49                 select="count(tests-results/tp/tc/failed)" />
50   <xsl:variable name="ntcs-skipped"
51                 select="count(tests-results/tp/tc/skipped)" />
52   <xsl:variable name="ntcs-xfail"
53                 select="count(tests-results/tp/tc/expected_death) +
54                         count(tests-results/tp/tc/expected_exit) +
55                         count(tests-results/tp/tc/expected_failure) +
56                         count(tests-results/tp/tc/expected_signal) +
57                         count(tests-results/tp/tc/expected_timeout)" />
58
59   <xsl:template match="/">
60     <xsl:copy>
61       <xsl:apply-templates select="@*|node()" />
62     </xsl:copy>
63   </xsl:template>
64
65   <xsl:template match="tests-results">
66     <html xmlns="http://www.w3.org/1999/xhtml">
67       <head>
68         <meta http-equiv="Content-Type"
69               content="text/html; charset=iso-8859-1" />
70         <link rel="stylesheet" type="text/css" href="{$global.css}" />
71
72         <title><xsl:value-of select="$global.title" /></title>
73       </head>
74
75       <body>
76         <h1><xsl:value-of select="$global.title" /></h1>
77
78         <xsl:call-template name="info-top" />
79         <xsl:call-template name="tcs-summary" />
80         <xsl:if test="$ntcs-failed > 0">
81           <xsl:call-template name="failed-tcs-summary" />
82         </xsl:if>
83         <xsl:if test="$ntcs-xfail > 0">
84           <xsl:call-template name="xfail-tcs-summary" />
85         </xsl:if>
86         <xsl:if test="$ntcs-skipped > 0">
87           <xsl:call-template name="skipped-tcs-summary" />
88         </xsl:if>
89         <xsl:if test="$ntps-failed > 0">
90           <xsl:call-template name="failed-tps-summary" />
91         </xsl:if>
92         <xsl:call-template name="info-bottom" />
93
94         <xsl:apply-templates select="tp" mode="details" />
95       </body>
96     </html>
97   </xsl:template>
98
99   <xsl:template name="info-top">
100     <h2>Execution summary</h2>
101
102     <table class="summary">
103       <tr>
104         <th class="nobr"><p>Item</p></th>
105         <th class="nobr"><p>Value</p></th>
106       </tr>
107
108       <tr class="group">
109         <td colspan="2"><p>ATF</p></td>
110       </tr>
111       <tr class="entry">
112         <td><p>Version</p></td>
113         <td><p><xsl:apply-templates
114         select="info[@class = 'atf.version']" /></p></td>
115       </tr>
116
117       <tr class="group">
118         <td colspan="2"><p>Timings</p></td>
119       </tr>
120       <tr class="entry">
121         <td><p>Start time of tests</p></td>
122         <td><p><xsl:apply-templates
123         select="info[@class = 'time.start']" /></p></td>
124       </tr>
125       <tr class="entry">
126         <td><p>End time of tests</p></td>
127         <td><p><xsl:apply-templates
128         select="info[@class = 'time.end']" /></p></td>
129       </tr>
130
131       <tr class="group">
132         <td colspan="2"><p>System information</p></td>
133       </tr>
134       <tr class="entry">
135         <td><p>Host name</p></td>
136         <td><p><xsl:apply-templates
137         select="info[@class = 'uname.nodename']" /></p></td>
138       </tr>
139       <tr class="entry">
140         <td><p>Operating system</p></td>
141         <td><p><xsl:apply-templates
142         select="info[@class = 'uname.sysname']" /></p></td>
143       </tr>
144       <tr class="entry">
145         <td><p>Operating system release</p></td>
146         <td><p><xsl:apply-templates
147         select="info[@class = 'uname.release']" /></p></td>
148       </tr>
149       <tr class="entry">
150         <td><p>Operating system version</p></td>
151         <td><p><xsl:apply-templates
152         select="info[@class = 'uname.version']" /></p></td>
153       </tr>
154       <tr class="entry">
155         <td><p>Platform</p></td>
156         <td><p><xsl:apply-templates
157         select="info[@class = 'uname.machine']" /></p></td>
158       </tr>
159
160       <tr class="group">
161         <td colspan="2"><p>Tests results</p></td>
162       </tr>
163       <tr class="entry">
164         <td><p>Root</p></td>
165         <td><p><xsl:value-of
166         select="info[@class = 'tests.root']" /></p></td>
167       </tr>
168       <tr class="entry">
169         <td><p>Test programs</p></td>
170         <td class="numeric"><p><xsl:value-of select="$ntps" /></p></td>
171       </tr>
172       <tr class="entry">
173         <xsl:choose>
174           <xsl:when test="$ntps-failed > 0">
175             <td><p><a href="#failed-tps-summary">Bogus test
176             programs</a></p></td>
177             <td class="numeric-error">
178               <p><xsl:value-of select="$ntps-failed" /></p>
179             </td>
180           </xsl:when>
181           <xsl:otherwise>
182             <td><p>Bogus test programs</p></td>
183             <td class="numeric">
184               <p><xsl:value-of select="$ntps-failed" /></p>
185             </td>
186           </xsl:otherwise>
187         </xsl:choose>
188       </tr>
189       <tr class="entry">
190         <td><p>Test cases</p></td>
191         <td class="numeric"><p><xsl:value-of select="$ntcs" /></p></td>
192       </tr>
193       <tr class="entry">
194         <td><p>Passed test cases</p></td>
195         <td class="numeric"><p><xsl:value-of select="$ntcs-passed" /></p></td>
196       </tr>
197       <tr class="entry">
198         <xsl:choose>
199           <xsl:when test="$ntcs-failed > 0">
200             <td><p><a href="#failed-tcs-summary">Failed test
201             cases</a></p></td>
202             <td class="numeric-error">
203               <p><xsl:value-of select="$ntcs-failed" /></p>
204             </td>
205           </xsl:when>
206           <xsl:otherwise>
207             <td><p>Failed test cases</p></td>
208             <td class="numeric">
209               <p><xsl:value-of select="$ntcs-failed" /></p>
210             </td>
211           </xsl:otherwise>
212         </xsl:choose>
213       </tr>
214       <tr class="entry">
215         <xsl:choose>
216           <xsl:when test="$ntcs-xfail > 0">
217             <td><p><a href="#xfail-tcs-summary">Expected
218             failures</a></p></td>
219             <td class="numeric-warning">
220               <p><xsl:value-of select="$ntcs-xfail" /></p>
221             </td>
222           </xsl:when>
223           <xsl:otherwise>
224             <td><p>Expected failures</p></td>
225             <td class="numeric">
226               <p><xsl:value-of select="$ntcs-xfail" /></p>
227             </td>
228           </xsl:otherwise>
229         </xsl:choose>
230       </tr>
231       <tr class="entry">
232         <xsl:choose>
233           <xsl:when test="$ntcs-skipped > 0">
234             <td><p><a href="#skipped-tcs-summary">Skipped test
235             cases</a></p></td>
236             <td class="numeric-warning">
237               <p><xsl:value-of select="$ntcs-skipped" /></p>
238             </td>
239           </xsl:when>
240           <xsl:otherwise>
241             <td><p>Skipped test cases</p></td>
242             <td class="numeric">
243               <p><xsl:value-of select="$ntcs-skipped" /></p>
244             </td>
245           </xsl:otherwise>
246         </xsl:choose>
247       </tr>
248
249       <tr class="group">
250         <td colspan="2"><p><a href="#execution-details">See more execution
251         details</a></p></td>
252       </tr>
253     </table>
254   </xsl:template>
255
256   <xsl:template name="info-bottom">
257     <a name="execution-details" />
258     <h2 id="execution-details">Execution details</h2>
259
260     <h3>Environment variables</h3>
261
262     <ul>
263       <xsl:apply-templates select="info[@class = 'env']">
264         <xsl:sort />
265       </xsl:apply-templates>
266     </ul>
267   </xsl:template>
268
269   <xsl:template match="info[@class = 'env']">
270     <li>
271       <p><xsl:apply-templates /></p>
272     </li>
273   </xsl:template>
274
275   <xsl:template name="tcs-summary">
276     <h2>Test cases summary</h2>
277
278     <table class="tcs-summary">
279       <tr>
280         <th class="nobr"><p>Test case</p></th>
281         <th class="nobr"><p>Result</p></th>
282         <th class="nobr"><p>Reason</p></th>
283         <th class="nobr"><p>Duration</p></th>
284       </tr>
285       <xsl:apply-templates select="tp" mode="summary">
286         <xsl:with-param name="which">all</xsl:with-param>
287       </xsl:apply-templates>
288     </table>
289   </xsl:template>
290
291   <xsl:template name="xfail-tcs-summary">
292     <a name="xfail-tcs-summary" />
293     <h2 id="xfail-tcs-summary">Expected failures summary</h2>
294
295     <table class="tcs-summary">
296       <tr>
297         <th class="nobr"><p>Test case</p></th>
298         <th class="nobr"><p>Result</p></th>
299         <th class="nobr"><p>Reason</p></th>
300         <th class="nobr"><p>Duration</p></th>
301       </tr>
302       <xsl:apply-templates select="tp" mode="summary">
303         <xsl:with-param name="which">xfail</xsl:with-param>
304       </xsl:apply-templates>
305     </table>
306   </xsl:template>
307
308   <xsl:template name="failed-tcs-summary">
309     <a name="failed-tcs-summary" />
310     <h2 id="failed-tcs-summary">Failed test cases summary</h2>
311
312     <table class="tcs-summary">
313       <tr>
314         <th class="nobr"><p>Test case</p></th>
315         <th class="nobr"><p>Result</p></th>
316         <th class="nobr"><p>Reason</p></th>
317         <th class="nobr"><p>Duration</p></th>
318       </tr>
319       <xsl:apply-templates select="tp" mode="summary">
320         <xsl:with-param name="which">failed</xsl:with-param>
321       </xsl:apply-templates>
322     </table>
323   </xsl:template>
324
325   <xsl:template name="failed-tps-summary">
326     <a name="failed-tps-summary" />
327     <h2 id="failed-tps-summary">Bogus test programs summary</h2>
328
329     <table class="tcs-summary">
330       <tr>
331         <th class="nobr">Test program</th>
332       </tr>
333       <xsl:apply-templates select="tp" mode="summary">
334         <xsl:with-param name="which">bogus</xsl:with-param>
335       </xsl:apply-templates>
336     </table>
337   </xsl:template>
338
339   <xsl:template name="skipped-tcs-summary">
340     <a name="skipped-tcs-summary" />
341     <h2 id="skipped-tcs-summary">Skipped test cases summary</h2>
342
343     <table class="tcs-summary">
344       <tr>
345         <th class="nobr"><p>Test case</p></th>
346         <th class="nobr"><p>Result</p></th>
347         <th class="nobr"><p>Reason</p></th>
348         <th class="nobr"><p>Duration</p></th>
349       </tr>
350       <xsl:apply-templates select="tp" mode="summary">
351         <xsl:with-param name="which">skipped</xsl:with-param>
352       </xsl:apply-templates>
353     </table>
354   </xsl:template>
355
356   <xsl:template match="tp" mode="summary">
357     <xsl:param name="which" />
358
359     <xsl:variable name="chosen">
360       <xsl:choose>
361         <xsl:when test="$which = 'bogus' and failed">yes</xsl:when>
362         <xsl:when test="$which = 'passed' and tc/passed">yes</xsl:when>
363         <xsl:when test="$which = 'failed' and tc/failed">yes</xsl:when>
364         <xsl:when test="$which = 'xfail' and
365                         tc/expected_death">yes</xsl:when>
366         <xsl:when test="$which = 'xfail' and
367                         tc/expected_exit">yes</xsl:when>
368         <xsl:when test="$which = 'xfail' and
369                         tc/expected_failure">yes</xsl:when>
370         <xsl:when test="$which = 'xfail' and
371                         tc/expected_signal">yes</xsl:when>
372         <xsl:when test="$which = 'xfail' and
373                         tc/expected_timeout">yes</xsl:when>
374         <xsl:when test="$which = 'skipped' and tc/skipped">yes</xsl:when>
375         <xsl:when test="$which = 'all'">yes</xsl:when>
376         <xsl:otherwise>no</xsl:otherwise>
377       </xsl:choose>
378     </xsl:variable>
379
380     <xsl:if test="$chosen = 'yes'">
381       <tr>
382         <td class="tp-id" colspan="3">
383           <p><xsl:value-of select="@id" /></p>
384         </td>
385         <td class="tp-numeric">
386           <p><xsl:value-of select="tp-time" />s</p>
387         </td>
388       </tr>
389       <xsl:if test="$which != 'bogus'">
390         <xsl:apply-templates select="tc" mode="summary">
391           <xsl:with-param name="which" select="$which" />
392         </xsl:apply-templates>
393       </xsl:if>
394     </xsl:if>
395   </xsl:template>
396
397   <xsl:template match="tc" mode="summary">
398     <xsl:param name="which" />
399
400     <xsl:variable name="full-id"
401                   select="concat(translate(../@id, '/', '_'), '_', @id)" />
402
403     <xsl:variable name="chosen">
404       <xsl:choose>
405         <xsl:when test="$which = 'passed' and ./passed">yes</xsl:when>
406         <xsl:when test="$which = 'failed' and ./failed">yes</xsl:when>
407         <xsl:when test="$which = 'xfail' and
408                         ./expected_death">yes</xsl:when>
409         <xsl:when test="$which = 'xfail' and
410                         ./expected_exit">yes</xsl:when>
411         <xsl:when test="$which = 'xfail' and
412                         ./expected_failure">yes</xsl:when>
413         <xsl:when test="$which = 'xfail' and
414                         ./expected_signal">yes</xsl:when>
415         <xsl:when test="$which = 'xfail' and
416                         ./expected_timeout">yes</xsl:when>
417         <xsl:when test="$which = 'skipped' and ./skipped">yes</xsl:when>
418         <xsl:when test="$which = 'all'">yes</xsl:when>
419         <xsl:otherwise>no</xsl:otherwise>
420       </xsl:choose>
421     </xsl:variable>
422
423     <xsl:if test="$chosen = 'yes'">
424       <tr>
425         <td class="tc-id">
426           <xsl:choose>
427             <xsl:when test="expected_death|expected_exit|expected_failure|
428                             expected_signal|expected_timeout|failed|skipped">
429               <p><a href="#{$full-id}"><xsl:value-of select="@id" /></a></p>
430             </xsl:when>
431             <xsl:otherwise>
432               <p><xsl:value-of select="@id" /></p>
433             </xsl:otherwise>
434           </xsl:choose>
435         </td>
436         <xsl:apply-templates select="expected_death|expected_exit|
437                                      expected_failure|expected_timeout|
438                                      expected_signal|failed|passed|
439                                      skipped" mode="tc" />
440         <td class="numeric">
441           <p><xsl:value-of select="tc-time" />s</p>
442         </td>
443       </tr>
444     </xsl:if>
445   </xsl:template>
446
447   <xsl:template match="passed" mode="tc">
448     <td class="tcr-passed"><p class="nobr">Passed</p></td>
449     <td class="tcr-reason"><p>N/A</p></td>
450   </xsl:template>
451
452   <xsl:template match="expected_death" mode="tc">
453     <td class="tcr-xfail"><p class="nobr">Expected death</p></td>
454     <td class="tcr-reason"><p><xsl:apply-templates /></p></td>
455   </xsl:template>
456
457   <xsl:template match="expected_exit" mode="tc">
458     <td class="tcr-xfail"><p class="nobr">Expected exit</p></td>
459     <td class="tcr-reason"><p><xsl:apply-templates /></p></td>
460   </xsl:template>
461
462   <xsl:template match="expected_failure" mode="tc">
463     <td class="tcr-xfail"><p class="nobr">Expected failure</p></td>
464     <td class="tcr-reason"><p><xsl:apply-templates /></p></td>
465   </xsl:template>
466
467   <xsl:template match="expected_timeout" mode="tc">
468     <td class="tcr-xfail"><p class="nobr">Expected timeout</p></td>
469     <td class="tcr-reason"><p><xsl:apply-templates /></p></td>
470   </xsl:template>
471
472   <xsl:template match="expected_signal" mode="tc">
473     <td class="tcr-xfail"><p class="nobr">Expected signal</p></td>
474     <td class="tcr-reason"><p><xsl:apply-templates /></p></td>
475   </xsl:template>
476
477   <xsl:template match="failed" mode="tc">
478     <td class="tcr-failed"><p class="nobr">Failed</p></td>
479     <td class="tcr-reason"><p><xsl:apply-templates /></p></td>
480   </xsl:template>
481
482   <xsl:template match="skipped" mode="tc">
483     <td class="tcr-skipped"><p class="nobr">Skipped</p></td>
484     <td class="tcr-reason"><p><xsl:apply-templates /></p></td>
485   </xsl:template>
486
487   <xsl:template match="tp" mode="details">
488     <xsl:apply-templates select="tc[expected_death|expected_exit|
489                                     expected_failure|expected_signal|
490                                     expected_timeout|failed|skipped]"
491                          mode="details" />
492   </xsl:template>
493
494   <xsl:template match="failed" mode="details">
495     <p class="term"><strong>FAILED</strong>: <xsl:apply-templates /></p>
496   </xsl:template>
497
498   <xsl:template match="expected_death|expected_exit|expected_failure|
499                        expected_signal|expected_timeout" mode="details">
500     <p class="term"><strong>XFAIL</strong>: <xsl:apply-templates /></p>
501   </xsl:template>
502
503   <xsl:template match="skipped" mode="details">
504     <p class="term"><strong>SKIPPED</strong>: <xsl:apply-templates /></p>
505   </xsl:template>
506
507   <xsl:template match="tc" mode="details">
508     <xsl:variable name="full-id"
509                   select="concat(translate(../@id, '/', '_'), '_', @id)" />
510
511     <a name="{$full-id}" />
512     <h2 id="{$full-id}">Test case:
513     <xsl:value-of select="../@id" /><xsl:text>/</xsl:text>
514     <xsl:value-of select="@id" /></h2>
515
516     <xsl:if test="tc-time">
517       <p class="details">Duration:
518       <xsl:apply-templates select="tc-time" mode="details" /></p>
519     </xsl:if>
520
521     <h3>Termination reason</h3>
522     <xsl:apply-templates select="expected_death|expected_exit|expected_failure|
523                                  expected_signal|expected_timeout|
524                                  failed|skipped"
525                          mode="details" />
526
527     <xsl:if test="so">
528       <h3>Standard output stream</h3>
529       <pre class="so"><xsl:apply-templates select="so" mode="details" /></pre>
530     </xsl:if>
531
532     <xsl:if test="se">
533       <h3>Standard error stream</h3>
534       <pre class="se"><xsl:apply-templates select="se" mode="details" /></pre>
535     </xsl:if>
536   </xsl:template>
537
538   <xsl:template match="tc-time" mode="details">
539     <xsl:apply-templates /> seconds
540   </xsl:template>
541
542   <xsl:template match="so" mode="details">
543     <xsl:apply-templates />
544     <xsl:if test="position() != last()">
545       <xsl:text>
546 </xsl:text>
547     </xsl:if>
548   </xsl:template>
549
550   <xsl:template match="se" mode="details">
551     <xsl:apply-templates />
552     <xsl:if test="position() != last()">
553       <xsl:text>
554 </xsl:text>
555     </xsl:if>
556   </xsl:template>
557
558   <xsl:template match="@*|node()" priority="-1">
559     <xsl:copy>
560       <xsl:apply-templates select="@*|node()" />
561     </xsl:copy>
562   </xsl:template>
563
564 </xsl:stylesheet>