diff --git a/test/py/conftest.py b/test/py/conftest.py index 09638e64a3..3012c8e495 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -129,10 +129,12 @@ def pytest_configure(config): ['make', o_opt, '-s', board_type + '_defconfig'], ['make', o_opt, '-s', '-j8'], ) - runner = log.get_runner('make', sys.stdout) - for cmd in cmds: - runner.run(cmd, cwd=source_dir) - runner.close() + with log.section('make'): + runner = log.get_runner('make', sys.stdout) + for cmd in cmds: + runner.run(cmd, cwd=source_dir) + runner.close() + log.status_pass('OK') class ArbitraryAttributeContainer(object): pass @@ -255,6 +257,7 @@ def u_boot_console(request): console.ensure_spawned() return console +anchors = {} tests_not_run = set() tests_failed = set() tests_xpassed = set() @@ -294,27 +297,33 @@ def cleanup(): if console: console.close() if log: - log.status_pass('%d passed' % len(tests_passed)) - if tests_skipped: - log.status_skipped('%d skipped' % len(tests_skipped)) - for test in tests_skipped: - log.status_skipped('... ' + test) - if tests_xpassed: - log.status_xpass('%d xpass' % len(tests_xpassed)) - for test in tests_xpassed: - log.status_xpass('... ' + test) - if tests_xfailed: - log.status_xfail('%d xfail' % len(tests_xfailed)) - for test in tests_xfailed: - log.status_xfail('... ' + test) - if tests_failed: - log.status_fail('%d failed' % len(tests_failed)) - for test in tests_failed: - log.status_fail('... ' + test) - if tests_not_run: - log.status_fail('%d not run' % len(tests_not_run)) - for test in tests_not_run: - log.status_fail('... ' + test) + with log.section('Status Report', 'status_report'): + log.status_pass('%d passed' % len(tests_passed)) + if tests_skipped: + log.status_skipped('%d skipped' % len(tests_skipped)) + for test in tests_skipped: + anchor = anchors.get(test, None) + log.status_skipped('... ' + test, anchor) + if tests_xpassed: + log.status_xpass('%d xpass' % len(tests_xpassed)) + for test in tests_xpassed: + anchor = anchors.get(test, None) + log.status_xpass('... ' + test, anchor) + if tests_xfailed: + log.status_xfail('%d xfail' % len(tests_xfailed)) + for test in tests_xfailed: + anchor = anchors.get(test, None) + log.status_xfail('... ' + test, anchor) + if tests_failed: + log.status_fail('%d failed' % len(tests_failed)) + for test in tests_failed: + anchor = anchors.get(test, None) + log.status_fail('... ' + test, anchor) + if tests_not_run: + log.status_fail('%d not run' % len(tests_not_run)) + for test in tests_not_run: + anchor = anchors.get(test, None) + log.status_fail('... ' + test, anchor) log.close() atexit.register(cleanup) @@ -380,7 +389,7 @@ def pytest_runtest_setup(item): Nothing. """ - log.start_section(item.name) + anchors[item.name] = log.start_section(item.name) setup_boardspec(item) setup_buildconfigspec(item) diff --git a/test/py/multiplexed_log.css b/test/py/multiplexed_log.css index f6240d52da..f135b10a24 100644 --- a/test/py/multiplexed_log.css +++ b/test/py/multiplexed_log.css @@ -25,37 +25,24 @@ pre { color: #808080; } -.section { +.block { border-style: solid; border-color: #303030; border-width: 0px 0px 0px 5px; padding-left: 5px } -.section-header { +.block-header { background-color: #303030; margin-left: -5px; margin-top: 5px; } -.section-trailer { - display: none; +.block-header:hover { + text-decoration: underline; } -.stream { - border-style: solid; - border-color: #303030; - border-width: 0px 0px 0px 5px; - padding-left: 5px -} - -.stream-header { - background-color: #303030; - margin-left: -5px; - margin-top: 5px; -} - -.stream-trailer { +.block-trailer { display: none; } @@ -94,3 +81,21 @@ pre { .status-fail { color: #ff0000 } + +.hidden { + display: none; +} + +a:link { + text-decoration: inherit; + color: inherit; +} + +a:visited { + text-decoration: inherit; + color: inherit; +} + +a:hover { + text-decoration: underline; +} diff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py index 69a577e577..68917eb0ea 100644 --- a/test/py/multiplexed_log.py +++ b/test/py/multiplexed_log.py @@ -168,12 +168,13 @@ class SectionCtxMgr(object): Objects of this type should be created by factory functions in the Logfile class rather than directly.""" - def __init__(self, log, marker): + def __init__(self, log, marker, anchor): """Initialize a new object. Args: log: The Logfile object to log to. marker: The name of the nested log section. + anchor: The anchor value to pass to start_section(). Returns: Nothing. @@ -181,9 +182,10 @@ class SectionCtxMgr(object): self.log = log self.marker = marker + self.anchor = anchor def __enter__(self): - self.log.start_section(self.marker) + self.anchor = self.log.start_section(self.marker, self.anchor) def __exit__(self, extype, value, traceback): self.log.end_section(self.marker) @@ -206,11 +208,70 @@ class Logfile(object): self.last_stream = None self.blocks = [] self.cur_evt = 1 + self.anchor = 0 + shutil.copy(mod_dir + '/multiplexed_log.css', os.path.dirname(fn)) self.f.write('''\
+ + @@ -273,45 +334,60 @@ class Logfile(object): if not self.last_stream: return self.f.write('\n') - self.f.write('') + self.f.write('\n') + if anchor: + self.f.write('\n') + self.f.write('\n') + if anchor: + self.f.write('\n' % anchor) + self.f.write('\n') + self.f.write('\n') self.f.write(self._escape(msg)) - self.f.write('\n
')
if implicit:
self.f.write('')
diff --git a/test/py/u_boot_console_exec_attach.py b/test/py/u_boot_console_exec_attach.py
index 19520cb3b9..1be27c1930 100644
--- a/test/py/u_boot_console_exec_attach.py
+++ b/test/py/u_boot_console_exec_attach.py
@@ -35,11 +35,13 @@ class ConsoleExecAttach(ConsoleBase):
# HW flow control would mean this could be infinite.
super(ConsoleExecAttach, self).__init__(log, config, max_fifo_fill=16)
- self.log.action('Flashing U-Boot')
- cmd = ['u-boot-test-flash', config.board_type, config.board_identity]
- runner = self.log.get_runner(cmd[0], sys.stdout)
- runner.run(cmd)
- runner.close()
+ with self.log.section('flash'):
+ self.log.action('Flashing U-Boot')
+ cmd = ['u-boot-test-flash', config.board_type, config.board_identity]
+ runner = self.log.get_runner(cmd[0], sys.stdout)
+ runner.run(cmd)
+ runner.close()
+ self.log.status_pass('OK')
def get_spawn(self):
"""Connect to a fresh U-Boot instance.