selftest:Samba3: add nmbd, winbindd smbd arguments to wait_for_start()
authorMichael Adam <obnox@samba.org>
Thu, 22 Nov 2012 23:09:43 +0000 (00:09 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 3 Dec 2012 07:48:24 +0000 (08:48 +0100)
to make checks conditional

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
selftest/target/Samba3.pm

index 6e45159f0e8afad75db49173b47fcd48344cbb18..bd277d22adfa73a1b1b6e57a135620e123112a12 100755 (executable)
@@ -675,7 +675,7 @@ sub check_or_start($$$$$) {
 
        close(STDIN_READER);
 
-       return $self->wait_for_start($env_vars);
+       return $self->wait_for_start($env_vars, $nmbd, $winbindd, $smbd);
 }
 
 sub provision($$$$$$)
@@ -1094,38 +1094,43 @@ domadmins:X:$gid_domadmins:
        return \%ret;
 }
 
-sub wait_for_start($$)
+sub wait_for_start($$$$$)
 {
-       my ($self, $envvars) = @_;
-
-       # 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 ($self, $envvars, $nmbd, $winbindd, $smbd) = @_;
+
+       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, "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}");
+       }
 
-       # make sure smbd is also up set
-       print "wait for smbd\n";
+       if ($smbd eq "yes") {
+           # make sure smbd is also up set
+           print "wait for smbd\n";
 
-       my $count = 0;
-       my $ret;
-       do {
-           $ret = system(Samba::bindir_path($self, "smbclient3") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER} -U% -p 139");
-           if ($ret != 0) {
-               sleep(2);
+           my $count = 0;
+           my $ret;
+           do {
+               $ret = system(Samba::bindir_path($self, "smbclient3") ." $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";
+               teardown_env($self, $envvars);
+               return 0;
            }
-           $count++
-       } while ($ret != 0 && $count < 10);
-       if ($count == 10) {
-           print "SMBD failed to start up in a reasonable time (20sec)\n";
-           teardown_env($self, $envvars);
-           return 0;
        }
+
        # Ensure we have domain users mapped.
        $ret = system(Samba::bindir_path($self, "net") ." $envvars->{CONFIGURATION} groupmap add rid=513 unixgroup=domusers type=domain");
        if ($ret != 0) {