diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2021-01-14 10:19:40 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-01-15 10:03:54 +0100 |
commit | 401464c61a7dce3819539398a59ff3fcce88d0ca (patch) | |
tree | ef6a0aa11c09d05d9f44f81eb0ea5f42d95f5281 /mesonbuild/mtest.py | |
parent | 90ea0dc5835426c61a002b78a9691b451e055342 (diff) | |
download | meson-401464c61a7dce3819539398a59ff3fcce88d0ca.zip meson-401464c61a7dce3819539398a59ff3fcce88d0ca.tar.gz meson-401464c61a7dce3819539398a59ff3fcce88d0ca.tar.bz2 |
mtest: tweak the gathering of stdo_task/stde_task results
After the next patch, we will need to complete parse_task before
stdo_task (because parse_task will not set the "stdo" variable
anymore but it will still collect stdout just like now). Do
the change now to isolate the more complicated changes.
Diffstat (limited to 'mesonbuild/mtest.py')
-rw-r--r-- | mesonbuild/mtest.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index f112177..300eb11 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -147,6 +147,13 @@ def print_safe(s: str) -> None: s = s.encode('ascii', errors='backslashreplace').decode('ascii') print(s) +def join_lines(a: str, b: str) -> str: + if not a: + return b + if not b: + return a + return a + '\n' + b + def returncode_to_status(retcode: int) -> str: # Note: We can't use `os.WIFSIGNALED(result.returncode)` and the related # functions here because the status returned by subprocess is munged. It @@ -1266,20 +1273,18 @@ class SingleTestRunner: returncode, result, additional_error = await p.wait(self.runobj.timeout) - if stdo_task is not None: - stdo = decode(await stdo_task) - if stde_task is not None: - stde = decode(await stde_task) - - if additional_error is not None: - stde += '\n' + additional_error - if parse_task is not None: res, error = await parse_task if error: - stde += '\n' + error + additional_error = join_lines(additional_error, error) result = result or res + if stdo_task is not None: + stdo = decode(await stdo_task) + if stde_task is not None: + stde = decode(await stde_task) + + stde = join_lines(stde, additional_error) self.runobj.complete(returncode, result, stdo, stde) |