Lines Matching +full:write +full:- +full:data
1 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
5 # Generate an HTML-formatted log file containing multiple streams of data,
6 # each represented in a well-delineated/-structured fashion.
17 """A file-like object used to write a single logical stream of data into
27 chained_file: The file-like object to which all stream data should be
39 """Dummy function so that this class is "file-like".
50 def write(self, data, implicit=False): argument
51 """Write data to the log stream.
54 data: The data to write tot he file.
55 implicit: Boolean indicating whether data actually appeared in the
56 stream, or was implicitly generated. A valid use-case is to
65 self.logfile.write(self, data, implicit)
67 self.chained_file.write(data)
84 """A utility object used to execute sub-processes and log their output to
93 name: The name of this log stream or sub-process.
94 chained_file: The file-like object to which all stream data should
112 """Run a command as a sub-process, and log the results.
132 self.chained_file.write(msg)
133 self.logfile.write(self, msg)
164 self.logfile.write(self, output)
166 self.chained_file.write(output)
205 """Generates an HTML-formatted log file containing multiple streams of
206 data, each represented in a well-delineated/-structured fashion."""
212 fn: The filename to write to.
229 self.f.write('''\
241 btns = "<span class=\\\"block-expand hidden\\\">[+] </span>" +
242 "<span class=\\\"block-contract\\\">[-] </span>";
243 $(".block-header").prepend(btns);
245 // Pre-contract all blocks which passed, leaving only problem cases
247 // Only top-level blocks (sections) should have any status
248 passed_bcs = $(".block-content:has(.status-pass)");
251 passed_bcs = passed_bcs.not(":has(.status-fail)");
252 passed_bcs = passed_bcs.not(":has(.status-xfail)");
253 passed_bcs = passed_bcs.not(":has(.status-xpass)");
254 passed_bcs = passed_bcs.not(":has(.status-skipped)");
255 passed_bcs = passed_bcs.not(":has(.status-warning)");
259 bhs = passed_bcs.parent().children(".block-header")
260 bhs.children(".block-expand").removeClass("hidden");
261 bhs.children(".block-contract").addClass("hidden");
265 $(".block-header").on("click", function (e) {
267 var content = header.next(".block-content");
271 header.children(".block-expand").first().removeClass("hidden");
272 header.children(".block-contract").first().addClass("hidden");
274 header.children(".block-contract").first().removeClass("hidden");
275 header.children(".block-expand").first().addClass("hidden");
283 var header = block.children(".block-header");
284 var content = block.children(".block-content").first();
285 header.children(".block-contract").first().removeClass("hidden");
286 header.children(".block-expand").first().addClass("hidden");
299 After calling this function, no more data may be written to the log.
308 self.f.write('''\
321 def _escape(self, data): argument
322 """Render data format suitable for inclusion in an HTML document.
324 This includes HTML-escaping certain characters, and translating
328 data: The raw string data to be escaped.
331 An escaped version of the data.
334 data = data.replace(chr(13), '')
335 data = ''.join((ord(c) in self._nonprint) and ('%%%02x' % ord(c)) or
336 c for c in data)
337 data = cgi.escape(data)
338 return data
341 """Write HTML to the log file to terminate the current stream's data.
353 self.f.write('</pre>\n')
354 self.f.write('<div class="stream-trailer block-trailer">End stream: ' +
356 self.f.write('</div>\n')
357 self.f.write('</div>\n')
361 """Write a note or one-off message to the log file.
374 self.f.write('<div class="' + note_type + '">\n')
375 self.f.write('<pre>')
377 self.f.write('<a href="#%s">' % anchor)
378 self.f.write(self._escape(msg))
380 self.f.write('</a>')
381 self.f.write('\n</pre>\n')
382 self.f.write('</div>\n')
403 self.f.write('<div class="section block" id="' + anchor + '">\n')
404 self.f.write('<div class="section-header block-header">Section: ' +
406 self.f.write('<div class="section-content block-content">\n')
424 if (not self.blocks) or (marker != self.blocks[-1]):
430 delta_section = timestamp_now - timestamp_section_start
432 "TIME: SINCE-SECTION: " + str(delta_section))
434 self.f.write('<div class="section-trailer block-trailer">' +
436 self.f.write('</div>\n')
437 self.f.write('</div>\n')
462 """Write an error note to the log file.
474 """Write an warning note to the log file.
501 """Write an informational note to the log file.
513 """Write an action note to the log file.
528 """Write a timestamp to the log file.
538 delta_prev = timestamp_now - self.timestamp_prev
539 delta_start = timestamp_now - self.timestamp_start
545 "TIME: SINCE-PREV: " + str(delta_prev))
547 "TIME: SINCE-START: " + str(delta_start))
550 """Write a note to the log file describing test(s) which passed.
560 self._note("status-pass", msg, anchor)
563 """Write a note to the log file describing test(s) which passed.
573 self._note("status-warning", msg, anchor)
576 """Write a note to the log file describing skipped test(s).
586 self._note("status-skipped", msg, anchor)
589 """Write a note to the log file describing xfailed test(s).
599 self._note("status-xfail", msg, anchor)
602 """Write a note to the log file describing xpassed test(s).
612 self._note("status-xpass", msg, anchor)
615 """Write a note to the log file describing failed test(s).
625 self._note("status-fail", msg, anchor)
628 """Create an object to log a single stream's data into the log file.
630 This creates a "file-like" object that can be written to in order to
631 write a single stream's data to the log file. The implementation will
632 handle any required interleaving of data (from multiple streams) in
633 the log, in a way that makes it obvious which stream each bit of data
638 chained_file: The file-like object to which all stream data should
642 A file-like object.
651 name: The name of this sub-process.
652 chained_file: The file-like object to which all stream data should
661 def write(self, stream, data, implicit=False): argument
662 """Write stream data into the log file.
668 stream: The stream whose data is being logged.
669 data: The data to log.
670 implicit: Boolean indicating whether data actually appeared in the
671 stream, or was implicitly generated. A valid use-case is to
682 self.f.write('<div class="stream block">\n')
683 self.f.write('<div class="stream-header block-header">Stream: ' +
685 self.f.write('<div class="stream-content block-content">\n')
686 self.f.write('<pre>')
688 self.f.write('<span class="implicit">')
689 self.f.write(self._escape(data))
691 self.f.write('</span>')