Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Test/Smoke/Reporter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ sub _parse {
next;
}

if (/^\s+(?:Bad plan)|(?:No plan found)|^\s+(?:Non-zero exit status)/) {
if (/^\s+(?:Bad plan)|(?:No plan found)|^\s+(?:Non-zero (?:exit|wait) status)/) {
if (ref $rpt{$cfgarg}->{$debug}{$tstenv}{failed}) {
push @{$rpt{$cfgarg}->{$debug}{$tstenv}{failed}}, $_;
s/^\s+//;
Expand Down
4 changes: 2 additions & 2 deletions lib/Test/Smoke/Smoker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ sub _run_harness3_target {
next;
}

my( $exit_status ) = $line =~ /^ (Non-zero exit status: .+)/;
my( $exit_status ) = $line =~ /^ (Non-zero (?:exit|wait) status: .+)/;
if ( $exit_status ) {
$self->log_debug("[died test] $file");
push @failed, "${file}FAILED\n";
Expand Down Expand Up @@ -980,7 +980,7 @@ sub _parse_harness3_output {
my( $todo ) = $line =~ /$harness3_todo/x;
my( $extra ) = $line =~ /$harness3_extra/x;
my( $parse_error ) = $line =~ /^ Parse errors: (.+)/;
my( $exit_status ) = $line =~ /^ (Non-zero exit status: .+)/;
my( $exit_status ) = $line =~ /^ (Non-zero (?:exit|wait) status: .+)/;

if ( $tname ) {
my $r;
Expand Down
50 changes: 49 additions & 1 deletion t/reporter.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use File::Copy;
my $verbose = exists $ENV{SMOKE_VERBOSE} ? $ENV{SMOKE_VERBOSE} : 0;
my $showcfg = 0;

use Test::More tests => 691;
use Test::More tests => 694;

use_ok 'Test::Smoke::Reporter';

Expand Down Expand Up @@ -1867,6 +1867,54 @@ __EOFAIL__
# diag $reporter->report;
}

{ # Test that 'Non-zero wait status' (signal kill) is parsed like 'Non-zero exit status'
# (GitHub issue #8 / abeltje#72)
create_config_sh( $config_sh, version => '5.11.2' );

my $reporter = Test::Smoke::Reporter->new(
ddir => $findbin,
v => $verbose,
outfile => '',
showcfg => $showcfg,
cfg => \( my $bcfg = <<__EOCFG__ ),
-Dcc=/opt/perl/ccache/gcc
__EOCFG__
);
isa_ok( $reporter, 'Test::Smoke::Reporter' );

$reporter->read_parse( \(my $result = <<'EORESULTS') );
Started smoke at 1258883807
Smoking patch 20000

Stopped smoke at 1258883808
Started smoke at 1258883808

Configuration: -Dusedevel -Dcc=/opt/perl/ccache/gcc
------------------------------------------------------------------------------
TSTENV = stdio u=0.37 s=0.00 cu=3.34 cs=0.10 scripts=5 tests=13349

../t/re/pat_advanced.t......................................FAILED
Non-zero wait status: 9
../t/re/pat_advanced.t......................................FAILED
No plan found in TAP output

Finished smoking 20000
Stopped smoke at 1258883821
EORESULTS

my $cfgarg = "-Dcc=/opt/perl/ccache/gcc";
is( $reporter->{_rpt}{$cfgarg}{summary}{N}{stdio}, "F",
"'Non-zero wait status' causes fail summary" );

my @f_lines = split /\n/, $reporter->failures;
is_deeply \@f_lines, [split /\n/, <<'__EOFAIL__'], "Non-zero wait status included in failures report";
[stdio]
../t/re/pat_advanced.t......................................FAILED
Non-zero wait status: 9
No plan found in TAP output
__EOFAIL__
}

{ # Test the grepccmsg() feature
my $testdir = catdir $findbin, 'perl-current';
mkpath $testdir;
Expand Down
37 changes: 36 additions & 1 deletion t/smoker.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use Cwd;
use lib 't';
use TestLib;

use Test::More tests => 76;
use Test::More tests => 79;
use_ok( 'Test::Smoke::Smoker' );

my $debug = exists $ENV{SMOKE_DEBUG} && $ENV{SMOKE_DEBUG};
Expand Down Expand Up @@ -930,6 +930,41 @@ SKIP: {
rmtree $dst, $verbose;
}

{
# Test signal-killed test: 'Non-zero wait status' must be captured
# (GitHub issue #8 / abeltje#72)
my $smoker = Test::Smoke::Smoker->new( \*LOG, v => $verbose );
isa_ok $smoker, 'Test::Smoke::Smoker';
my @harness3_test = split m/\n/, <<'EOHO';
re/pat_advanced.t .. Dubious, test returned with signal 9

Test Summary Report
-------------------
re/pat_advanced.t (Wstat: 9 (Signal: KILL) Tests: 1635 Failed: 0)
Non-zero wait status: 9
Parse errors: No plan found in TAP output
Files=1, Tests=1635, 0 wallclock secs
Result: FAIL
EOHO

my %inconsistent = map +( $_ => 1 ) => grep length $_ => map {
m/(\S+\.t)\s+/ ? "../t/$1" : ''
} @harness3_test;

my $all_ok;
my $harness_out = $smoker->_parse_harness_output( \%inconsistent, $all_ok,
@harness3_test );

is $all_ok, undef, "Signal-killed test detected as failed";
is $harness_out, <<EOOUT, "Non-zero wait status captured for signal-killed test";
../t/re/pat_advanced.t......................................FAILED
Non-zero wait status: 9
../t/re/pat_advanced.t......................................FAILED
No plan found in TAP output
EOOUT
}


sub mkargs {
my( $set, $default ) = @_;

Expand Down