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>
pull/8322/head
Paolo Bonzini 4 years ago
parent 8b94aa578a
commit b1a9578091
  1. 11
      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)

Loading…
Cancel
Save