summaryrefslogtreecommitdiff
path: root/selftest
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2014-07-25 16:45:29 +0200
committerMichael Adam <obnox@samba.org>2014-08-04 17:58:58 +0200
commiteb2637ccc93b9f385cf34eb998bf3283bb4a4320 (patch)
tree25cdee7175f901b3262dc8d01d88a34c58202a72 /selftest
parented225d7c490ffde053a4b3c8de60bd7efb528bd0 (diff)
downloadsamba-eb2637ccc93b9f385cf34eb998bf3283bb4a4320.tar.gz
selftest: Improve check to detect if nmbd is working.
With this change you mostly have to wait only for one second till the tests get executed instead of ten seconds. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Mon Aug 4 17:58:58 CEST 2014 on sn-devel-104
Diffstat (limited to 'selftest')
-rwxr-xr-xselftest/target/Samba3.pm35
1 files changed, 25 insertions, 10 deletions
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 0f88d93a45d..394d6372c0c 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1286,16 +1286,31 @@ sub wait_for_start($$$$$)
my $ret;
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, "nmblookup");
- 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 $count = 0;
+
+ # give time for nbt server to register its names
+ print "checking for nmbd\n";
+
+ # 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, "nmblookup");
+
+ do {
+ $ret = system("$nmblookup $envvars->{CONFIGURATION} $envvars->{SERVER}");
+ if ($ret != 0) {
+ sleep(1);
+ } else {
+ 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}");
+ }
+ $count++;
+ } while ($ret != 0 && $count < 10);
+ if ($count == 10) {
+ print "NMBD not reachable after 10 retries\n";
+ teardown_env($self, $envvars);
+ return 0;
+ }
}
if ($winbindd eq "yes") {