selftest: Remove 'if have_ads_support:' from tests.py
authorAndrew Bartlett <abartlet@samba.org>
Mon, 13 Feb 2012 22:05:21 +0000 (09:05 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 16 Feb 2012 04:21:11 +0000 (15:21 +1100)
The selftest system now skips launching these if the environment is not available.

Andrew Bartlett

source3/selftest/tests.py
source4/selftest/tests.py

index d50b3bae140186a0639021226161124fcc2ececc..662d275bc9870f299db73f5d94a120a3d002d283 100755 (executable)
@@ -33,18 +33,6 @@ try:
 except KeyError:
     config_h = os.path.join(samba3srcdir, "include/autoconf/config.h")
 
-f = open(config_h, 'r')
-try:
-    have_ads_support = ("HAVE_LDAP 1" in f.read())
-finally:
-    f.close()
-
-f = open(config_h, 'r')
-try:
-    have_ads_support &= ("HAVE_KRB5 1" in f.read())
-finally:
-    f.close()
-
 torture_options = [configuration, "--maximum-runtime=$SELFTEST_MAXTIME", 
                    "--target=samba3", "--basedir=$SELFTEST_TMPDIR",
                    '--option="torture:winbindd_netbios_name=$SERVER"',
@@ -283,48 +271,46 @@ for s in signseal_options:
             plantestsuite("samba3.blackbox.rpcclient over ncacn_np with [%s%s%s] " % (a, s, e), "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_rpcclient.sh"),
                                                              "none", options, configuration])
 
-    if have_ads_support:
-        # We should try more combinations in future, but this is all
-        # the pre-calculated credentials cache supports at the moment
-        e = ""
-        a = ""
-        binding_string = "ncacn_np:$SERVER[%s%s%s]" % (a, s, e)
-        options = binding_string + " -k yes --krb5-ccache=$PREFIX/ktest/krb5_ccache-2"
-        plansmbtorturetestsuite(test, "ktest", options, 'krb5 with old ccache ncacn_np with [%s%s%s] ' % (a, s, e))
+    # We should try more combinations in future, but this is all
+    # the pre-calculated credentials cache supports at the moment
+    e = ""
+    a = ""
+    binding_string = "ncacn_np:$SERVER[%s%s%s]" % (a, s, e)
+    options = binding_string + " -k yes --krb5-ccache=$PREFIX/ktest/krb5_ccache-2"
+    plansmbtorturetestsuite(test, "ktest", options, 'krb5 with old ccache ncacn_np with [%s%s%s] ' % (a, s, e))
 
-        options = binding_string + " -k yes --krb5-ccache=$PREFIX/ktest/krb5_ccache-3"
-        plansmbtorturetestsuite(test, "ktest", options, 'krb5 ncacn_np with [%s%s%s] ' % (a, s, e))
+    options = binding_string + " -k yes --krb5-ccache=$PREFIX/ktest/krb5_ccache-3"
+    plansmbtorturetestsuite(test, "ktest", options, 'krb5 ncacn_np with [%s%s%s] ' % (a, s, e))
 
-        auth_options2 = ["krb5", "spnego,krb5"]
-        for a in auth_options2:
-            binding_string = "ncacn_np:$SERVER[%s%s%s]" % (a, s, e)
+    auth_options2 = ["krb5", "spnego,krb5"]
+    for a in auth_options2:
+        binding_string = "ncacn_np:$SERVER[%s%s%s]" % (a, s, e)
 
-            plantestsuite("samba3.blackbox.rpcclient krb5 ncacn_np with [%s%s%s] " % (a, s, e), "ktest:local", [os.path.join(samba3srcdir, "script/tests/test_rpcclient.sh"),
+        plantestsuite("samba3.blackbox.rpcclient krb5 ncacn_np with [%s%s%s] " % (a, s, e), "ktest:local", [os.path.join(samba3srcdir, "script/tests/test_rpcclient.sh"),
                                                                                                                               "$PREFIX/ktest/krb5_ccache-3", binding_string, "-k", configuration])
 
 
 options_list = ["", "-e"]
 for options in options_list:
-    if have_ads_support:
-        plantestsuite("samba3.blackbox.smbclient_krb5 old ccache %s" % options, "ktest:local", 
-                      [os.path.join(samba3srcdir, "script/tests/test_smbclient_krb5.sh"),
-                       "$PREFIX/ktest/krb5_ccache-2", 
-                       binpath('smbclient3'), "$SERVER", options, configuration])
-
-        plantestsuite("samba3.blackbox.smbclient_krb5 old ccache %s" % options, "ktest:local",
-                      [os.path.join(samba3srcdir, "script/tests/test_smbclient_krb5.sh"),
-                       "$PREFIX/ktest/krb5_ccache-2",
-                       binpath('smbclient3'), "$SERVER", options, configuration])
-
-        plantestsuite("samba3.blackbox.smbclient_large_file %s" % options, "ktest:local",
-                      [os.path.join(samba3srcdir, "script/tests/test_smbclient_posix_large.sh"),
-                       "$PREFIX/ktest/krb5_ccache-3",
-                       binpath('smbclient3'), "$SERVER", "$PREFIX", options, "-k " + configuration])
-
-        plantestsuite("samba3.blackbox.smbclient_posix_large %s krb5" % options, "ktest:local",
-                      [os.path.join(samba3srcdir, "script/tests/test_smbclient_posix_large.sh"),
-                       "$PREFIX/ktest/krb5_ccache-3",
-                       binpath('smbclient3'), "$SERVER", "$PREFIX", options, "-k " + configuration])
+    plantestsuite("samba3.blackbox.smbclient_krb5 old ccache %s" % options, "ktest:local", 
+                  [os.path.join(samba3srcdir, "script/tests/test_smbclient_krb5.sh"),
+                   "$PREFIX/ktest/krb5_ccache-2", 
+                   binpath('smbclient3'), "$SERVER", options, configuration])
+
+    plantestsuite("samba3.blackbox.smbclient_krb5 old ccache %s" % options, "ktest:local",
+                  [os.path.join(samba3srcdir, "script/tests/test_smbclient_krb5.sh"),
+                   "$PREFIX/ktest/krb5_ccache-2",
+                   binpath('smbclient3'), "$SERVER", options, configuration])
+
+    plantestsuite("samba3.blackbox.smbclient_large_file %s" % options, "ktest:local",
+                  [os.path.join(samba3srcdir, "script/tests/test_smbclient_posix_large.sh"),
+                   "$PREFIX/ktest/krb5_ccache-3",
+                   binpath('smbclient3'), "$SERVER", "$PREFIX", options, "-k " + configuration])
+
+    plantestsuite("samba3.blackbox.smbclient_posix_large %s krb5" % options, "ktest:local",
+                  [os.path.join(samba3srcdir, "script/tests/test_smbclient_posix_large.sh"),
+                   "$PREFIX/ktest/krb5_ccache-3",
+                   binpath('smbclient3'), "$SERVER", "$PREFIX", options, "-k " + configuration])
 
     plantestsuite("samba3.blackbox.smbclient_posix_large %s NTLM" % options, "s3dc:local",
                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_posix_large.sh"),
index 8529cc991c54c0ca4426a0829f006025a9ebfe9b..39c0f4b7cabfb897fcf7030b7c2afa1ddaedb13c 100755 (executable)
@@ -70,13 +70,6 @@ try:
 except KeyError:
     config_h = os.path.join(samba4bindir, "default/include/config.h")
 
-f = open(config_h, 'r')
-try:
-    # The other parts of the HAVE_ADS test are always supplied by the top level build
-    have_ads_support = ("HAVE_LDAP 1" in f.read())
-finally:
-    f.close()
-
 # see if we support ldaps
 f = open(config_h, 'r')
 try:
@@ -139,12 +132,11 @@ for bindoptions in ["seal,padcheck"] + validate_list + ["bigendian"]:
 
 #Plugin S4 DC tests (confirms named pipe auth forwarding).  This can be expanded once kerberos is supported in the plugin DC
 #
-if have_ads_support:
-    for bindoptions in ["seal,padcheck"] + validate_list + ["bigendian"]:
-        for t in ncacn_np_tests:
-            env = "plugin_s4_dc"
-            transport = "ncacn_np"
-            plansmbtorturetestsuite(t, env, ["%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', '-k', 'no'], "samba4.%s with %s" % (t, bindoptions))
+for bindoptions in ["seal,padcheck"] + validate_list + ["bigendian"]:
+    for t in ncacn_np_tests:
+        env = "plugin_s4_dc"
+        transport = "ncacn_np"
+        plansmbtorturetestsuite(t, env, ["%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', '-k', 'no'], "samba4.%s with %s" % (t, bindoptions))
 
 for bindoptions in [""] + validate_list + ["bigendian"]:
     for t in auto_rpc_tests:
@@ -361,11 +353,10 @@ for mech in [
     signoptions = "%s --signing=off" % mech
     name = "smb.signing disabled on with %s" % signoptions
     plansmbtorturetestsuite('base.xcopy', "s4member", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$DC_USERNAME%$DC_PASSWORD'], "samba4.%s domain-creds" % name)
-    if have_ads_support:
-        plansmbtorturetestsuite('base.xcopy', "s3member", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$DC_USERNAME%$DC_PASSWORD'], "samba4.%s domain-creds" % name)
-        plansmbtorturetestsuite('base.xcopy', "plugin_s4_dc", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$USERNAME%$PASSWORD'], "samba4.%s" % name)
-        plansmbtorturetestsuite('base.xcopy', "plugin_s4_dc",
-                               ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$DC_USERNAME%$DC_PASSWORD'], "samba4.%s administrator" % name)
+    plansmbtorturetestsuite('base.xcopy', "s3member", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$DC_USERNAME%$DC_PASSWORD'], "samba4.%s domain-creds" % name)
+    plansmbtorturetestsuite('base.xcopy', "plugin_s4_dc", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$USERNAME%$PASSWORD'], "samba4.%s" % name)
+    plansmbtorturetestsuite('base.xcopy', "plugin_s4_dc",
+                            ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$DC_USERNAME%$DC_PASSWORD'], "samba4.%s administrator" % name)
 
 plantestsuite("samba4.blackbox.bogusdomain", "s3member", ["testprogs/blackbox/bogus.sh", "$NETBIOSNAME", "xcopy_share", '$DC_USERNAME', '$DC_PASSWORD'], allow_empty_output=True)
 for mech in [