blob: 20f9c1df90cd81c9a789b2c13b0f8eafa623f4d7 [file] [log] [blame]
rameshiyer27a1954d42022-11-14 06:00:12 +00001#!/bin/bash
2#
3# ============LICENSE_START====================================================
rameshiyer27181e6c52023-03-30 10:50:18 +01004# Copyright (C) 2023 Nordix Foundation.
rameshiyer27a1954d42022-11-14 06:00:12 +00005# =============================================================================
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18# SPDX-License-Identifier: Apache-2.0
19# ============LICENSE_END======================================================
20
rameshiyer27181e6c52023-03-30 10:50:18 +010021# This script generates dummy robot result files for jenkins.
rameshiyer2707004862023-01-23 11:50:01 +000022
adheli.tavares1153b6d2023-02-28 12:59:37 +000023if [ -z "${WORKSPACE}" ]; then
24 WORKSPACE=$(git rev-parse --show-toplevel)
25 export WORKSPACE
26fi
27
rameshiyer27181e6c52023-03-30 10:50:18 +010028export ROBOT_LOG_DIR=${WORKSPACE}/csit/archives/$2
rameshiyer27d8f91802023-03-07 01:32:28 +000029
rameshiyer27181e6c52023-03-30 10:50:18 +010030mkdir -p $ROBOT_LOG_DIR
rameshiyer2707004862023-01-23 11:50:01 +000031
rameshiyer27181e6c52023-03-30 10:50:18 +010032echo "CSIT in kubernetes is disabled. Generating dummy results..."
rameshiyer27a1954d42022-11-14 06:00:12 +000033
rameshiyer27181e6c52023-03-30 10:50:18 +010034cat >${ROBOT_LOG_DIR}/output.xml <<EOF
35<robot generator="Robot 6.1a1 (Python 3.11.2 on linux)" rpa="false" schemaversion="4">
36<statistics>
37<total>
38<stat pass="1" fail="0" skip="0">All Tests</stat>
39</total>
40<tag>
41</tag>
42<suite>
43<stat pass="1" fail="0" skip="0" id="s1" name="Dummy-Test">Dummy-Test</stat>
44</suite>
45</statistics>
46<errors></errors>
47</robot>
48EOF
rameshiyer27a1954d42022-11-14 06:00:12 +000049
rameshiyer27181e6c52023-03-30 10:50:18 +010050cat >${ROBOT_LOG_DIR}/log.html <<EOF
51<!DOCTYPE html>
52<head>
53 <style media="all" type="text/css">
54 /* Generic and misc styles */
55 body {
56 font-family: Helvetica, sans-serif;
57 font-size: 0.8em;
58 color: black;
59 padding: 6px;
60 background: white;
61 }
62 table {
63 table-layout: fixed;
64 word-wrap: break-word;
65 empty-cells: show;
66 font-size: 1em;
67 }
68 th, td {
69 vertical-align: top;
70 }
71 br {
72 mso-data-placement: same-cell; /* maintain line breaks in Excel */
73 }
74 hr {
75 background: #ccc;
76 height: 1px;
77 border: 0;
78 }
79 a, a:link, a:visited {
80 text-decoration: none;
81 color: #15c;
82 }
83 a > img {
84 border: 1px solid #15c !important;
85 }
86 a:hover, a:active {
87 text-decoration: underline;
88 color: #61c;
89 }
90 .parent-name {
91 font-size: 0.7em;
92 letter-spacing: -0.07em;
93 }
94 .message {
95 white-space: pre-wrap;
96 }
97 /* Headers */
98 #header {
99 width: 65em;
100 height: 3em;
101 margin: 6px 0;
102 }
103 h1 {
104 float: left;
105 margin: 0 0 0.5em 0;
106 width: 75%;
107 }
108 h2 {
109 clear: left;
110 }
111 #generated {
112 float: right;
113 text-align: right;
114 font-size: 0.9em;
115 white-space: nowrap;
116 }
117 /* Documentation headers */
118 .doc > h2 {
119 font-size: 1.2em;
120 }
121 .doc > h3 {
122 font-size: 1.1em;
123 }
124 .doc > h4 {
125 font-size: 1.0em;
126 }
127 /* Status text colors -- !important allows using them in links */
128 .fail {
129 color: #ce3e01 !important;
130 font-weight: bold;
131 }
132 .pass {
133 color: #098a09 !important;
134 }
135 .skip {
136 color: #927201 !important;
137 font-weight: bold;
138 }
139 .label {
140 padding: 2px 5px;
141 font-size: 0.75em;
142 letter-spacing: 1px;
143 white-space: nowrap;
144 color: black;
145 background-color: #ddd;
146 border-radius: 3px;
147 }
148 .label.debug, .label.trace, .label.error, .label.keyword {
149 letter-spacing: 0;
150 }
151 .label.pass, .label.fail, .label.error, .label.skip, .label.warn {
152 font-weight: bold;
153 }
154 .label.pass {
155 background-color: #97bd61;
156 color: #000 !important;
157 }
158 .label.fail, .label.error {
159 background-color: #ce3e01;
160 color: #fff !important;
161 }
162 .label.skip, .label.warn {
163 background-color: #fed84f;
164 color: #000 !important;
165 }
166 /* Top right header */
167 #top-right-header {
168 position: fixed;
169 top: 0;
170 right: 0;
171 z-index: 1000;
172 width: 12em;
173 text-align: center;
174 }
175 #report-or-log-link a {
176 display: block;
177 background: black;
178 color: white;
179 text-decoration: none;
180 font-weight: bold;
181 letter-spacing: 0.1em;
182 padding: 0.3em 0;
183 border-bottom-left-radius: 4px;
184 }
185 #report-or-log-link a:hover {
186 color: #ddd;
187 }
188 #log-level-selector {
189 padding: 0.3em 0;
190 font-size: 0.9em;
191 border-bottom-left-radius: 4px;
192 background: #ddd;
193 }
194 /* Statistics table */
195 .statistics {
196 width: 65em;
197 border-collapse: collapse;
198 empty-cells: show;
199 margin-bottom: 1em;
200 }
201 .statistics tr:hover {
202 background: #f4f4f4;
203 cursor: pointer;
204 }
205 .statistics th, .statistics td {
206 border: 1px solid #ccc;
207 padding: 0.1em 0.3em;
208 }
209 .statistics th {
210 background-color: #ddd;
211 padding: 0.2em 0.3em;
212 }
213 .statistics td {
214 vertical-align: middle;
215 }
216 .stats-col-stat {
217 width: 4.5em;
218 text-align: center;
219 }
220 .stats-col-elapsed {
221 width: 5.5em;
222 text-align: center;
223 }
224 .stats-col-graph {
225 width: 9em;
226 }
227 th.stats-col-graph:hover {
228 cursor: default;
229 }
230 .stat-name {
231 float: left;
232 }
233 .stat-name a, .stat-name span {
234 font-weight: bold;
235 }
236 .tag-links {
237 font-size: 0.9em;
238 float: right;
239 margin-top: 0.05em;
240 }
241 .tag-links span {
242 margin-left: 0.2em;
243 }
244 /* Statistics graph */
245 .graph, .empty-graph {
246 border: 1px solid #ccc;
247 width: auto;
248 height: 7px;
249 padding: 0;
250 background: #aaa;
251 }
252 .empty-graph {
253 background: #eee;
254 }
255 .pass-bar, .fail-bar, .skip-bar {
256 float: left;
257 height: 100%;
258 }
259 .fail-bar {
260 background: #ce3e01;
261 }
262 .pass-bar {
263 background: #97bd61;
264 }
265 .skip-bar {
266 background: #fed84f;
267 }
268 /* Tablesorter - adapted from provided Blue Skin */
269 .tablesorter-header {
270 background-image: url(data:image/gif;base64,R0lGODlhCwAJAIAAAH9/fwAAACH5BAEAAAEALAAAAAALAAkAAAIRjAOnBr3cnIr0WUjTrC9e9BQAOw==);
271 background-repeat: no-repeat;
272 background-position: center right;
273 cursor: pointer;
274 }
275 .tablesorter-header:hover {
276 background-color: #ccc;
277 }
278 .tablesorter-headerAsc {
279 background-image: url(data:image/gif;base64,R0lGODlhCwAJAKEAAAAAAH9/fwAAAAAAACH5BAEAAAIALAAAAAALAAkAAAIUlBWnFr3cnIr0WQOyBmvzp13CpxQAOw==);
280 background-color: #ccc !important;
281 }
282 .tablesorter-headerDesc {
283 background-image: url(data:image/gif;base64,R0lGODlhCwAJAKEAAAAAAH9/fwAAAAAAACH5BAEAAAIALAAAAAALAAkAAAIUlAWnBr3cnIr0WROyDmvzp13CpxQAOw==);
284 background-color: #ccc !important;
285 }
286 .sorter-false {
287 background-image: none;
288 cursor: default;
289 }
290 .sorter-false:hover {
291 background-color: #ddd;
292 }
293 </style>
rameshiyer27a1954d42022-11-14 06:00:12 +0000294
rameshiyer2707004862023-01-23 11:50:01 +0000295
rameshiyer27181e6c52023-03-30 10:50:18 +0100296</head>
297<body>
298 <div id="statistics-container">
299 <h2>Test Statistics</h2>
300 <table class="statistics tablesorter tablesorter-default tablesorter2e2fe879cc465" id="total-stats" role="grid">
301 <thead>
302 <tr role="row" class="tablesorter-headerRow">
303 <th class="stats-col-name tablesorter-header tablesorter-headerUnSorted" data-column="0" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="total-stats" unselectable="on" aria-sort="none" aria-label="Total Statistics: No sort applied, activate to apply an ascending sort" style="user-select: none;">
304 <div class="tablesorter-header-inner">Total Statistics</div>
305 </th>
306 <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="1" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="total-stats" unselectable="on" aria-sort="none" aria-label="Total: No sort applied, activate to apply a descending sort" style="user-select: none;">
307 <div class="tablesorter-header-inner">Total</div>
308 </th>
309 <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="2" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="total-stats" unselectable="on" aria-sort="none" aria-label="Pass: No sort applied, activate to apply a descending sort" style="user-select: none;">
310 <div class="tablesorter-header-inner">Pass</div>
311 </th>
312 <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="3" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="total-stats" unselectable="on" aria-sort="none" aria-label="Fail: No sort applied, activate to apply a descending sort" style="user-select: none;">
313 <div class="tablesorter-header-inner">Fail</div>
314 </th>
315 <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="4" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="total-stats" unselectable="on" aria-sort="none" aria-label="Skip: No sort applied, activate to apply a descending sort" style="user-select: none;">
316 <div class="tablesorter-header-inner">Skip</div>
317 </th>
318 <th class="stats-col-elapsed tablesorter-header tablesorter-headerUnSorted" title="Total execution time of these tests. Excludes suite setups and teardowns." data-column="5" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="total-stats" unselectable="on" aria-sort="none" aria-label="Elapsed: No sort applied, activate to apply a descending sort" style="user-select: none;">
319 <div class="tablesorter-header-inner">Elapsed</div>
320 </th>
321 <th class="stats-col-graph tablesorter-header sorter-false tablesorter-headerUnSorted" data-column="6" scope="col" role="columnheader" aria-disabled="true" unselectable="on" aria-sort="none" aria-label="Pass / Fail / Skip: No sort applied, sorting is disabled" style="user-select: none;">
322 <div class="tablesorter-header-inner">Pass / Fail / Skip</div>
323 </th>
324 </tr>
325 </thead>
326 <tbody aria-live="polite" aria-relevant="all">
327 <tr class="row-0" role="row">
328 <td class="stats-col-name">
329 <div class="stat-name">
330 <span>All Tests</span>
331 </div>
332 </td>
333 <td class="stats-col-stat">1</td>
334 <td class="stats-col-stat">1</td>
335 <td class="stats-col-stat">0</td>
336 <td class="stats-col-stat">0</td>
337 <td class="stats-col-elapsed" title="Total execution time of these tests. Excludes suite setups and teardowns.">00:00:00</td>
338 <td class="stats-col-graph">
339 <div class="graph">
340 <div class="pass-bar" style="width: 100%" title="100%"></div>
341 <div class="fail-bar" style="width: 0%" title="0%"></div>
342 <div class="skip-bar" style="width: 0%" title="0%"></div>
343 </div>
344 </td>
345 </tr>
346 </tbody>
347 </table>
348 <table class="statistics tablesorter tablesorter-default tablesorter8e8ffd77a824a" id="tag-stats" role="grid">
349 <thead>
350 <tr role="row" class="tablesorter-headerRow">
351 <th class="stats-col-name tablesorter-header tablesorter-headerUnSorted" data-column="0" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="tag-stats" unselectable="on" aria-sort="none" aria-label="Statistics by Tag: No sort applied, activate to apply an ascending sort" style="user-select: none;">
352 <div class="tablesorter-header-inner">Statistics by Tag</div>
353 </th>
354 <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="1" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="tag-stats" unselectable="on" aria-sort="none" aria-label="Total: No sort applied, activate to apply a descending sort" style="user-select: none;">
355 <div class="tablesorter-header-inner">Total</div>
356 </th>
357 <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="2" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="tag-stats" unselectable="on" aria-sort="none" aria-label="Pass: No sort applied, activate to apply a descending sort" style="user-select: none;">
358 <div class="tablesorter-header-inner">Pass</div>
359 </th>
360 <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="3" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="tag-stats" unselectable="on" aria-sort="none" aria-label="Fail: No sort applied, activate to apply a descending sort" style="user-select: none;">
361 <div class="tablesorter-header-inner">Fail</div>
362 </th>
363 <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="4" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="tag-stats" unselectable="on" aria-sort="none" aria-label="Skip: No sort applied, activate to apply a descending sort" style="user-select: none;">
364 <div class="tablesorter-header-inner">Skip</div>
365 </th>
366 <th class="stats-col-elapsed tablesorter-header tablesorter-headerUnSorted" title="Total execution time of these tests. Excludes suite setups and teardowns." data-column="5" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="tag-stats" unselectable="on" aria-sort="none" aria-label="Elapsed: No sort applied, activate to apply a descending sort" style="user-select: none;">
367 <div class="tablesorter-header-inner">Elapsed</div>
368 </th>
369 <th class="stats-col-graph tablesorter-header sorter-false tablesorter-headerUnSorted" data-column="6" scope="col" role="columnheader" aria-disabled="true" unselectable="on" aria-sort="none" aria-label="Pass / Fail / Skip: No sort applied, sorting is disabled" style="user-select: none;">
370 <div class="tablesorter-header-inner">Pass / Fail / Skip</div>
371 </th>
372 </tr>
373 </thead>
374 <tbody aria-live="polite" aria-relevant="all">
375 <tr class="row-0" role="row">
376 <td class="stats-col-name">No Tags</td>
377 <td class="stats-col-stat"></td>
378 <td class="stats-col-stat"></td>
379 <td class="stats-col-stat"></td>
380 <td class="stats-col-stat"></td>
381 <td class="stats-col-elapsed" title="Total execution time of these tests. Excludes suite setups and teardowns."></td>
382 <td class="stats-col-graph">
383 <div class="empty-graph"></div>
384 </td>
385 </tr>
386 </tbody>
387 </table>
388 <table class="statistics tablesorter tablesorter-default tablesorter06030fd685e0f" id="suite-stats" role="grid">
389 <thead>
390 <tr role="row" class="tablesorter-headerRow">
391 <th class="stats-col-name tablesorter-header tablesorter-headerUnSorted" data-column="0" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="suite-stats" unselectable="on" aria-sort="none" aria-label="Statistics by Suite: No sort applied, activate to apply an ascending sort" style="user-select: none;">
392 <div class="tablesorter-header-inner">Statistics by Suite</div>
393 </th>
394 <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="1" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="suite-stats" unselectable="on" aria-sort="none" aria-label="Total: No sort applied, activate to apply a descending sort" style="user-select: none;">
395 <div class="tablesorter-header-inner">Total</div>
396 </th>
397 <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="2" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="suite-stats" unselectable="on" aria-sort="none" aria-label="Pass: No sort applied, activate to apply a descending sort" style="user-select: none;">
398 <div class="tablesorter-header-inner">Pass</div>
399 </th>
400 <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="3" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="suite-stats" unselectable="on" aria-sort="none" aria-label="Fail: No sort applied, activate to apply a descending sort" style="user-select: none;">
401 <div class="tablesorter-header-inner">Fail</div>
402 </th>
403 <th class="stats-col-stat tablesorter-header tablesorter-headerUnSorted" data-column="4" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="suite-stats" unselectable="on" aria-sort="none" aria-label="Skip: No sort applied, activate to apply a descending sort" style="user-select: none;">
404 <div class="tablesorter-header-inner">Skip</div>
405 </th>
406 <th class="stats-col-elapsed tablesorter-header tablesorter-headerUnSorted" title="Total execution time of this suite." data-column="5" tabindex="0" scope="col" role="columnheader" aria-disabled="false" aria-controls="suite-stats" unselectable="on" aria-sort="none" aria-label="Elapsed: No sort applied, activate to apply a descending sort" style="user-select: none;">
407 <div class="tablesorter-header-inner">Elapsed</div>
408 </th>
409 <th class="stats-col-graph tablesorter-header sorter-false tablesorter-headerUnSorted" data-column="6" scope="col" role="columnheader" aria-disabled="true" unselectable="on" aria-sort="none" aria-label="Pass / Fail / Skip: No sort applied, sorting is disabled" style="user-select: none;">
410 <div class="tablesorter-header-inner">Pass / Fail / Skip</div>
411 </th>
412 </tr>
413 </thead>
414 <tbody aria-live="polite" aria-relevant="all">
415 <tr onclick="makeElementVisible('s1')" class="row-0" role="row">
416 <td class="stats-col-name" title="pap">
417 <div class="stat-name">
418 <span href="#s1">
419 <span class="parent-name"></span>Dummy Test</span>
420 </div>
421 </td>
422 <td class="stats-col-stat">1</td>
423 <td class="stats-col-stat">1</td>
424 <td class="stats-col-stat">0</td>
425 <td class="stats-col-stat">0</td>
426 <td class="stats-col-elapsed" title="Total execution time of this suite.">00:00:00</td>
427 <td class="stats-col-graph">
428 <div class="graph">
429 <div class="pass-bar" style="width: 100%" title="100%"></div>
430 <div class="fail-bar" style="width: 0%" title="0%"></div>
431 <div class="skip-bar" style="width: 0%" title="0%"></div>
432 </div>
433 </td>
434 </tr>
435 </tbody>
436 </table>
437 </div>
438</body>
439</html>
440EOF
rameshiyer27a1954d42022-11-14 06:00:12 +0000441
rameshiyer27181e6c52023-03-30 10:50:18 +0100442cp ${ROBOT_LOG_DIR}/log.html ${ROBOT_LOG_DIR}/report.html