summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/script/tests/Samba3.pm4
-rw-r--r--source4/script/tests/Samba4.pm35
-rwxr-xr-xsource4/script/tests/selftest.pl27
3 files changed, 30 insertions, 36 deletions
diff --git a/source4/script/tests/Samba3.pm b/source4/script/tests/Samba3.pm
index 0cde6e22c9..83604f29ab 100644
--- a/source4/script/tests/Samba3.pm
+++ b/source4/script/tests/Samba3.pm
@@ -121,9 +121,9 @@ sub stop($)
return $failed;
}
-sub setup_env($$)
+sub setup_env($$$)
{
- my ($self, $name) = @_;
+ my ($self, $name, $socket_wrapper_dir) = @_;
}
1;
diff --git a/source4/script/tests/Samba4.pm b/source4/script/tests/Samba4.pm
index 54d1d62167..fa20ccbdaf 100644
--- a/source4/script/tests/Samba4.pm
+++ b/source4/script/tests/Samba4.pm
@@ -68,8 +68,7 @@ sub check_or_start($$$$)
$self->provision_ldap();
}
- warn("Not using socket wrapper, but also not running as root. Will not be able to listen on proper ports") unless
- defined($socket_wrapper_dir) or $< == 0;
+ SocketWrapper::set_default_iface(1);
unlink($env_vars->{SMBD_TEST_FIFO});
POSIX::mkfifo($env_vars->{SMBD_TEST_FIFO}, 0700);
@@ -115,21 +114,22 @@ sub check_or_start($$$$)
return $pid;
}
-sub wait_for_start($)
+sub wait_for_start($$)
{
+ my ($self, $testenv_vars) = @_;
# give time for nbt server to register its names
print "delaying for nbt name registration\n";
# This will return quickly when things are up, but be slow if we
# need to wait for (eg) SSL init
- system("bin/nmblookup $ENV{CONFIGURATION} $ENV{SERVER}");
- system("bin/nmblookup $ENV{CONFIGURATION} -U $ENV{SERVER} $ENV{SERVER}");
- system("bin/nmblookup $ENV{CONFIGURATION} $ENV{SERVER}");
- system("bin/nmblookup $ENV{CONFIGURATION} -U $ENV{SERVER} $ENV{NETBIOSNAME}");
- system("bin/nmblookup $ENV{CONFIGURATION} $ENV{NETBIOSNAME}");
- system("bin/nmblookup $ENV{CONFIGURATION} -U $ENV{SERVER} $ENV{NETBIOSNAME}");
- system("bin/nmblookup $ENV{CONFIGURATION} $ENV{NETBIOSNAME}");
- system("bin/nmblookup $ENV{CONFIGURATION} -U $ENV{SERVER} $ENV{NETBIOSNAME}");
+ system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{SERVER}");
+ system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER} $testenv_vars->{SERVER}");
+ system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{SERVER}");
+ 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}");
+ system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{NETBIOSNAME}");
+ system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER} $testenv_vars->{NETBIOSNAME}");
}
sub provision($$$)
@@ -177,9 +177,18 @@ sub stop($)
return $failed;
}
-sub setup_env($$)
+sub setup_env($$$)
{
- my ($self, $name) = @_;
+ my ($self, $name, $path, $socket_wrapper_dir) = @_;
+
+ my $env = $self->provision($name, $path);
+
+ $self->check_or_start($env, $socket_wrapper_dir,
+ ($ENV{SMBD_MAX_TIME} or 5400));
+
+ $self->wait_for_start($env);
+
+ return $env;
}
1;
diff --git a/source4/script/tests/selftest.pl b/source4/script/tests/selftest.pl
index 86c00ac946..52311347fe 100755
--- a/source4/script/tests/selftest.pl
+++ b/source4/script/tests/selftest.pl
@@ -369,8 +369,6 @@ $ENV{PREFIX} = $prefix;
$ENV{SRCDIR} = $srcdir;
-my $testsdir = "$srcdir/script/tests";
-
my $tls_enabled = not $opt_quick;
my $from_build_farm = (defined($ENV{RUN_FROM_BUILD_FARM}) and
($ENV{RUN_FROM_BUILD_FARM} eq "yes"));
@@ -399,6 +397,8 @@ if ($opt_socket_wrapper)
{
$socket_wrapper_dir = SocketWrapper::setup_dir("$prefix/w");
print "SOCKET_WRAPPER_DIR=$socket_wrapper_dir\n";
+} else {
+ warn("Not using socket wrapper, but also not running as root. Will not be able to listen on proper ports") unless $< == 0;
}
my $target;
@@ -431,15 +431,10 @@ if (defined($opt_skip)) {
close(SKIP);
}
-my $testenv_vars;
-$testenv_vars = $target->provision("dc", "$prefix/dc");
+my $testenv_vars = $target->setup_env("dc", "$prefix/dc", $socket_wrapper_dir);
foreach (keys %$testenv_vars) { $ENV{$_} = $testenv_vars->{$_}; }
-SocketWrapper::set_default_iface(1);
-$target->check_or_start($testenv_vars, $socket_wrapper_dir,
- ($ENV{SMBD_MAX_TIME} or 5400));
-
SocketWrapper::set_default_iface(6);
my $interfaces = join(',', ("127.0.0.6/8",
@@ -463,6 +458,8 @@ print "OPTIONS $ENV{TORTURE_OPTIONS}\n";
my @todo = ();
+my $testsdir = "$srcdir/script/tests";
+
if ($opt_quick) {
open(IN, "$testsdir/tests_quick.sh|");
} else {
@@ -484,11 +481,6 @@ while (<IN>) {
}
close(IN) or die("Error creating recipe");
-$target->wait_for_start();
-
-# start off with 0 failures
-$ENV{failed} = 0;
-
my $suitestotal = $#todo + 1;
my $i = 0;
$| = 1;
@@ -522,7 +514,7 @@ NETBIOSNAME=\$NETBIOSNAME\" && bash'");
next;
}
- $target->setup_env($envname);
+ # $target->setup_env($envname);
if ($from_build_farm) {
run_test_buildfarm($name, $cmd, $i, $suitestotal);
@@ -558,13 +550,6 @@ if ($numfailed == 0) {
}
print "FAILED ($statistics->{TESTS_UNEXPECTED_FAIL} failures and $statistics->{TESTS_ERROR} errors in $statistics->{SUITES_FAIL} testsuites)\n";
- } else {
- print <<EOF
-************************
-*** TESTSUITE FAILED ***
-************************
-EOF
-;
}
}
print "DURATION: $duration seconds\n";