From 91f847d308b57adec89245308b60ae063026b456 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 27 Feb 2019 07:25:33 +0100 Subject: mtest: implement TAP parsing This provides an initial support for parsing TAP output. It detects failures and skipped tests without relying on exit code, as well as early termination of the test due to an error or a crash. For now, subtests are not recorded in the TestRun object. However, because the TAP output goes on stdout, it is printed by --print-errorlogs when a test does not behave as expected. Handling subtests as TestRuns, and serializing them to JSON, can be added later. The parser was written specifically for Meson, and comes with its own test suite. Fixes #2923. --- test cases/failing test/5 tap tests/meson.build | 6 ++++++ test cases/failing test/5 tap tests/tester.c | 10 ++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test cases/failing test/5 tap tests/meson.build create mode 100644 test cases/failing test/5 tap tests/tester.c (limited to 'test cases/failing test') diff --git a/test cases/failing test/5 tap tests/meson.build b/test cases/failing test/5 tap tests/meson.build new file mode 100644 index 0000000..844c1f9 --- /dev/null +++ b/test cases/failing test/5 tap tests/meson.build @@ -0,0 +1,6 @@ +project('test features', 'c') + +tester = executable('tester', 'tester.c') +test('nonzero return code', tester, args : [], protocol: 'tap') +test('missing test', tester, args : ['1..1'], protocol: 'tap') +test('incorrect skip', tester, args : ['1..1 # skip\nok 1'], protocol: 'tap') diff --git a/test cases/failing test/5 tap tests/tester.c b/test cases/failing test/5 tap tests/tester.c new file mode 100644 index 0000000..ac582e7 --- /dev/null +++ b/test cases/failing test/5 tap tests/tester.c @@ -0,0 +1,10 @@ +#include + +int main(int argc, char **argv) { + if (argc != 2) { + fprintf(stderr, "Incorrect number of arguments, got %i\n", argc); + return 1; + } + puts(argv[1]); + return 0; +} -- cgit v1.1