svn commit: samba r25466 - in branches/SAMBA_4_0/source/selftest: .

metze at samba.org metze at samba.org
Tue Oct 2 15:54:26 GMT 2007


Author: metze
Date: 2007-10-02 15:54:26 +0000 (Tue, 02 Oct 2007)
New Revision: 25466

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25466

Log:
fix calculation of $expected_ret, when there're
some expected and some unexpected failures within
one testsuite.

metze
Modified:
   branches/SAMBA_4_0/source/selftest/Subunit.pm
   branches/SAMBA_4_0/source/selftest/selftest.pl


Changeset:
Modified: branches/SAMBA_4_0/source/selftest/Subunit.pm
===================================================================
--- branches/SAMBA_4_0/source/selftest/Subunit.pm	2007-10-02 15:53:26 UTC (rev 25465)
+++ branches/SAMBA_4_0/source/selftest/Subunit.pm	2007-10-02 15:54:26 UTC (rev 25466)
@@ -9,7 +9,10 @@
 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 @@
 				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 @@
 				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 @@
 				$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 @@
 	}
 
 	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;

Modified: branches/SAMBA_4_0/source/selftest/selftest.pl
===================================================================
--- branches/SAMBA_4_0/source/selftest/selftest.pl	2007-10-02 15:53:26 UTC (rev 25465)
+++ branches/SAMBA_4_0/source/selftest/selftest.pl	2007-10-02 15:54:26 UTC (rev 25466)
@@ -248,6 +248,7 @@
 		$msg_ops, $msg_state, $statistics, *RESULT, \&expecting_failure);
 
 	my $ret = close(RESULT);
+	$ret = 0 unless $ret == 1;
 
 	cleanup_pcap($msg_state, $expected_ret, $ret);
 



More information about the samba-cvs mailing list