summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-04-19 13:50:40 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-04-19 09:03:07 +0200
commitdfb490d551e9213e957ea547cb399c3ed408bdc9 (patch)
tree904af14cb3d1cacf7432d79ab664424099ff69a7
parent5189cfca4ea230125c7995d30caf2b48a332deb0 (diff)
downloadsamba-dfb490d551e9213e957ea547cb399c3ed408bdc9.tar.gz
samba-dfb490d551e9213e957ea547cb399c3ed408bdc9.tar.xz
samba-dfb490d551e9213e957ea547cb399c3ed408bdc9.zip
selftest Consolidate server wall clock time limits
This helps ensure that we don't have the Samba3 servers stop before the full make test is finished. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Tue Apr 19 09:03:07 CEST 2011 on sn-devel-104
-rwxr-xr-xselftest/selftest.pl15
-rw-r--r--selftest/target/Samba.pm6
-rw-r--r--selftest/target/Samba3.pm38
-rw-r--r--selftest/target/Samba4.pm35
4 files changed, 44 insertions, 50 deletions
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index aa22a57c796..9f937f16556 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -481,24 +481,33 @@ sub bindir_path($$) {
return $path;
}
+# After this many seconds, the server will self-terminate. All tests
+# must terminate in this time, and testenv will only stay alive this
+# long
+
+my $server_maxtime = 7500;
+if (defined($ENV{SMBD_MAXTIME}) and $ENV{SMBD_MAXTIME} ne "") {
+ $server_maxtime = $ENV{SMBD_MAXTIME};
+}
+
if ($opt_target eq "samba") {
if ($opt_socket_wrapper and `$bindir/smbd -b | grep SOCKET_WRAPPER` eq "") {
die("You must include --enable-socket-wrapper when compiling Samba in order to execute 'make test'. Exiting....");
}
$testenv_default = "all";
require target::Samba;
- $target = new Samba($bindir, \%binary_mapping, \&bindir_path, $ldap, $srcdir, $exeext);
+ $target = new Samba($bindir, \%binary_mapping, \&bindir_path, $ldap, $srcdir, $exeext, $server_maxtime);
} elsif ($opt_target eq "samba4") {
$testenv_default = "all";
require target::Samba4;
- $target = new Samba4($bindir, \%binary_mapping, \&bindir_path, $ldap, $srcdir, $exeext);
+ $target = new Samba4($bindir, \%binary_mapping, \&bindir_path, $ldap, $srcdir, $exeext, $server_maxtime);
} elsif ($opt_target eq "samba3") {
if ($opt_socket_wrapper and `$bindir/smbd -b | grep SOCKET_WRAPPER` eq "") {
die("You must include --enable-socket-wrapper when compiling Samba in order to execute 'make test'. Exiting....");
}
$testenv_default = "member";
require target::Samba3;
- $target = new Samba3($bindir, \%binary_mapping, \&bindir_path, $srcdir_abs, $exeext);
+ $target = new Samba3($bindir, \%binary_mapping, \&bindir_path, $srcdir_abs, $exeext, $server_maxtime);
} elsif ($opt_target eq "win") {
die("Windows tests will not run with socket wrapper enabled.")
if ($opt_socket_wrapper);
diff --git a/selftest/target/Samba.pm b/selftest/target/Samba.pm
index 703d0b5e626..fc7e68dfde7 100644
--- a/selftest/target/Samba.pm
+++ b/selftest/target/Samba.pm
@@ -10,11 +10,11 @@ use target::Samba3;
use target::Samba4;
sub new($$$$$) {
- my ($classname, $bindir, $binary_mapping, $bindir_path, $ldap, $srcdir, $exeext) = @_;
+ my ($classname, $bindir, $binary_mapping, $bindir_path, $ldap, $srcdir, $exeext, $server_maxtime) = @_;
my $self = {
- samba3 => new Samba3($bindir,$binary_mapping, $bindir_path, $srcdir, $exeext),
- samba4 => new Samba4($bindir,$binary_mapping, $bindir_path, $ldap, $srcdir, $exeext),
+ samba3 => new Samba3($bindir,$binary_mapping, $bindir_path, $srcdir, $exeext, $server_maxtime),
+ samba4 => new Samba4($bindir,$binary_mapping, $bindir_path, $ldap, $srcdir, $exeext, $server_maxtime),
};
bless $self;
return $self;
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index eff61452a25..3c0dd0918a3 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -11,14 +11,15 @@ use FindBin qw($RealBin);
use POSIX;
sub new($$) {
- my ($classname, $bindir, $binary_mapping, $bindir_path, $srcdir, $exeext) = @_;
+ my ($classname, $bindir, $binary_mapping, $bindir_path, $srcdir, $exeext, $server_maxtime) = @_;
$exeext = "" unless defined($exeext);
my $self = { vars => {},
bindir => $bindir,
binary_mapping => $binary_mapping,
bindir_path => $bindir_path,
srcdir => $srcdir,
- exeext => $exeext
+ exeext => $exeext,
+ server_maxtime => $server_maxtime
};
bless $self;
return $self;
@@ -136,7 +137,6 @@ sub setup_s3dc($$)
$vars or return undef;
$self->check_or_start($vars,
- ($ENV{SMBD_MAXTIME} or 2700),
"yes", "yes", "yes");
if (not $self->wait_for_start($vars)) {
@@ -180,9 +180,7 @@ sub setup_member($$$)
system($cmd) == 0 or die("Join failed\n$cmd");
- $self->check_or_start($ret,
- ($ENV{SMBD_MAXTIME} or 2700),
- "yes", "yes", "yes");
+ $self->check_or_start($ret, "yes", "yes", "yes");
if (not $self->wait_for_start($ret)) {
return undef;
@@ -216,9 +214,7 @@ sub setup_secshare($$)
$vars or return undef;
- $self->check_or_start($vars,
- ($ENV{SMBD_MAXTIME} or 2700),
- "yes", "no", "yes");
+ $self->check_or_start($vars, "yes", "no", "yes");
if (not $self->wait_for_start($vars)) {
return undef;
@@ -248,9 +244,7 @@ sub setup_secserver($$$)
$ret or return undef;
- $self->check_or_start($ret,
- ($ENV{SMBD_MAXTIME} or 2700),
- "yes", "no", "yes");
+ $self->check_or_start($ret, "yes", "no", "yes");
if (not $self->wait_for_start($ret)) {
return undef;
@@ -330,9 +324,7 @@ $ret->{USERNAME} = KTEST\\Administrator
system("cp $self->{srcdir}/source3/selftest/ktest-krb5_ccache-3 $prefix/krb5_ccache-3");
chmod 0600, "$prefix/krb5_ccache-3";
- $self->check_or_start($ret,
- ($ENV{SMBD_MAXTIME} or 2700),
- "yes", "no", "yes");
+ $self->check_or_start($ret, "yes", "no", "yes");
if (not $self->wait_for_start($ret)) {
return undef;
@@ -369,8 +361,8 @@ sub read_pid($$)
return $pid;
}
-sub check_or_start($$$$$) {
- my ($self, $env_vars, $maxtime, $nmbd, $winbindd, $smbd) = @_;
+sub check_or_start($$$$) {
+ my ($self, $env_vars, $nmbd, $winbindd, $smbd) = @_;
unlink($env_vars->{NMBD_TEST_LOG});
print "STARTING NMBD...";
@@ -394,7 +386,7 @@ sub check_or_start($$$$$) {
print("Skip nmbd received signal $signame");
exit 0;
};
- sleep($maxtime);
+ sleep($self->{server_maxtime});
exit 0;
}
@@ -405,7 +397,7 @@ sub check_or_start($$$$$) {
$ENV{MAKE_TEST_BINARY} = $self->{bindir_path}->($self, "nmbd");
- my @preargs = ($self->{bindir_path}->($self, "timelimit"), $maxtime);
+ my @preargs = ($self->{bindir_path}->($self, "timelimit"), $self->{server_maxtime});
if(defined($ENV{NMBD_VALGRIND})) {
@preargs = split(/ /, $ENV{NMBD_VALGRIND});
}
@@ -437,7 +429,7 @@ sub check_or_start($$$$$) {
print("Skip winbindd received signal $signame");
exit 0;
};
- sleep($maxtime);
+ sleep($self->{server_maxtime});
exit 0;
}
@@ -448,7 +440,7 @@ sub check_or_start($$$$$) {
$ENV{MAKE_TEST_BINARY} = $self->{bindir_path}->($self, "winbindd");
- my @preargs = ($self->{bindir_path}->($self, "timelimit"), $maxtime);
+ my @preargs = ($self->{bindir_path}->($self, "timelimit"), $self->{server_maxtime});
if(defined($ENV{WINBINDD_VALGRIND})) {
@preargs = split(/ /, $ENV{WINBINDD_VALGRIND});
}
@@ -480,7 +472,7 @@ sub check_or_start($$$$$) {
print("Skip smbd received signal $signame");
exit 0;
};
- sleep($maxtime);
+ sleep($self->{server_maxtime});
exit 0;
}
@@ -489,7 +481,7 @@ sub check_or_start($$$$$) {
if (defined($ENV{SMBD_OPTIONS})) {
@optargs = split(/ /, $ENV{SMBD_OPTIONS});
}
- my @preargs = ($self->{bindir_path}->($self, "timelimit"), $maxtime);
+ my @preargs = ($self->{bindir_path}->($self, "timelimit"), $self->{server_maxtime});
if(defined($ENV{SMBD_VALGRIND})) {
@preargs = split(/ /,$ENV{SMBD_VALGRIND});
}
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index 602a134982e..69d5c3bc686 100644
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -12,7 +12,7 @@ use POSIX;
use SocketWrapper;
sub new($$$$$) {
- my ($classname, $bindir, $binary_mapping, $bindir_path, $ldap, $srcdir, $exeext) = @_;
+ my ($classname, $bindir, $binary_mapping, $bindir_path, $ldap, $srcdir, $exeext, $server_maxtime) = @_;
$exeext = "" unless defined($exeext);
my $self = {
@@ -22,7 +22,8 @@ sub new($$$$$) {
binary_mapping => $binary_mapping,
bindir_path => $bindir_path,
srcdir => $srcdir,
- exeext => $exeext
+ exeext => $exeext,
+ server_maxtime => $server_maxtime
};
bless $self;
return $self;
@@ -82,9 +83,9 @@ sub slapd_stop($$)
return 1;
}
-sub check_or_start($$$)
+sub check_or_start($$)
{
- my ($self, $env_vars, $max_time) = @_;
+ my ($self, $env_vars) = @_;
return 0 if ( -p $env_vars->{SAMBA_TEST_FIFO});
unlink($env_vars->{SAMBA_TEST_FIFO});
@@ -126,9 +127,7 @@ sub check_or_start($$$)
}
my $optarg = "";
- if (defined($max_time)) {
- $optarg = "--maximum-runtime=$max_time ";
- }
+ $optarg = "--maximum-runtime=$self->{server_maxtime}";
if (defined($ENV{SAMBA_OPTIONS})) {
$optarg.= " $ENV{SAMBA_OPTIONS}";
}
@@ -1363,7 +1362,7 @@ sub setup_member($$$)
my $env = $self->provision_member($path, $dc_vars);
if (defined $env) {
- $self->check_or_start($env, ($ENV{SMBD_MAXTIME} or 7500));
+ $self->check_or_start($env);
$self->wait_for_start($env);
@@ -1380,7 +1379,7 @@ sub setup_rpc_proxy($$$)
my $env = $self->provision_rpc_proxy($path, $dc_vars);
if (defined $env) {
- $self->check_or_start($env, ($ENV{SMBD_MAXTIME} or 7500));
+ $self->check_or_start($env);
$self->wait_for_start($env);
@@ -1395,8 +1394,7 @@ sub setup_dc($$)
my $env = $self->provision_dc($path);
if (defined $env) {
- $self->check_or_start($env,
- ($ENV{SMBD_MAXTIME} or 7500));
+ $self->check_or_start($env);
$self->wait_for_start($env);
@@ -1411,8 +1409,7 @@ sub setup_fl2000dc($$)
my $env = $self->provision_fl2000dc($path);
if (defined $env) {
- $self->check_or_start($env,
- ($ENV{SMBD_MAXTIME} or 7500));
+ $self->check_or_start($env);
$self->wait_for_start($env);
@@ -1429,8 +1426,7 @@ sub setup_fl2003dc($$)
my $env = $self->provision_fl2003dc($path);
if (defined $env) {
- $self->check_or_start($env,
- ($ENV{SMBD_MAXTIME} or 7500));
+ $self->check_or_start($env);
$self->wait_for_start($env);
@@ -1446,8 +1442,7 @@ sub setup_fl2008r2dc($$)
my $env = $self->provision_fl2008r2dc($path);
if (defined $env) {
- $self->check_or_start($env,
- ($ENV{SMBD_MAXTIME} or 7500));
+ $self->check_or_start($env);
$self->wait_for_start($env);
@@ -1464,8 +1459,7 @@ sub setup_vampire_dc($$$)
my $env = $self->provision_vampire_dc($path, $dc_vars);
if (defined $env) {
- $self->check_or_start($env,
- ($ENV{SMBD_MAXTIME} or 7500));
+ $self->check_or_start($env);
$self->wait_for_start($env);
@@ -1518,8 +1512,7 @@ sub setup_rodc($$$)
return undef;
}
- $self->check_or_start($env,
- ($ENV{SMBD_MAXTIME} or 7500));
+ $self->check_or_start($env);
$self->wait_for_start($env);