aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2021-02-09 18:30:07 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2021-02-09 18:50:21 +0100
commitb1a9578091ad869be2bddaa381ce9092f178840c (patch)
tree0eeb9036635b1a953bdaac076980b88a24e489d7
parent8b94aa578a64bfad268c331a06ba0c0976c1383d (diff)
downloadmeson-b1a9578091ad869be2bddaa381ce9092f178840c.zip
meson-b1a9578091ad869be2bddaa381ce9092f178840c.tar.gz
meson-b1a9578091ad869be2bddaa381ce9092f178840c.tar.bz2
mtest: run the test output parser as a task
Start the parsing of the output early; this avoids a deadlock if the test writes to stdout but no one reads from it. It also reports TAP or Rust subtest results as they happen, which was the intention all along. While at it, use a consistent naming conventions for coroutines vs tasks. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--mesonbuild/mtest.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index d580c7e..1d7c6cc 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -1164,11 +1164,11 @@ class TestSubprocess:
# asyncio.ensure_future ensures that printing can
# run in the background, even before it is awaited
if self.stdo_task is None and self.stdout is not None:
- decode_task = read_decode(self._process.stdout, console_mode)
- self.stdo_task = asyncio.ensure_future(decode_task)
+ decode_coro = read_decode(self._process.stdout, console_mode)
+ self.stdo_task = asyncio.ensure_future(decode_coro)
if self.stderr is not None and self.stderr != asyncio.subprocess.STDOUT:
- decode_task = read_decode(self._process.stderr, console_mode)
- self.stde_task = asyncio.ensure_future(decode_task)
+ decode_coro = read_decode(self._process.stderr, console_mode)
+ self.stde_task = asyncio.ensure_future(decode_coro)
return self.stdo_task, self.stde_task
@@ -1383,7 +1383,8 @@ class SingleTestRunner:
parse_task = None
if self.runobj.needs_parsing:
- parse_task = self.runobj.parse(harness, p.stdout_lines(self.console_mode))
+ parse_coro = self.runobj.parse(harness, p.stdout_lines(self.console_mode))
+ parse_task = asyncio.ensure_future(parse_coro)
stdo_task, stde_task = p.communicate(self.console_mode)
returncode, result, additional_error = await p.wait(self.runobj.timeout)