diff --git a/lib/Test/Smoke/Reporter.pm b/lib/Test/Smoke/Reporter.pm index 707f037..1b06c71 100644 --- a/lib/Test/Smoke/Reporter.pm +++ b/lib/Test/Smoke/Reporter.pm @@ -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+//; diff --git a/lib/Test/Smoke/Smoker.pm b/lib/Test/Smoke/Smoker.pm index c6c8b2b..5c31044 100644 --- a/lib/Test/Smoke/Smoker.pm +++ b/lib/Test/Smoke/Smoker.pm @@ -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"; @@ -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; diff --git a/t/reporter.t b/t/reporter.t index d47954f..9412537 100644 --- a/t/reporter.t +++ b/t/reporter.t @@ -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'; @@ -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; diff --git a/t/smoker.t b/t/smoker.t index 985ef10..53b3f55 100644 --- a/t/smoker.t +++ b/t/smoker.t @@ -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}; @@ -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, <