diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-10-02 15:54:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:07:42 -0500 |
commit | 37d63aab72b1e40577d61a87eab214601eaf82d2 (patch) | |
tree | dab529ad729a1b850711bba170e6c02b905060df /source4/selftest | |
parent | 00d2a195547f639b631f95431edc1484a0acd9de (diff) | |
download | samba-37d63aab72b1e40577d61a87eab214601eaf82d2.tar.gz samba-37d63aab72b1e40577d61a87eab214601eaf82d2.tar.bz2 samba-37d63aab72b1e40577d61a87eab214601eaf82d2.zip |
r25466: fix calculation of $expected_ret, when there're
some expected and some unexpected failures within
one testsuite.
metze
(This used to be commit ca2a07c71fd5aa2446c0c292b4b058acc0b54838)
Diffstat (limited to 'source4/selftest')
-rw-r--r-- | source4/selftest/Subunit.pm | 22 | ||||
-rwxr-xr-x | source4/selftest/selftest.pl | 1 |
2 files changed, 18 insertions, 5 deletions
diff --git a/source4/selftest/Subunit.pm b/source4/selftest/Subunit.pm index 1be412c356..2ecafb42d0 100644 --- a/source4/selftest/Subunit.pm +++ b/source4/selftest/Subunit.pm @@ -9,7 +9,10 @@ use strict; sub parse_results($$$$$) { my ($msg_ops, $msg_state, $statistics, $fh, $expecting_failure) = @_; - my $expected_ret = 1; + my $unexpected_ok = 0; + my $expected_fail = 0; + my $unexpected_fail = 0; + my $unexpected_err = 0; my $open_tests = {}; while(<$fh>) { @@ -34,6 +37,7 @@ sub parse_results($$$$$) if ($expecting_failure->("$msg_state->{NAME}/$2")) { $statistics->{TESTS_UNEXPECTED_OK}++; $msg_ops->end_test($msg_state, $2, $1, 1, $reason); + $unexpected_ok++; } else { $statistics->{TESTS_EXPECTED_OK}++; $msg_ops->end_test($msg_state, $2, $1, 0, $reason); @@ -43,10 +47,11 @@ sub parse_results($$$$$) if ($expecting_failure->("$msg_state->{NAME}/$2")) { $statistics->{TESTS_EXPECTED_FAIL}++; $msg_ops->end_test($msg_state, $2, $1, 0, $reason); - $expected_ret = 0; + $expected_fail++; } else { $statistics->{TESTS_UNEXPECTED_FAIL}++; $msg_ops->end_test($msg_state, $2, $1, 1, $reason); + $unexpected_fail++; } } elsif ($1 eq "skip") { $statistics->{TESTS_SKIP}++; @@ -56,6 +61,7 @@ sub parse_results($$$$$) $statistics->{TESTS_ERROR}++; delete $open_tests->{$2}; $msg_ops->end_test($msg_state, $2, $1, 1, $reason); + $unexpected_err++; } } else { $msg_ops->output_msg($msg_state, $_); @@ -63,12 +69,18 @@ sub parse_results($$$$$) } foreach (keys %$open_tests) { - $msg_ops->end_test($msg_state, $_, "error", 1, - "was started but never finished!"); + $msg_ops->end_test($msg_state, $_, "error", 1, + "was started but never finished!"); $statistics->{TESTS_ERROR}++; + $unexpected_err++; } - return $expected_ret; + return 1 if $unexpected_err > 0; + return 1 if $unexpected_fail > 0; + return 1 if $unexpected_ok > 0 and $expected_fail > 0; + return 0 if $unexpected_ok > 0 and $expected_fail == 0; + return 0 if $expected_fail > 0; + return 1; } 1; diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index 231fd1e4c0..a88e97e01e 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -248,6 +248,7 @@ sub run_testsuite($$$$$$$) $msg_ops, $msg_state, $statistics, *RESULT, \&expecting_failure); my $ret = close(RESULT); + $ret = 0 unless $ret == 1; cleanup_pcap($msg_state, $expected_ret, $ret); |