Skip to content

Commit

Permalink
build: Workaround Tap::Harness verbose misbehavior on parallel mode
Browse files Browse the repository at this point in the history
The Tap::Harness module misbehaves when enabling both parallel and
verbose mode, where the verbose output is eaten by some concurrency
statistics output, and only the last test output is emitted.

We set the formatter_class explicitly to the file formatter in case we
are running in verbose and parallel modes as a workaround.

Ref: Perl-Toolchain-Gang/Test-Harness#105
  • Loading branch information
guillemj committed Jul 3, 2024
1 parent f240776 commit deb4cfe
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions build-aux/test-runner
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ $ENV{LC_ALL} = 'C';
$ENV{DPKG_COLORS} = 'never';
$ENV{PATH} = "$binroot/src:$binroot/scripts:$binroot/utils:$ENV{PATH}";

my %options;
# XXX: We need force the file formatter to workaround verbose + parallel
# not working correctly, as the console formatter eats the test output,
# see <https://github.com/Perl-Toolchain-Gang/Test-Harness/issues/105>.
if ($ENV{TEST_VERBOSE} && $ENV{TEST_PARALLEL} > 1) {
$options{formatter_class} = 'TAP::Formatter::File';
}

my $harness = TAP::Harness->new({
exec => sub {
my (undef, $test) = @_;
Expand All @@ -27,6 +35,7 @@ my $harness = TAP::Harness->new({
verbosity => $ENV{TEST_VERBOSE},
jobs => $ENV{TEST_PARALLEL},
failures => 1,
%options,
});

my $aggregate = $harness->runtests(@ARGV);
Expand Down

0 comments on commit deb4cfe

Please sign in to comment.