From 5f4fb5769a7bdd8070d0e74061a949ad34d6f868 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 23 Nov 2012 00:09:43 +0100 Subject: [PATCH] selftest:Samba3: add nmbd, winbindd smbd arguments to wait_for_start() to make checks conditional Signed-off-by: Michael Adam Reviewed-by: Stefan Metzmacher (cherry picked from commit 5b975ce78cc77bd9ff39e2ec0c2e7d674bf61ebe) --- selftest/target/Samba3.pm | 61 +++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index ca5b1e2ca26..6c8939c8087 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -675,7 +675,7 @@ sub check_or_start($$$$$) { close(STDIN_READER); - return $self->wait_for_start($env_vars); + return $self->wait_for_start($env_vars, $nmbd, $winbindd, $smbd); } sub provision($$$$$$) @@ -1093,38 +1093,43 @@ domadmins:X:$gid_domadmins: return \%ret; } -sub wait_for_start($$) +sub wait_for_start($$$$$) { - my ($self, $envvars) = @_; - - # give time for nbt server to register its names - print "delaying for nbt name registration\n"; - sleep(10); - # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init - my $nmblookup = Samba::bindir_path($self, "nmblookup3"); - system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} __SAMBA__"); - system("$nmblookup $envvars->{CONFIGURATION} __SAMBA__"); - system("$nmblookup $envvars->{CONFIGURATION} -U 127.255.255.255 __SAMBA__"); - system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} $envvars->{SERVER}"); - system("$nmblookup $envvars->{CONFIGURATION} $envvars->{SERVER}"); + my ($self, $envvars, $nmbd, $winbindd, $smbd) = @_; + + if ($nmbd eq "yes") { + # give time for nbt server to register its names + print "delaying for nbt name registration\n"; + sleep(10); + # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init + my $nmblookup = Samba::bindir_path($self, "nmblookup3"); + system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} __SAMBA__"); + system("$nmblookup $envvars->{CONFIGURATION} __SAMBA__"); + system("$nmblookup $envvars->{CONFIGURATION} -U 127.255.255.255 __SAMBA__"); + system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} $envvars->{SERVER}"); + system("$nmblookup $envvars->{CONFIGURATION} $envvars->{SERVER}"); + } - # make sure smbd is also up set - print "wait for smbd\n"; + if ($smbd eq "yes") { + # make sure smbd is also up set + print "wait for smbd\n"; - my $count = 0; - my $ret; - do { - $ret = system(Samba::bindir_path($self, "smbclient3") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER} -U% -p 139"); - if ($ret != 0) { - sleep(2); + my $count = 0; + my $ret; + do { + $ret = system(Samba::bindir_path($self, "smbclient3") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER} -U% -p 139"); + if ($ret != 0) { + sleep(2); + } + $count++ + } while ($ret != 0 && $count < 10); + if ($count == 10) { + print "SMBD failed to start up in a reasonable time (20sec)\n"; + teardown_env($self, $envvars); + return 0; } - $count++ - } while ($ret != 0 && $count < 10); - if ($count == 10) { - print "SMBD failed to start up in a reasonable time (20sec)\n"; - teardown_env($self, $envvars); - return 0; } + # Ensure we have domain users mapped. $ret = system(Samba::bindir_path($self, "net") ." $envvars->{CONFIGURATION} groupmap add rid=513 unixgroup=domusers type=domain"); if ($ret != 0) { -- 2.11.4.GIT