Skip to content

gtestutils: Make --tap compatible with -p and --GTestSkipCount

Simon McVittie requested to merge smcv/glib:tap-skip into master

The -p option is documented, and can be used to select and repeat test-cases. This is particularly useful when debugging a single failure among a large number of test-cases, or when debugging a test-case that you suspect influences another test-case by leaking global state.

Until now, -p was only supported with GLib's default (GLib-specific) textual output format, and not with the standardized TAP format that we are now encouraging. If we are considering making TAP the new default (see #1619 (closed)) it should get feature-equivalence with the current default.

Because -p allows test-cases to be re-ordered and repeated, and an entry in the test_paths list can match any number of test-cases (including zero), we don't know ahead of time how many test-cases we are going to run. TAP allows the "plan" to be deferred to the end, exactly to support situations like this.

The undocumented --GTestSkipCount option is internal to the deprecated gtester tool and rather obscure, but it's straightforward to support by making G_TEST_LOG_SKIP_CASE produce TAP output similar to what already happened when we emitted G_TEST_LOG_STOP_CASE with result G_TEST_RUN_SKIPPED. I might as well do that while I'm looking at the interaction between the --tap, -p and -s options.

This MR also adds a regression test for the combination of --tap and -s, which was not previously tested.

Edited by Simon McVittie

Merge request reports