diff options
Diffstat (limited to 'source4/script/tests/Samba4.pm')
-rw-r--r-- | source4/script/tests/Samba4.pm | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source4/script/tests/Samba4.pm b/source4/script/tests/Samba4.pm index 99e329e7b9..65b55fcee0 100644 --- a/source4/script/tests/Samba4.pm +++ b/source4/script/tests/Samba4.pm @@ -13,9 +13,10 @@ use strict; use FindBin qw($RealBin); use POSIX; -sub slapd_start($$) +sub slapd_start($$$) { - my ($conf, $uri, $loglevel) = @_; + my $count = 0; + my ($bindir, $conf, $uri) = @_; # running slapd in the background means it stays in the same process group, so it can be # killed by timelimit if (defined($ENV{FEDORA_DS_PREFIX})) { @@ -26,6 +27,14 @@ sub slapd_start($$) system("slapd -d$ENV{OPENLDAP_LOGLEVEL} -f $conf -h $uri > $ENV{LDAPDIR}/logs 2>&1 &"); $ENV{PATH} = $oldpath; } + while (system("$bindir/ldbsearch -H $uri -s base -b \"\" supportedLDAPVersion > /dev/null") != 0) { + $count++; + if ($count > 10) { + slapd_stop(); + return 0; + } + sleep(1); + } return 1; } @@ -103,7 +112,6 @@ sub wait_for_start() { # give time for nbt server to register its names print "delaying for nbt name registration\n"; - sleep(4); # This will return quickly when things are up, but be slow if we # need to wait for (eg) SSL init @@ -113,6 +121,8 @@ sub wait_for_start() 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}"); } sub provision($) |