• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (C) 2016 The Android Open Source Project
3
4    Licensed under the Apache License, Version 2.0 (the "License");
5    you may not use this file except in compliance with the License.
6    You may obtain a copy of the License at
7
8        http://www.apache.org/licenses/LICENSE-2.0
9
10    Unless required by applicable law or agreed to in writing, software
11    distributed under the License is distributed on an "AS IS" BASIS,
12    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    See the License for the specific language governing permissions and
14    limitations under the License.
15-->
16
17<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>
18<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
19
20    <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
21
22    <xsl:template match="/">
23
24        <html>
25            <head>
26                <title>Test Report</title>
27                <style type="text/css">
28                    @import "compatibility_result.css";
29                </style>
30            </head>
31            <body>
32                <div>
33                    <table class="title">
34                        <tr>
35                            <td align="left"><img src="logo.png"/></td>
36                        </tr>
37                    </table>
38                </div>
39
40                <div>
41                    <table class="summary">
42                        <tr>
43                            <th colspan="2">Summary</th>
44                        </tr>
45                        <tr>
46                            <td class="rowtitle">Suite / Plan</td>
47                            <td>
48                                <xsl:value-of select="Result/@suite_name"/> / <xsl:value-of select="Result/@suite_plan"/>
49                            </td>
50                        </tr>
51                        <tr>
52                            <td class="rowtitle">Suite / Build</td>
53                            <td>
54                                <xsl:value-of select="Result/@suite_version"/> / <xsl:value-of select="Result/@suite_build_number"/>
55                            </td>
56                        </tr>
57                        <tr>
58                            <td class="rowtitle">Host Info</td>
59                            <td>
60                                Result/@start
61                                <xsl:value-of select="Result/@host_name"/>
62                                (<xsl:value-of select="Result/@os_name"/> - <xsl:value-of select="Result/@os_version"/>)
63                            </td>
64                        </tr>
65                        <tr>
66                            <td class="rowtitle">Start time / End Time</td>
67                            <td>
68                                <xsl:value-of select="Result/@start_display"/> /
69                                <xsl:value-of select="Result/@end_display"/>
70                            </td>
71                        </tr>
72                        <tr>
73                            <td class="rowtitle">Tests Passed</td>
74                            <td>
75                                <xsl:value-of select="Result/Summary/@pass"/>
76                            </td>
77                        </tr>
78                        <tr>
79                            <td class="rowtitle">Tests Failed</td>
80                            <td>
81                                <xsl:value-of select="Result/Summary/@failed"/>
82                            </td>
83                        </tr>
84                        <tr>
85                            <td class="rowtitle">Modules Done</td>
86                            <td>
87                                <xsl:value-of select="Result/Summary/@modules_done"/>
88                            </td>
89                        </tr>
90                        <tr>
91                            <td class="rowtitle">Modules Total</td>
92                            <td>
93                                <xsl:value-of select="Result/Summary/@modules_total"/>
94                            </td>
95                        </tr>
96                        <tr>
97                            <td class="rowtitle">Fingerprint</td>
98                            <td>
99                                <xsl:value-of select="Result/Build/@build_fingerprint"/>
100                            </td>
101                        </tr>
102                        <tr>
103                            <td class="rowtitle">Security Patch</td>
104                            <td>
105                                <xsl:value-of select="Result/Build/@build_version_security_patch"/>
106                            </td>
107                        </tr>
108                        <tr>
109                            <td class="rowtitle">Release (SDK)</td>
110                            <td>
111                                <xsl:value-of select="Result/Build/@build_version_release"/> (<xsl:value-of select="Result/Build/@build_version_sdk"/>)
112                            </td>
113                        </tr>
114                        <tr>
115                            <td class="rowtitle">ABIs</td>
116                            <td>
117                                <xsl:value-of select="Result/Build/@build_abis"/>
118                            </td>
119                        </tr>
120                    </table>
121                </div>
122
123                <!-- High level summary of test execution -->
124                <br/>
125                <div>
126                    <table class="testsummary">
127                        <tr>
128                            <th>Module</th>
129                            <th>Passed</th>
130                            <th>Failed</th>
131                            <th>Assumption Failure</th>
132                            <th>Ignored</th>
133                            <th>Total Tests</th>
134                            <th>Done</th>
135                        </tr>
136                        <xsl:for-each select="Result/Module">
137                            <tr>
138                                <td>
139                                    <xsl:if test="count(TestCase/Test[@result = 'fail']) &gt; 0">
140                                        <xsl:variable name="href"><xsl:value-of select="@abi"/>&#xA0;<xsl:value-of select="@name"/></xsl:variable>
141                                        <a href="#{$href}"><xsl:value-of select="@abi"/>&#xA0;<xsl:value-of select="@name"/></a>
142                                    </xsl:if>
143                                    <xsl:if test="count(TestCase/Test[@result = 'fail']) &lt; 1">
144                                        <xsl:value-of select="@abi"/>&#xA0;<xsl:value-of select="@name"/>
145                                    </xsl:if>
146                                </td>
147                                <td>
148                                    <xsl:value-of select="@pass"/>
149                                </td>
150                                <td>
151                                    <xsl:value-of select="count(TestCase/Test[@result = 'fail'])"/>
152                                </td>
153                                <td>
154                                    <xsl:value-of select="count(TestCase/Test[@result = 'ASSUMPTION_FAILURE'])"/>
155                                </td>
156                                <td>
157                                    <xsl:value-of select="count(TestCase/Test[@result = 'IGNORED'])"/>
158                                </td>
159                                <td>
160                                    <xsl:value-of select="@total_tests"/>
161                                </td>
162                                <td>
163                                    <xsl:value-of select="@done"/>
164                                </td>
165                            </tr>
166                        </xsl:for-each> <!-- end Module -->
167                    </table>
168                </div>
169
170                <br/>
171                <xsl:call-template name="detailedTestReport">
172                    <xsl:with-param name="resultFilter" select="'fail'" />
173                </xsl:call-template>
174
175                <br/>
176                <xsl:call-template name="incompleteModules" />
177
178            </body>
179        </html>
180    </xsl:template>
181
182    <xsl:template name="detailedTestReport">
183        <xsl:param name="resultFilter" />
184        <div>
185            <xsl:for-each select="Result/Module">
186                <xsl:if test="$resultFilter=''
187                        or count(TestCase/Test[@result=$resultFilter]) &gt; 0">
188
189                    <table class="testdetails">
190                        <tr>
191                            <td class="module" colspan="3">
192                                <xsl:variable name="href"><xsl:value-of select="@abi"/>&#xA0;<xsl:value-of select="@name"/></xsl:variable>
193                                <a name="{$href}"><xsl:value-of select="@abi"/>&#xA0;<xsl:value-of select="@name"/></a>
194                            </td>
195                        </tr>
196
197                        <tr>
198                            <th width="30%">Test</th>
199                            <th width="5%">Result</th>
200                            <th>Details</th>
201                        </tr>
202
203                        <xsl:for-each select="TestCase">
204                            <xsl:variable name="TestCase" select="."/>
205                            <!-- test -->
206                            <xsl:for-each select="Test">
207                                <xsl:if test="$resultFilter='' or @result=$resultFilter">
208                                    <tr>
209                                        <td class="testname"> <xsl:value-of select="$TestCase/@name"/>#<xsl:value-of select="@name"/></td>
210
211                                        <!-- test results -->
212                                        <xsl:if test="@result='pass'">
213                                            <td class="pass">
214                                                <div style="text-align: center; margin-left:auto; margin-right:auto;">
215                                                    <xsl:value-of select="@result"/>
216                                                </div>
217                                            </td>
218                                            <td class="failuredetails"/>
219                                        </xsl:if>
220
221                                        <xsl:if test="@result='IGNORED'">
222                                            <td class="pass">
223                                                <div style="text-align: center; margin-left:auto; margin-right:auto;">
224                                                    <xsl:value-of select="@result"/>
225                                                </div>
226                                            </td>
227                                            <td class="failuredetails"/>
228                                        </xsl:if>
229
230                                        <xsl:if test="@result='fail'">
231                                            <td class="failed">
232                                                <div style="text-align: center; margin-left:auto; margin-right:auto;">
233                                                    <xsl:value-of select="@result"/>
234                                                </div>
235                                            </td>
236                                            <td class="failuredetails">
237                                                <div class="details">
238                                                    <xsl:value-of select="Failure/@message"/>
239                                                </div>
240                                            </td>
241                                        </xsl:if>
242
243                                        <xsl:if test="@result='ASSUMPTION_FAILURE'">
244                                            <td class="pass">
245                                                <div style="text-align: center; margin-left:auto; margin-right:auto;">
246                                                    <xsl:value-of select="@result"/>
247                                                </div>
248                                            </td>
249                                            <td class="failuredetails">
250                                                <div class="details">
251                                                    <xsl:value-of select="Failure/@message"/>
252                                                </div>
253                                            </td>
254                                        </xsl:if>
255
256                                        <xsl:if test="@result='not_executed'">
257                                            <td class="not_executed">
258                                                <div style="text-align: center; margin-left:auto; margin-right:auto;">
259                                                    <xsl:value-of select="@result"/>
260                                                </div>
261                                            </td>
262                                            <td class="failuredetails"></td>
263                                        </xsl:if>
264                                    </tr> <!-- finished with a row -->
265                                </xsl:if>
266                            </xsl:for-each> <!-- end test -->
267                        </xsl:for-each>
268                    </table>
269                </xsl:if>
270            </xsl:for-each> <!-- end test Module -->
271        </div>
272    </xsl:template>
273
274    <xsl:template name="incompleteModules">
275        <xsl:if test="not(Result/Summary/@modules_done = Result/Summary/@modules_total)">
276            <div>
277                <table class="incompletemodules">
278                    <tr>
279                        <th>Incomplete Modules</th>
280                    </tr>
281                    <xsl:for-each select="Result/Module">
282                        <xsl:if test="@done='false'">
283                            <tr>
284                                <td>
285                                    <xsl:variable name="href"><xsl:value-of select="@abi"/>&#xA0;<xsl:value-of select="@name"/></xsl:variable>
286                                    <a name="{$href}"><xsl:value-of select="@abi"/>&#xA0;<xsl:value-of select="@name"/></a>
287                                </td>
288                            </tr>
289                        </xsl:if>
290                    </xsl:for-each> <!-- end test Module -->
291                </table>
292            </div>
293        </xsl:if>
294    </xsl:template>
295
296    <!-- Take a delimited string and insert line breaks after a some number of elements. -->
297    <xsl:template name="formatDelimitedString">
298        <xsl:param name="string" />
299        <xsl:param name="numTokensPerRow" select="10" />
300        <xsl:param name="tokenIndex" select="1" />
301        <xsl:if test="$string">
302            <!-- Requires the last element to also have a delimiter after it. -->
303            <xsl:variable name="token" select="substring-before($string, ';')" />
304            <xsl:value-of select="$token" />
305            <xsl:text>&#160;</xsl:text>
306
307            <xsl:if test="$tokenIndex mod $numTokensPerRow = 0">
308                <br />
309            </xsl:if>
310
311            <xsl:call-template name="formatDelimitedString">
312                <xsl:with-param name="string" select="substring-after($string, ';')" />
313                <xsl:with-param name="numTokensPerRow" select="$numTokensPerRow" />
314                <xsl:with-param name="tokenIndex" select="$tokenIndex + 1" />
315            </xsl:call-template>
316        </xsl:if>
317    </xsl:template>
318
319</xsl:stylesheet>
320