diff options
author | Luke Drummond <ldrumm@rtps.co> | 2021-02-18 19:54:55 +0000 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2021-02-20 15:38:09 +0530 |
commit | bc19b12a577e58bf63f5576298f4b9593d13056c (patch) | |
tree | a988a8cdc75a15ec934ff1ba73cd36607e956b65 | |
parent | a0dc97f8fc897dc5a9c38fb24f72aa4db0f6a6cf (diff) | |
download | meson-bc19b12a577e58bf63f5576298f4b9593d13056c.zip meson-bc19b12a577e58bf63f5576298f4b9593d13056c.tar.gz meson-bc19b12a577e58bf63f5576298f4b9593d13056c.tar.bz2 |
Fix TAP parser when test exits with status
Some time between 0.56 and 0.57 the TAP parser broke when a test exits
with a nonzero status.
The TAP protocol does not specify this behaviour - giving latitude to
implementers, and meson's previous behaviour was to report the exit
status gracefully.
This patch restores the old behaviour and adds a regression test
-rw-r--r-- | mesonbuild/mtest.py | 1 | ||||
-rw-r--r-- | test cases/failing test/5 tap tests/meson.build | 4 | ||||
-rw-r--r-- | test cases/failing test/5 tap tests/tester_with_status.c | 8 |
3 files changed, 12 insertions, 1 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 95ad77b..d5bcf94 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -1004,6 +1004,7 @@ class TestRunTAP(TestRun): stdo: str, stde: str) -> None: if returncode != 0 and not res.was_killed(): res = TestResult.ERROR + stde = stde or '' stde += '\n(test program exited with status code {})'.format(returncode,) super().complete(returncode, res, stdo, stde) diff --git a/test cases/failing test/5 tap tests/meson.build b/test cases/failing test/5 tap tests/meson.build index c49043b..664ac34 100644 --- a/test cases/failing test/5 tap tests/meson.build +++ b/test cases/failing test/5 tap tests/meson.build @@ -1,7 +1,9 @@ project('test features', 'c') tester = executable('tester', 'tester.c') -test('nonzero return code', tester, args : [], protocol: 'tap') +test_with_status = executable('test-with-status', 'tester_with_status.c') +test('nonzero return code no tests', tester, args : [], protocol: 'tap') +test('nonzero return code with tests', test_with_status, protocol: 'tap') test('missing test', tester, args : ['1..1'], protocol: 'tap') test('incorrect skip', tester, args : ['1..1 # skip\nok 1'], protocol: 'tap') test('partially skipped', tester, args : ['not ok 1\nok 2 # skip'], protocol: 'tap') diff --git a/test cases/failing test/5 tap tests/tester_with_status.c b/test cases/failing test/5 tap tests/tester_with_status.c new file mode 100644 index 0000000..7613afe --- /dev/null +++ b/test cases/failing test/5 tap tests/tester_with_status.c @@ -0,0 +1,8 @@ +#include <stdio.h> +#include <stdlib.h> + +int main(int argc, char **argv) { + puts("1..1"); + puts("not ok 1 - some test"); + return 2; +} |