svn commit: samba r22337 - in branches/SAMBA_4_0/source/script/tests: .

metze at samba.org metze at samba.org
Wed Apr 18 14:02:26 GMT 2007


Author: metze
Date: 2007-04-18 14:02:26 +0000 (Wed, 18 Apr 2007)
New Revision: 22337

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

Log:
print out the smbd log output after each test

metze
Modified:
   branches/SAMBA_4_0/source/script/tests/Samba3.pm
   branches/SAMBA_4_0/source/script/tests/Samba4.pm
   branches/SAMBA_4_0/source/script/tests/selftest.pl


Changeset:
Modified: branches/SAMBA_4_0/source/script/tests/Samba3.pm
===================================================================
--- branches/SAMBA_4_0/source/script/tests/Samba3.pm	2007-04-18 13:28:04 UTC (rev 22336)
+++ branches/SAMBA_4_0/source/script/tests/Samba3.pm	2007-04-18 14:02:26 UTC (rev 22337)
@@ -39,6 +39,14 @@
 	return 0;
 }
 
+sub getlog_env($$)
+{
+	my ($self, $envvars) = @_;
+
+	# TODO...
+	return "";
+}
+
 sub setup_env($$$)
 {
 	my ($self, $envname, $path) = @_;
@@ -292,6 +300,8 @@
 	print "wait for smbd\n";
 	system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER_IP} -U% -p 139 | head -2");
 	system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER_IP} -U% -p 139 | head -2");
+
+	print $self->getlog_env($envvars);
 }
 
 1;

Modified: branches/SAMBA_4_0/source/script/tests/Samba4.pm
===================================================================
--- branches/SAMBA_4_0/source/script/tests/Samba4.pm	2007-04-18 13:28:04 UTC (rev 22336)
+++ branches/SAMBA_4_0/source/script/tests/Samba4.pm	2007-04-18 14:02:26 UTC (rev 22337)
@@ -141,6 +141,8 @@
 	system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER} $testenv_vars->{NETBIOSNAME}");
 	system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{NETBIOSNAME}");
 	system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER} $testenv_vars->{NETBIOSNAME}");
+
+	print $self->getlog_env($testenv_vars);
 }
 
 sub write_ldb_file($$$)
@@ -596,6 +598,7 @@
 
 	$ret->{SMBD_TEST_FIFO} = "$prefix/smbd_test.fifo";
 	$ret->{SMBD_TEST_LOG} = "$prefix/smbd_test.log";
+	$ret->{SMBD_TEST_LOG_POS} = 0;
 	return $ret;
 }
 
@@ -612,6 +615,7 @@
 
 	$ret->{SMBD_TEST_FIFO} = "$prefix/smbd_test.fifo";
 	$ret->{SMBD_TEST_LOG} = "$prefix/smbd_test.log";
+	$ret->{SMBD_TEST_LOG_POS} = 0;
 	return $ret;
 }
 
@@ -651,10 +655,30 @@
 	return $failed;
 }
 
+sub getlog_env($$)
+{
+	my ($self, $envvars) = @_;
+	my $title = "SMBD LOG of: $envvars->{NETBIOSNAME}\n";
+	my $out = $title;
+
+	open(LOG, "<$envvars->{SMBD_TEST_LOG}");
+
+	seek(LOG, $envvars->{SMBD_TEST_LOG_POS}, SEEK_SET);
+	while (<LOG>) {
+		$out .= $_;
+	}
+	$envvars->{SMBD_TEST_LOG_POS} = tell(LOG);
+	close(LOG);
+
+	return "" if $out eq $title;
+ 
+	return $out;
+}
+
 sub setup_env($$$)
 {
 	my ($self, $envname, $path) = @_;
-	
+
 	if ($envname eq "dc") {
 		return $self->setup_dc("$path/dc");
 	} elsif ($envname eq "member") {

Modified: branches/SAMBA_4_0/source/script/tests/selftest.pl
===================================================================
--- branches/SAMBA_4_0/source/script/tests/selftest.pl	2007-04-18 13:28:04 UTC (rev 22336)
+++ branches/SAMBA_4_0/source/script/tests/selftest.pl	2007-04-18 14:02:26 UTC (rev 22337)
@@ -174,6 +174,8 @@
 	return 0;
 }
 
+sub getlog_env($);
+
 my $test_output = {};
 
 sub buildfarm_start_msg($)
@@ -212,6 +214,8 @@
 		$out .= $test_output->{$state->{NAME}};
 	}
 
+	$out .= getlog_env($state->{ENVNAME});
+
 	$out .= "==========================================\n";
 	if ($ret == $expected_ret) {
 		$out .= "TEST PASSED: $state->{NAME}\n";
@@ -269,6 +273,8 @@
 	if ($ret != $expected_ret and ($opt_immediate or $opt_one) and not $opt_verbose) {
 		print $test_output->{$state->{NAME}}."\n";
 	}
+
+	print getlog_env($state->{ENVNAME});
 }
 
 my $plain_msg_ops = {
@@ -277,10 +283,11 @@
 	end_msg		=> \&plain_end_msg
 };
 
-sub run_test($$$$$)
+sub run_test($$$$$$)
 {
-	my ($name, $cmd, $i, $totalsuites, $msg_ops) = @_;
+	my ($envname, $name, $cmd, $i, $totalsuites, $msg_ops) = @_;
 	my $msg_state = {
+		ENVNAME	=> $envname,
 		NAME	=> $name,
 		CMD	=> $cmd,
 		INDEX	=> $i,
@@ -644,6 +651,13 @@
 	return $testenv_vars;
 }
 
+sub getlog_env($)
+{
+	my ($envname) = @_;
+	return "" if ($envname eq "none");
+	return $target->getlog_env($running_envs{$envname});
+}
+
 sub teardown_env($)
 {
 	my ($envname) = @_;
@@ -690,9 +704,9 @@
 		SocketWrapper::setup_pcap($pcap_file) if ($opt_socket_wrapper_pcap);
 		my $result;
 		if ($from_build_farm) {
-			$result = run_test($name, $cmd, $i, $suitestotal, $buildfarm_msg_ops);
+			$result = run_test($envname, $name, $cmd, $i, $suitestotal, $buildfarm_msg_ops);
 		} else {
-			$result = run_test($name, $cmd, $i, $suitestotal, $plain_msg_ops);
+			$result = run_test($envname, $name, $cmd, $i, $suitestotal, $plain_msg_ops);
 		}
 
 		if ($opt_socket_wrapper_pcap and $result and 



More information about the samba-cvs mailing list