summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-04-07 13:07:23 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-04-07 14:35:36 +1000
commit4cdbb88c4b5319b0818a612dc7956b7ac213df19 (patch)
tree82b67a2cf43e12f2d6123ecf4c3d1caf37a58229
parent1862e904a821e2cd6132ab1d13b02da123edd94e (diff)
downloadsamba-4cdbb88c4b5319b0818a612dc7956b7ac213df19.tar.gz
samba-4cdbb88c4b5319b0818a612dc7956b7ac213df19.tar.bz2
samba-4cdbb88c4b5319b0818a612dc7956b7ac213df19.zip
s3-selftest actually wait for smbclient to connect
This means that we actually have a working smbd. The previous code didn't know if it worked or not, and so created flaky tests. Andrew Bartlett
-rw-r--r--selftest/target/Samba3.pm16
1 files changed, 14 insertions, 2 deletions
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 9b9bec30a2..9a3be7d72f 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -858,11 +858,23 @@ sub wait_for_start($$)
system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} -U 127.255.255.255 __SAMBA__");
system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} $envvars->{SERVER}");
system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} $envvars->{SERVER}");
+
# make sure smbd is also up set
print "wait for smbd\n";
- system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER_IP} -U% -p 139 | head -2");
- system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER_IP} -U% -p 139 | head -2");
+ my $count = 0;
+ my $ret;
+ do {
+ $ret = system($self->binpath("smbclient") ." $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";
+ exit 1;
+ }
# Ensure we have domain users mapped.
system($self->binpath("net") ." $envvars->{CONFIGURATION} groupmap add rid=513 unixgroup=domusers type=domain");