aboutsummaryrefslogtreecommitdiff
path: root/test cases/failing test
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-02-27 07:25:33 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-03-02 09:07:54 +0100
commit91f847d308b57adec89245308b60ae063026b456 (patch)
treec81abbf9cc46c75322f5838cea7ed1492733c8ad /test cases/failing test
parentf2e513791e56886a145a8e72854841b9f9122ca6 (diff)
downloadmeson-91f847d308b57adec89245308b60ae063026b456.zip
meson-91f847d308b57adec89245308b60ae063026b456.tar.gz
meson-91f847d308b57adec89245308b60ae063026b456.tar.bz2
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.
Diffstat (limited to 'test cases/failing test')
-rw-r--r--test cases/failing test/5 tap tests/meson.build6
-rw-r--r--test cases/failing test/5 tap tests/tester.c10
2 files changed, 16 insertions, 0 deletions
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 <stdio.h>
+
+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;
+}