From 4cdbb88c4b5319b0818a612dc7956b7ac213df19 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 7 Apr 2011 13:07:23 +1000 Subject: 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 --- selftest/target/Samba3.pm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'selftest') 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"); -- cgit