selftest: Use default 'prefork children' smb.conf setting
[kai/samba-autobuild/.git] / selftest / target / Samba4.pm
index f2635e574cdf55a81cba91824331d3b3d11a668e..c0f557999ebf54f2d5248ad519ffb210fb416fa1 100755 (executable)
@@ -161,10 +161,13 @@ sub check_or_start($$$)
                        @preargs = split(/ /,$ENV{SAMBA_VALGRIND});
                }
 
+               if (defined($process_model)) {
+                       push @optargs, ("-M", $process_model);
+               }
                close($env_vars->{STDIN_PIPE});
                open STDIN, ">&", $STDIN_READER or die "can't dup STDIN_READER to STDIN: $!";
 
-               exec(@preargs, Samba::bindir_path($self, "samba"), "-M", $process_model, "-i", "--no-process-group", "--maximum-runtime=$self->{server_maxtime}", $env_vars->{CONFIGURATION}, @optargs) or die("Unable to start samba: $!");
+               exec(@preargs, Samba::bindir_path($self, "samba"), "-i", "--no-process-group", "--maximum-runtime=$self->{server_maxtime}", $env_vars->{CONFIGURATION}, @optargs) or die("Unable to start samba: $!");
        }
        $env_vars->{SAMBA_PID} = $pid;
        print "DONE ($pid)\n";
@@ -398,7 +401,7 @@ sub setup_dns_hub_internal($$$)
                } else {
                    push (@preargs, $ENV{PYTHON});
                }
-               $ENV{MAKE_TEST_BINARY} = Samba::bindir_path($self, "python/samba/tests/dns_forwarder_helpers/dns_hub.py");
+               $ENV{MAKE_TEST_BINARY} = "$self->{srcdir}/selftest/target/dns_hub.py";
                push (@args, "$self->{server_maxtime}");
                push (@args, "$env->{ipv4}");
                close($env->{STDIN_PIPE});
@@ -791,8 +794,6 @@ sub provision_raw_step1($$)
        dreplsrv:periodic_startup_interval = 0
        dsdb:schema update allowed = yes
 
-        prefork children = 4
-
         vfs objects = dfs_samba4 acl_xattr fake_acls xattr_tdb streams_depot
 
         idmap_ldb:use rfc2307=yes
@@ -2170,7 +2171,7 @@ sub provision_chgdcpass($$)
        # (and also removes the default AD complexity checks)
        my $unacceptable_password = "widk3Dsle32jxdBdskldsk55klASKQ";
        my $extra_smb_conf = "
-       check password script = sed -e '/$unacceptable_password/{;q1}; /$unacceptable_password/!{q0}'
+       check password script = $self->{srcdir}/selftest/checkpassword_arg1.sh ${unacceptable_password}
        allow dcerpc auth level connect:lsarpc = yes
        dcesrv:max auth states = 8
 ";
@@ -2221,6 +2222,15 @@ sub teardown_env_terminate($$)
        my ($self, $envvars) = @_;
        my $pid;
 
+       # This should cause samba to terminate gracefully
+       my $smbcontrol = Samba::bindir_path($self, "smbcontrol");
+       my $cmd = "";
+       $cmd .= "$smbcontrol samba shutdown $envvars->{CONFIGURATION}";
+       my $ret = system($cmd);
+       if ($ret != 0) {
+               warn "'$cmd' failed with '$ret'\n";
+       }
+
        # This should cause samba to terminate gracefully
        close($envvars->{STDIN_PIPE});
 
@@ -2323,6 +2333,10 @@ sub check_env($$)
 # Declare the environments Samba4 makes available.
 # To be set up, they will be called as
 #   samba4->setup_$envname($self, $path, $dep_1_vars, $dep_2_vars, ...)
+# The interdependencies between the testenvs are declared below. Some testenvs
+# are dependent on another testenv running first, e.g. vampire_dc is dependent
+# on ad_dc_ntvfs because vampire_dc joins ad_dc_ntvfs's domain. All DCs are
+# dependent on dns_hub, which handles resolving DNS queries for the realm.
 %Samba4::ENV_DEPS = (
        # name               => [dep_1, dep_2, ...],
        dns_hub              => [],
@@ -2330,9 +2344,6 @@ sub check_env($$)
        ad_dc                => ["dns_hub"],
        ad_dc_no_nss         => ["dns_hub"],
        ad_dc_no_ntlm        => ["dns_hub"],
-       backupfromdc         => ["dns_hub"],
-       customdc             => ["dns_hub"],
-       preforkrestartdc     => ["dns_hub"],
 
        fl2008r2dc           => ["ad_dc"],
        fl2003dc             => ["ad_dc"],
@@ -2350,11 +2361,17 @@ sub check_env($$)
        s4member_dflt_domain => ["ad_dc_ntvfs"],
        s4member             => ["ad_dc_ntvfs"],
 
+       # envs that test the server process model
+       proclimitdc          => ["dns_hub"],
+       preforkrestartdc     => ["dns_hub"],
+
+       # backup/restore testenvs
+       backupfromdc         => ["dns_hub"],
+       customdc             => ["dns_hub"],
        restoredc            => ["backupfromdc"],
        renamedc             => ["backupfromdc"],
        offlinebackupdc      => ["backupfromdc"],
        labdc                => ["backupfromdc"],
-       proclimitdc          => [],
 
        none                 => [],
 );
@@ -2882,7 +2899,7 @@ sub setup_backupfromdc
                return undef;
        }
 
-       if (not defined($self->check_or_start($env, "standard"))) {
+       if (not defined($self->check_or_start($env))) {
            return undef;
        }
 
@@ -3092,7 +3109,7 @@ sub setup_restoredc
        }
 
        # start samba for the restored DC
-       if (not defined($self->check_or_start($env, "standard"))) {
+       if (not defined($self->check_or_start($env))) {
            return undef;
        }
 
@@ -3134,7 +3151,7 @@ sub setup_renamedc
        }
 
        # start samba for the restored DC
-       if (not defined($self->check_or_start($env, "standard"))) {
+       if (not defined($self->check_or_start($env))) {
            return undef;
        }
 
@@ -3183,7 +3200,7 @@ sub setup_offlinebackupdc
        Samba::mk_krb5_conf($ctx);
 
        # start samba for the restored DC
-       if (not defined($self->check_or_start($env, "standard"))) {
+       if (not defined($self->check_or_start($env))) {
            return undef;
        }
 
@@ -3238,7 +3255,7 @@ sub setup_labdc
        }
 
        # start samba for the restored DC
-       if (not defined($self->check_or_start($env, "standard"))) {
+       if (not defined($self->check_or_start($env))) {
            return undef;
        }
 
@@ -3336,7 +3353,7 @@ sub setup_customdc
        Samba::mk_krb5_conf($ctx);
 
        # start samba for the restored DC
-       if (not defined($self->check_or_start($env, "standard"))) {
+       if (not defined($self->check_or_start($env))) {
            return undef;
        }