diff options
| author | Hemmo Nieminen <hemmo.nieminen@iki.fi> | 2022-02-01 00:00:00 +0200 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-06-09 18:58:33 -0400 |
| commit | 657a6eeb81158e0faaf8ab07e47a4ed62d4ae338 (patch) | |
| tree | 27e56f58d2f22879d3fc5041fd08a449a264a8a7 | |
| parent | 4304df30c2be2b0553d2e78524e90cd1918292b4 (diff) | |
| download | meson-657a6eeb81158e0faaf8ab07e47a4ed62d4ae338.tar.gz | |
mtest: enable access to the console logger instance
Store a reference to the console logger instance in a test harness'
member variable to allow accessing it (and its logging utilities) from
any other functions in test harness.
This added functionality will be used in future commits.
| -rw-r--r-- | mesonbuild/mtest.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 32c741733..4e8fcc9e2 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -485,7 +485,6 @@ class ConsoleLogger(TestLogger): RTRI = "\u25B6 " def __init__(self) -> None: - self.update = asyncio.Event() self.running_tests = OrderedSet() # type: OrderedSet['TestRun'] self.progress_test = None # type: T.Optional['TestRun'] self.progress_task = None # type: T.Optional[asyncio.Future] @@ -567,7 +566,6 @@ class ConsoleLogger(TestLogger): while not self.stop: await self.update.wait() self.update.clear() - # We may get here simply because the progress line has been # overwritten, so do not always switch. Only do so every # second, or if the printed test has finished @@ -1515,7 +1513,8 @@ class TestHarness: self.name_max_len = 0 self.is_run = False self.loggers = [] # type: T.List[TestLogger] - self.loggers.append(ConsoleLogger()) + self.console_logger = ConsoleLogger() + self.loggers.append(self.console_logger) self.need_console = False self.logfile_base = None # type: T.Optional[str] @@ -1550,6 +1549,10 @@ class TestHarness: ss.add(s) self.suites = list(ss) + def get_console_logger(self) -> 'ConsoleLogger': + assert self.console_logger + return self.console_logger + def load_tests(self, file_name: str) -> T.List[TestSerialisation]: datafile = Path('meson-private') / file_name if not datafile.is_file(): @@ -1567,6 +1570,7 @@ class TestHarness: def close_logfiles(self) -> None: for l in self.loggers: l.close() + self.console_logger = None def get_test_setup(self, test: T.Optional[TestSerialisation]) -> build.TestSetup: if ':' in self.options.setup: |
