[PATCH] selftest: Reduce waiting time for nmbd!

Andreas Schneider asn at samba.org
Tue Jul 22 07:35:20 MDT 2014


This did not work cause there is no nmblookup3 and we really don't need
to wait for 10 seconds. This should reduce running tests.

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 selftest/target/Samba3.pm | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index a6d85cc..d54b347 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1286,16 +1286,25 @@ sub wait_for_start($$$$$)
 	my $ret;
 
 	if ($nmbd eq "yes") {
+	    my $count = 0;
+
 	    # 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 $nmblookup = Samba::bindir_path($self, "nmblookup");
+	    do {
+			$ret = system("$nmblookup $envvars->{CONFIGURATION} $envvars->{SERVER}");
+			if ($ret != 0) {
+				sleep(2);
+			}
+			$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") {
-- 
2.0.1




More information about the samba-technical mailing list