Rev 11316: Fix testenv. in file:///home/jelmer/bzr.samba/4.0-perlselftest/

Jelmer Vernooij jelmer at samba.org
Wed Feb 21 22:37:09 GMT 2007


At file:///home/jelmer/bzr.samba/4.0-perlselftest/

------------------------------------------------------------
revno: 11316
revision-id: jelmer at samba.org-20070221223657-i2b4jrwzrjwh2yc4
parent: jelmer at samba.org-20070221115430-30929e0uo2q7agbh
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 4.0-perlselftest
timestamp: Wed 2007-02-21 23:36:57 +0100
message:
  Fix testenv.
modified:
  source/TODO                    todo-20070126140905-srlmy1f6yd4ba4lp-1
  source/script/tests/Samba4.pm  samba4.pm-20070204113348-43jx6uba5ui2h4wd-1
  source/script/tests/selftest.pl svn-v2:20693 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fscript%2ftests%2fselftest.pl
  source/script/tests/testenv.pl testenv.sh-20070201114140-yqamcl9g11yeseoc-1
=== modified file 'source/TODO'
--- a/source/TODO	2007-02-01 12:32:42 +0000
+++ b/source/TODO	2007-02-21 22:36:57 +0000
@@ -1,2 +1,1 @@
-- fix 'make testenv' and 'make valgrindtest-env'
 - warn about unexpected successes

=== modified file 'source/script/tests/Samba4.pm'
--- a/source/script/tests/Samba4.pm	2007-02-04 12:59:56 +0000
+++ b/source/script/tests/Samba4.pm	2007-02-21 22:36:57 +0000
@@ -11,6 +11,7 @@
 
 use strict;
 use FindBin qw($RealBin);
+use POSIX;
 
 sub slapd_start($$)
 {
@@ -71,7 +72,11 @@
 		open STDIN, $test_fifo;
 		open STDOUT, ">$test_log";
 		open STDERR, '>&STDOUT';
-		my $ret = system("$valgrind $bindir/smbd --maximum-runtime=$max_time -s $conffile -M single -i --leak-report-full");
+		my $optarg = "";
+		if (defined($max_time)) {
+			$optarg = "--maximum-runtime=$max_time ";
+		}
+		my $ret = system("$valgrind $bindir/smbd $optarg -s $conffile -M single -i --leak-report-full");
 		if ($? == -1) {
 			print "Unable to start smbd: $ret: $!\n";
 			exit 1;
@@ -113,13 +118,15 @@
 sub provision($)
 {
 	my ($prefix) = @_;
+	my %ret = ();
 	print "PROVISIONING...";
 	open(IN, "$RealBin/mktestsetup.sh $prefix|") or die("Unable to setup");
 	while (<IN>) {
 		die ("Error parsing `$_'") unless (/^([A-Z0-9a-z_]+)=(.*)$/);
-		$ENV{$1} = $2;
+		$ret{$1} = $2;
 	}
 	close(IN);
+	return \%ret;
 }
 
 sub provision_ldap($$)

=== modified file 'source/script/tests/selftest.pl'
--- a/source/script/tests/selftest.pl	2007-02-04 12:59:56 +0000
+++ b/source/script/tests/selftest.pl	2007-02-21 22:36:57 +0000
@@ -361,7 +361,8 @@
 my @torture_options = ();
 
 if ($opt_target eq "samba4") {
-	Samba4::provision($prefix);
+	my $vars = Samba4::provision($prefix);
+	foreach (keys %$vars) { $ENV{$_} = $vars{$_}; }
 } elsif ($opt_target eq "win") {
 	die ("Windows tests will not run without root privileges.") 
 		if (`whoami` ne "root");

=== modified file 'source/script/tests/testenv.pl'
--- a/source/script/tests/testenv.pl	2007-02-04 12:59:56 +0000
+++ b/source/script/tests/testenv.pl	2007-02-21 22:36:57 +0000
@@ -4,18 +4,29 @@
 use lib "$RealBin";
 
 use Samba4;
-
-Samba4::provision();
-Samba4::smbd_check_or_start();
-
-my $prefix = "st";
-
-open(VARS, "./script/tests/mktestsetup.sh $prefix|") or die("Unable to run mktestsetup");
-while (<VARS>) {
-	next unless (/^([A-Z_]+)=(.*)$/);
-	$ENV{$1} = $2;
-}
-close(VARS);
-
+use SocketWrapper;
+
+my $vars = Samba4::provision("st");
+foreach (keys %$vars) { $ENV{$_} = $vars->{$_}; }
+SocketWrapper::set_default_iface(1);
+my $test_fifo = "st/smb_test.fifo";
+my $socket_wrapper_dir = SocketWrapper::setup_dir("$vars->{PREFIX_ABS}/w");
+Samba4::smbd_check_or_start("bin", $test_fifo, $ENV{SMBD_TEST_LOG}, $socket_wrapper_dir, undef, $ENV{CONFFILE});
+SocketWrapper::set_default_iface(6);
+my $interfaces = join(',', ("127.0.0.6/8", 
+		                 "127.0.0.7/8",
+						 "127.0.0.8/8",
+						 "127.0.0.9/8",
+						 "127.0.0.10/8",
+						 "127.0.0.11/8"));
+
+push (@torture_options, "--option=interfaces=$interfaces", 
+	                    $ENV{CONFIGURATION}, 
+						"--target=samba4");
+
+$ENV{TORTURE_OPTIONS} = join(' ', @torture_options);
+
+open(DATA, ">$test_fifo");
+Samba4::wait_for_start();
 system("xterm");
-
+close(DATA);



More information about the samba-cvs mailing list