diff options
-rw-r--r-- | selftest/Subunit/Filter.pm | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/selftest/Subunit/Filter.pm b/selftest/Subunit/Filter.pm index 3c226958bd..896721a67b 100644 --- a/selftest/Subunit/Filter.pm +++ b/selftest/Subunit/Filter.pm @@ -100,6 +100,10 @@ sub end_test($$$$$) $self->{fail_added}++; } + if ($result eq "error") { + $self->{error_added}++; + } + if ($self->{strip_ok_output}) { unless ($result eq "success" or $result eq "xfail" or $result eq "skip") { print $self->{output} @@ -120,6 +124,7 @@ sub start_testsuite($;$) { my ($self, $name) = @_; Subunit::start_testsuite($name); + $self->{error_added} = 0; $self->{fail_added} = 0; $self->{xfail_added} = 0; } @@ -127,11 +132,28 @@ sub start_testsuite($;$) sub end_testsuite($$;$) { my ($self, $name, $result, $reason) = @_; - if ($self->{fail_added} == 0 and $self->{xfail_added} and - ($result eq "fail" or $result eq "failure")) { + my $xfail = 0; + + $xfail = 1 if ($self->{xfail_added} > 0); + $xfail = 0 if ($self->{fail_added} > 0); + $xfail = 0 if ($self->{error_added} > 0); + + if ($xfail and ($result eq "fail" or $result eq "failure")) { $result = "xfail"; } + if ($self->{fail_added} > 0 and $result ne "failure") { + $result = "failure"; + $reason = "Subunit/Filer Reason" unless defined($reason); + $reason .= "\n failures[$self->{fail_added}]"; + } + + if ($self->{error_added} > 0 and $result ne "error") { + $result = "error"; + $reason = "Subunit/Filer Reason" unless defined($reason); + $reason .= "\n errors[$self->{error_added}]"; + } + Subunit::end_testsuite($name, $result, $reason); } |