Skip to content

Commit c1bc974

Browse files
pks-tgitster
authored andcommitted
meson: parse TAP output generated by our tests
By default, Meson only knows to pay respect to the exit code of tests to judge whether or not it ran successfully. This can be changed though by specifying the "protocol" parameter. Next to the default "exitcode" protocol, Meson also supports the "tap" output that our tests already know to generate. Unfortunately, the "tap" protocol was incompatible with `meson test --interactive` and caused a hang. We have upstreamed a fix [1] though, so with the recent release of Meson 1.8 that fix is finally out and we can start using the "tap" protocol when running with a recent-enough version of this build tool. With this change in place, Meson now properly detects how many subtests ran and whether test suites have been skipped: ``` $ meson test t002* ninja: Entering directory `/home/pks/Development/git/build' 1/10 t0024-crlf-archive OK 0.17s 2 subtests passed 2/10 t0022-crlf-rename OK 0.18s 2 subtests passed 3/10 t0029-core-unsetenvvars SKIP 0.15s 4/10 t0023-crlf-am OK 0.18s 2 subtests passed 5/10 t0025-crlf-renormalize OK 0.21s 3 subtests passed 6/10 t0026-eol-config OK 0.25s 5 subtests passed 7/10 t0020-crlf OK 0.81s 36 subtests passed 8/10 t0028-working-tree-encoding OK 0.85s 22 subtests passed 9/10 t0021-conversion OK 3.45s 38 subtests passed 10/10 t0027-auto-crlf OK 26.35s 2600 subtests passed Ok: 9 Fail: 0 Skipped: 1 ``` Note that when running `meson test --interactive` the test results will now be marked as "ignored". This is because in interactive mode the file descriptors will remain connected to the user's terminal, and it is expected that the user interacts with the tests (e.g., spawn a debugger or use `test_pause`). As such, the TAP output cannot be parsed reliably by Meson in that case, so the tests are marked as ignored accordingly. [1]: mesonbuild/meson#13980 Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b44e63f commit c1bc974

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

meson.build

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,6 +2040,14 @@ if get_option('tests')
20402040
'timeout': 0,
20412041
}
20422042

2043+
# The TAP protocol was already understood by previous versions of Meson, but
2044+
# it was incompatible with the `meson test --interactive` flag.
2045+
if meson.version().version_compare('>=1.8.0')
2046+
test_kwargs += {
2047+
'protocol': 'tap',
2048+
}
2049+
endif
2050+
20432051
subdir('t')
20442052
endif
20452053

0 commit comments

Comments
 (0)