[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Wed Nov 9 22:05:03 MST 2011


The branch, master has been updated
       via  7d84805 s4: samba-tool time --help documentation improvements
       via  4ea6225 s4: samba-tool group --help documentation improvements
       via  ba41389 test: fixed several tests to use samba.tests
       via  862823a samba-tool: print samaccountname in samba-tool user list
       via  3935676 test: use planpythontestsuite() for ldb.python test
       via  b0be72d test: added directory option to planpythontestsuite()
       via  ac0bba2 test: added -D option to subunitrun
       via  333248f pyldb: fixed ldb API test
       via  a04eac7 build: only run symbol checking if running all tests
       via  58457e6 pyldb: enhanced get() method on msg object
       via  1cef321 samba-tool: Added new "user disable" command
       via  34ff5d2 samba-tool: Added "user list" command
       via  da21ff8 samba-tool: Change internal argument name in domain machinepassword
       via  53fc437 samba-tool: Fix domain machinepassword secret db search
       via  ec5afae samba-tool: Fix domain machinepassword name search
       via  46723aa s4-test: improved error checking in samba-tool time test
       via  a7c1add s4-socket: detect NULL server in socket connection code
       via  e118d91 test: enable time and user samba-tool tests
       via  a818253 test: add samba-tool user tests
       via  a66eae9 test: Add samba-tool time tests
       via  559835d test: add directory and base class for samba-tool tests
      from  ca52871 s4-setup Remove servicePrincipalName: DNS/${DNSDOMAIN} from new installations

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7d84805ac06522dabeb4f8d5b69dab2918a508ba
Author: Theresa Halloran <thallora at linux.vnet.ibm.com>
Date:   Wed Nov 9 20:16:33 2011 -0500

    s4: samba-tool time --help documentation improvements
    
    Signed-off-by: Theresa Halloran <thallora at linux.vnet.ibm.com>
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>
    
    Autobuild-User: Andrew Tridgell <tridge at samba.org>
    Autobuild-Date: Thu Nov 10 06:04:22 CET 2011 on sn-devel-104

commit 4ea6225c58108c4f4d45a30857b1cc1e3423c298
Author: Theresa Halloran <thallora at linux.vnet.ibm.com>
Date:   Wed Nov 9 16:33:37 2011 -0500

    s4: samba-tool group --help documentation improvements
    
    Signed-off-by: Theresa Halloran <thallora at linux.vnet.ibm.com>
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

commit ba41389d3d0860079b1276fb32f1d0d989f2471f
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Nov 9 13:28:02 2011 +1100

    test: fixed several tests to use samba.tests
    
    this fixes error checking. Test failures were not being detected
    otherwise
    
    Pair-Programmed-With: Amitay Isaacs <amitay at gmail.com>

commit 862823a7764c692282dec7a93e7d37feeb924eef
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Nov 9 13:27:20 2011 +1100

    samba-tool: print samaccountname in samba-tool user list
    
    this is the attribute the admin needs for other commands
    
    Pair-Programmed-With: Amitay Isaacs <amitay at gmail.com>

commit 39356761e5b7090851de2e909f471265f94d34be
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Nov 9 13:10:49 2011 +1100

    test: use planpythontestsuite() for ldb.python test
    
    Pair-Programmed-With: Amitay Isaacs <amitay at gmail.com>

commit b0be72d5080aed3da3f33a45b72f88e90fbe3d13
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Nov 9 13:10:24 2011 +1100

    test: added directory option to planpythontestsuite()
    
    Pair-Programmed-With: Amitay Isaacs <amitay at gmail.com>

commit ac0bba2ea18e2e9ac578a333a3b260951e4c976e
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Nov 9 13:10:00 2011 +1100

    test: added -D option to subunitrun
    
    this allows for:
    
     subunitrun -D lib/ldb/tests/python api
    
    which makes this easier for developers

commit 333248f08c83cc5b18f8e7e84cb19d79a8309d6e
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Nov 9 13:09:08 2011 +1100

    pyldb: fixed ldb API test
    
    it was failing previously, but the failure wasn't being noticed

commit a04eac7aa2f5f9388cf92a8a79e0bd6938f8fd22
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Nov 9 13:08:37 2011 +1100

    build: only run symbol checking if running all tests
    
    this makes it much faster to run 1 test
    
    Pair-Programmed-With: Amitay Isaacs <amitay at gmail.com>

commit 58457e6cd23fc2661c464a2ab5b136ee6611b242
Author: Andrew Tridgell <tridge at samba.org>
Date:   Wed Nov 9 13:07:53 2011 +1100

    pyldb: enhanced get() method on msg object
    
    get() now takes a default value and an idx, allowing for much easier
    usage
    
    Pair-Programmed-With: Amitay Isaacs <amitay at gmail.com>

commit 1cef3212a1099b87769c473ee99c0c0f2a4d2b04
Author: Giampaolo Lauria <lauria2 at yahoo.com>
Date:   Tue Nov 8 14:59:19 2011 -0500

    samba-tool: Added new "user disable" command

commit 34ff5d29e66eac3041204b9cd481a2e7887b1fc9
Author: Giampaolo Lauria <lauria2 at yahoo.com>
Date:   Tue Nov 8 11:51:42 2011 -0500

    samba-tool: Added "user list" command

commit da21ff82a50190da9023ef39046ec967d389ef97
Author: Giampaolo Lauria <lauria2 at yahoo.com>
Date:   Mon Nov 7 13:39:07 2011 -0500

    samba-tool: Change internal argument name in domain machinepassword

commit 53fc437d057208d182ec0afaa087ea8791c753ca
Author: Giampaolo Lauria <lauria2 at yahoo.com>
Date:   Tue Nov 1 15:28:54 2011 -0400

    samba-tool: Fix domain machinepassword secret db search
    
    pair programmed with Jelmer Vernooij
    Add search to include secrets.ldb

commit ec5afae2925703c51c3ac6d26428b56954d8a57a
Author: Giampaolo Lauria <lauria2 at yahoo.com>
Date:   Tue Nov 1 15:25:31 2011 -0400

    samba-tool: Fix domain machinepassword name search
    
    Append '$' to name provided by user to search for a machine account
    when necessary

commit 46723aa2da81742995950ca3c6f403e081c5ba05
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Nov 7 15:24:01 2011 +1100

    s4-test: improved error checking in samba-tool time test
    
    Pair-Programmed-With: Amitay Isaacs <amitay at gmail.com>

commit a7c1add5c49e4c241bfe95ca018b75a2889a2141
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Nov 7 15:19:09 2011 +1100

    s4-socket: detect NULL server in socket connection code
    
    return NT_STATUS_NOT_FOUND instead of a segfault
    
    Pair-Programmed-With: Amitay Isaacs <amitay at gmail.com>

commit e118d91a63df15edc71ca28f456197e9a36e648a
Author: Sean Dague <sdague at linux.vnet.ibm.com>
Date:   Wed Nov 2 10:02:47 2011 -0400

    test: enable time and user samba-tool tests
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

commit a818253960d25f3f48cdf8cd3fab5e13f39d29ee
Author: Sean Dague <sdague at linux.vnet.ibm.com>
Date:   Wed Nov 2 10:02:29 2011 -0400

    test: add samba-tool user tests
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

commit a66eae9a6d599f9bf5572dbe1be8ee0450c5df21
Author: Sean Dague <sdague at linux.vnet.ibm.com>
Date:   Wed Nov 2 10:02:09 2011 -0400

    test: Add samba-tool time tests
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

commit 559835dc59a074219ca71c0f8be5d881d2f5aede
Author: Sean Dague <sdague at linux.vnet.ibm.com>
Date:   Wed Nov 2 10:01:42 2011 -0400

    test: add directory and base class for samba-tool tests
    
    this allows for more sophisticated testing of samba-tool
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 Makefile                                           |    8 +-
 auth/credentials/tests/bind.py                     |    4 +-
 lib/ldb/pyldb.c                                    |   47 +++--
 lib/ldb/tests/python/api.py                        |   75 ++++----
 selftest/selftesthelpers.py                        |   17 +-
 selftest/wscript                                   |    7 +
 source4/dsdb/tests/python/deletetest.py            |    3 +-
 source4/dsdb/tests/python/ldap.py                  |    4 +-
 source4/dsdb/tests/python/ldap_schema.py           |    6 +-
 source4/dsdb/tests/python/ldap_syntaxes.py         |    2 +-
 source4/dsdb/tests/python/sam.py                   |    2 +-
 source4/lib/policy/tests/python/bindings.py        |    4 +-
 source4/lib/socket/connect_multi.c                 |    5 +
 source4/scripting/bin/subunitrun                   |    5 +
 source4/scripting/python/samba/netcmd/domain.py    |   14 +-
 source4/scripting/python/samba/netcmd/group.py     |   79 +++++++-
 source4/scripting/python/samba/netcmd/time.py      |   15 ++-
 source4/scripting/python/samba/netcmd/user.py      |   64 ++++++
 source4/scripting/python/samba/samdb.py            |   10 +
 .../tests/{blackbox => samba_tool}/__init__.py     |    8 +-
 .../python/samba/tests/samba_tool/base.py          |  109 ++++++++++
 .../python/samba/tests/samba_tool/timecmd.py       |   45 ++++
 .../python/samba/tests/samba_tool/user.py          |  215 ++++++++++++++++++++
 source4/selftest/tests.py                          |    7 +-
 24 files changed, 662 insertions(+), 93 deletions(-)
 copy source4/scripting/python/samba/tests/{blackbox => samba_tool}/__init__.py (88%)
 create mode 100644 source4/scripting/python/samba/tests/samba_tool/base.py
 create mode 100644 source4/scripting/python/samba/tests/samba_tool/timecmd.py
 create mode 100644 source4/scripting/python/samba/tests/samba_tool/user.py


Changeset truncated at 500 lines:

diff --git a/Makefile b/Makefile
index 0552052..3b40c73 100644
--- a/Makefile
+++ b/Makefile
@@ -13,20 +13,20 @@ uninstall:
 	$(WAF) uninstall
 
 test:
-	$(WAF) test --dup-symbol-check $(TEST_OPTIONS)
+	$(WAF) test $(TEST_OPTIONS)
 
 help:
 	@echo NOTE: to run extended waf options use $(WAF_BINARY) or modify your PATH
 	$(WAF) --help
 
 subunit-test:
-	$(WAF) test --dup-symbol-check --filtered-subunit $(TEST_OPTIONS)
+	$(WAF) test --filtered-subunit $(TEST_OPTIONS)
 
 testenv:
-	$(WAF) test --dup-symbol-check --testenv $(TEST_OPTIONS)
+	$(WAF) test --testenv $(TEST_OPTIONS)
 
 quicktest:
-	$(WAF) test --dup-symbol-check --quick $(TEST_OPTIONS)
+	$(WAF) test --quick $(TEST_OPTIONS)
 
 dist:
 	touch .tmplock
diff --git a/auth/credentials/tests/bind.py b/auth/credentials/tests/bind.py
index 1529a47..aa4b17a 100755
--- a/auth/credentials/tests/bind.py
+++ b/auth/credentials/tests/bind.py
@@ -25,10 +25,10 @@ from samba.auth import system_session
 from samba import gensec
 from samba.samdb import SamDB
 from samba.credentials import Credentials
-import samba.tests
+import samba.tests, unittest
 from samba.tests import delete_force
 from subunit.run import SubunitTestRunner
-import unittest
+from samba.tests import TestCase, TestSkipped
 
 parser = optparse.OptionParser("ldap [options] <host>")
 sambaopts = options.SambaOptions(parser)
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index b46bdcd..2f1a6a3 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -2533,24 +2533,38 @@ static PyObject *py_ldb_msg_getitem(PyLdbMessageObject *self, PyObject *py_name)
 	return ret;
 }
 
-static PyObject *py_ldb_msg_get(PyLdbMessageObject *self, PyObject *args)
+static PyObject *py_ldb_msg_get(PyLdbMessageObject *self, PyObject *args, PyObject *kwargs)
 {
-	PyObject *name, *ret, *retobj;
-	retobj = NULL;
-	if (!PyArg_ParseTuple(args, "O|O", &name, &retobj))
+	PyObject *def = NULL;
+	const char *kwnames[] = { "name", "default", "idx", NULL };
+	const char *name = NULL;
+	int idx = -1;
+	struct ldb_message *msg = pyldb_Message_AsMessage(self);
+	struct ldb_message_element *el;
+
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|Oi:msg",
+					 discard_const_p(char *, kwnames), &name, &def, &idx)) {
 		return NULL;
+	}
 
-	ret = py_ldb_msg_getitem_helper(self, name);
-	if (ret == NULL) {
-		if (PyErr_Occurred())
-			return NULL;
-		if (retobj != NULL) {
-			return retobj;
-		} else {
-			Py_RETURN_NONE;
+	if (strcasecmp(name, "dn") == 0) {
+		return pyldb_Dn_FromDn(msg->dn);
+	}
+
+	el = ldb_msg_find_element(msg, name);
+
+	if (el == NULL || (idx != -1 && el->num_values <= idx)) {
+		if (def != NULL) {
+			return def;
 		}
+		Py_RETURN_NONE;
 	}
-	return ret;
+
+	if (idx == -1) {
+		return (PyObject *)PyLdbMessageElement_FromMessageElement(el, msg->elements);
+	}
+
+	return PyObject_FromLdbValue(&el->values[idx]);
 }
 
 static PyObject *py_ldb_msg_items(PyLdbMessageObject *self)
@@ -2614,7 +2628,12 @@ static PyMethodDef py_ldb_msg_methods[] = {
 	{ "remove", (PyCFunction)py_ldb_msg_remove_attr, METH_VARARGS, 
 		"S.remove(name)\n\n"
 		"Remove all entries for attributes with the specified name."},
-	{ "get", (PyCFunction)py_ldb_msg_get, METH_VARARGS, NULL },
+	{ "get", (PyCFunction)py_ldb_msg_get, METH_VARARGS | METH_KEYWORDS,
+	  "msg.get(name,default=None,idx=None) -> string\n"
+	  "idx is the index into the values array\n"
+	  "if idx is None, then a list is returned\n"
+	  "if idx is not None, then the element with that index is returned\n"
+	  "if you pass the special name 'dn' then the DN object is returned\n"},
 	{ "items", (PyCFunction)py_ldb_msg_items, METH_NOARGS, NULL },
 	{ "elements", (PyCFunction)py_ldb_msg_elements, METH_NOARGS, NULL },
 	{ "add", (PyCFunction)py_ldb_msg_add, METH_VARARGS,
diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py
index 6a8df25..4a582be 100755
--- a/lib/ldb/tests/python/api.py
+++ b/lib/ldb/tests/python/api.py
@@ -2,8 +2,8 @@
 # Simple tests for the ldb python bindings.
 # Copyright (C) 2007 Jelmer Vernooij <jelmer at samba.org>
 
-import os
-import unittest
+import os, sys
+from samba.tests import TestCase, TestSkipped
 
 import ldb
 
@@ -16,7 +16,7 @@ def filename():
         dir_prefix = None
     return tempfile.mktemp(dir=dir_prefix)
 
-class NoContextTests(unittest.TestCase):
+class NoContextTests(TestCase):
 
     def test_valid_attr_name(self):
         self.assertTrue(ldb.valid_attr_name("foo"))
@@ -31,11 +31,11 @@ class NoContextTests(unittest.TestCase):
         self.assertEquals(1195499412, ldb.string_to_time("20071119191012.0Z"))
 
     def test_binary_encode(self):
-        encoded = self.binary_encode('test\\x')
-        decoded = self.binary_decode(encoded)
+        encoded = ldb.binary_encode('test\\x')
+        decoded = ldb.binary_decode(encoded)
         self.assertEquals(decoded, 'test\\x')
 
-class SimpleLdb(unittest.TestCase):
+class SimpleLdb(TestCase):
 
     def test_connect(self):
         ldb.Ldb(filename())
@@ -55,10 +55,6 @@ class SimpleLdb(unittest.TestCase):
         x = ldb.Ldb()
         x.set_create_perms(0600)
 
-    def test_set_modules_dir(self):
-        x = ldb.Ldb()
-        x.set_modules_dir("/tmp")
-
     def test_modules_none(self):
         x = ldb.Ldb()
         self.assertEquals([], x.modules())
@@ -69,11 +65,11 @@ class SimpleLdb(unittest.TestCase):
 
     def test_search(self):
         l = ldb.Ldb(filename())
-        self.assertEquals(len(l.search()), 1)
+        self.assertEquals(len(l.search()), 0)
 
     def test_search_controls(self):
         l = ldb.Ldb(filename())
-        self.assertEquals(len(l.search(controls=["paged_results:0:5"])), 1)
+        self.assertEquals(len(l.search(controls=["paged_results:0:5"])), 0)
 
     def test_search_attrs(self):
         l = ldb.Ldb(filename())
@@ -146,10 +142,10 @@ class SimpleLdb(unittest.TestCase):
         m = ldb.Message()
         m.dn = ldb.Dn(l, "dc=foo4")
         m["bla"] = "bla"
-        self.assertEquals(len(l.search()), 1)
+        self.assertEquals(len(l.search()), 0)
         l.add(m)
         try:
-            self.assertEquals(len(l.search()), 2)
+            self.assertEquals(len(l.search()), 1)
         finally:
             l.delete(ldb.Dn(l, "dc=foo4"))
 
@@ -158,27 +154,27 @@ class SimpleLdb(unittest.TestCase):
         m = ldb.Message()
         m.dn = ldb.Dn(l, "dc=foo4")
         m["bla"] = "bla"
-        self.assertEquals(len(l.search()), 1)
+        self.assertEquals(len(l.search()), 0)
         self.assertRaises(ldb.LdbError, lambda: l.add(m,["search_options:1:2"]))
 
     def test_add_dict(self):
         l = ldb.Ldb(filename())
         m = {"dn": ldb.Dn(l, "dc=foo5"),
              "bla": "bla"}
-        self.assertEquals(len(l.search()), 1)
+        self.assertEquals(len(l.search()), 0)
         l.add(m)
         try:
-            self.assertEquals(len(l.search()), 2)
+            self.assertEquals(len(l.search()), 1)
         finally:
             l.delete(ldb.Dn(l, "dc=foo5"))
 
     def test_add_dict_string_dn(self):
         l = ldb.Ldb(filename())
         m = {"dn": "dc=foo6", "bla": "bla"}
-        self.assertEquals(len(l.search()), 1)
+        self.assertEquals(len(l.search()), 0)
         l.add(m)
         try:
-            self.assertEquals(len(l.search()), 2)
+            self.assertEquals(len(l.search()), 1)
         finally:
             l.delete(ldb.Dn(l, "dc=foo6"))
 
@@ -187,11 +183,11 @@ class SimpleLdb(unittest.TestCase):
         m = ldb.Message()
         m.dn = ldb.Dn(l, "dc=foo7")
         m["bla"] = "bla"
-        self.assertEquals(len(l.search()), 1)
+        self.assertEquals(len(l.search()), 0)
         l.add(m)
         try:
             l.rename(ldb.Dn(l, "dc=foo7"), ldb.Dn(l, "dc=bar"))
-            self.assertEquals(len(l.search()), 2)
+            self.assertEquals(len(l.search()), 1)
         finally:
             l.delete(ldb.Dn(l, "dc=bar"))
 
@@ -200,12 +196,12 @@ class SimpleLdb(unittest.TestCase):
         m = ldb.Message()
         m.dn = ldb.Dn(l, "dc=foo8")
         m["bla"] = "bla"
-        self.assertEquals(len(l.search()), 1)
+        self.assertEquals(len(l.search()), 0)
         l.add(m)
-        self.assertEquals(len(l.search()), 2)
+        self.assertEquals(len(l.search()), 1)
         try:
             l.rename("dc=foo8", "dc=bar")
-            self.assertEquals(len(l.search()), 2)
+            self.assertEquals(len(l.search()), 1)
         finally:
             l.delete(ldb.Dn(l, "dc=bar"))
 
@@ -336,9 +332,10 @@ class SimpleLdb(unittest.TestCase):
         self.assertRaises(ldb.LdbError,lambda: l.search("", ldb.SCOPE_SUBTREE, "&(dc=*)(dn=*)", ["dc"]))
 
 
-class DnTests(unittest.TestCase):
+class DnTests(TestCase):
 
     def setUp(self):
+        super(DnTests, self).setUp()
         self.ldb = ldb.Ldb(filename())
 
     def test_set_dn_invalid(self):
@@ -454,9 +451,10 @@ class DnTests(unittest.TestCase):
         self.assertFalse(dn3.is_child_of(dn2))
         self.assertFalse(dn1.is_child_of(dn4))
 
-class LdbMsgTests(unittest.TestCase):
+class LdbMsgTests(TestCase):
 
     def setUp(self):
+        super(LdbMsgTests, self).setUp()
         self.msg = ldb.Message()
 
     def test_init_dn(self):
@@ -531,10 +529,12 @@ class LdbMsgTests(unittest.TestCase):
     def test_get_other(self):
         self.msg["foo"] = ["bar"]
         self.assertEquals("bar", self.msg.get("foo")[0])
+        self.assertEquals("bar", self.msg.get("foo", idx=0))
+        self.assertEquals(None, self.msg.get("foo", idx=1))
+        self.assertEquals("", self.msg.get("foo", default='', idx=1))
 
     def test_get_default(self):
-        self.assertEquals(None, self.msg.get("tatayoyo"))
-
+        self.assertEquals(None, self.msg.get("tatayoyo", idx=0))
         self.assertEquals("anniecordie", self.msg.get("tatayoyo", "anniecordie"))
 
     def test_get_unknown(self):
@@ -588,7 +588,7 @@ class LdbMsgTests(unittest.TestCase):
 
 
 
-class MessageElementTests(unittest.TestCase):
+class MessageElementTests(TestCase):
 
     def test_cmp_element(self):
         x = ldb.MessageElement(["foo"])
@@ -633,7 +633,7 @@ class MessageElementTests(unittest.TestCase):
         self.assertEquals("MessageElement(['456'])", repr(el))
 
 
-class ModuleTests(unittest.TestCase):
+class ModuleTests(TestCase):
 
     def test_register_module(self):
         class ExampleModule:
@@ -652,8 +652,8 @@ class ModuleTests(unittest.TestCase):
             def search(self, *args, **kwargs):
                 return self.next.search(*args, **kwargs)
 
-        def request(self, *args, **kwargs):
-            pass
+            def request(self, *args, **kwargs):
+                pass
 
         name = filename()
         ldb.register_module(ExampleModule)
@@ -665,9 +665,10 @@ class ModuleTests(unittest.TestCase):
         l = ldb.Ldb(name)
         self.assertEquals(["init"], ops)
 
-class LdbResultTests(unittest.TestCase):
+class LdbResultTests(TestCase):
 
     def setUp(self):
+        super(LdbResultTests, self).setUp()
         name = filename()
         self.name = name
         if os.path.exists(name):
@@ -688,6 +689,7 @@ class LdbResultTests(unittest.TestCase):
         self.l.add({"dn": "OU=OU10,DC=SAMBA,DC=ORG", "name": "OU #10"})
 
     def tearDown(self):
+        super(LdbResultTests, self).tearDown()
         if os.path.exists(self.name):
             os.unlink(self.name)
 
@@ -753,12 +755,7 @@ class LdbResultTests(unittest.TestCase):
                 found = True
         self.assertTrue(found)
 
-class VersionTests(unittest.TestCase):
+class VersionTests(TestCase):
 
     def test_version(self):
         self.assertTrue(isinstance(ldb.__version__, str))
-
-
-if __name__ == '__main__':
-    import unittest
-    unittest.TestProgram()
diff --git a/selftest/selftesthelpers.py b/selftest/selftesthelpers.py
index 085c62c..58a2f0f 100644
--- a/selftest/selftesthelpers.py
+++ b/selftest/selftesthelpers.py
@@ -158,10 +158,17 @@ def planperltestsuite(name, path):
         skiptestsuite(name, "Test::More not available")
 
 
-def planpythontestsuite(env, module):
+def planpythontestsuite(env, module, name=None, directory=None):
+
+    if name is None:
+        name = module
     if has_system_subunit_run:
-        plantestsuite_idlist(module, env, [python, "-m", "subunit.run", "$LISTOPT", module])
+        cmd = [python, "-m", "subunit.run", "$LISTOPT", module]
+        if directory is not None:
+            cmd.extend(['-D', directory])
+        plantestsuite_idlist(name, env, cmd)
     else:
-        plantestsuite_idlist(module, env, "PYTHONPATH=$PYTHONPATH:%s/lib/subunit/python:%s/lib/testtools %s -m subunit.run $LISTOPT %s" % (srcdir(), srcdir(), python, module))
-
-
+        cmd = "PYTHONPATH=$PYTHONPATH:%s/lib/subunit/python:%s/lib/testtools %s -m subunit.run $LISTOPT %s" % (srcdir(), srcdir(), python, module)
+        if directory is not None:
+            cmd += ' -D %s' % directory
+        plantestsuite_idlist(name, env, cmd)
diff --git a/selftest/wscript b/selftest/wscript
index 4d3d8f2..b469709 100644
--- a/selftest/wscript
+++ b/selftest/wscript
@@ -205,5 +205,12 @@ def cmd_testonly(opt):
 # main test entry point
 def cmd_test(opt):
     '''Run the test suite (see test options below)'''
+
+    # if running all tests, then force a symbol check
+    env = LOAD_ENVIRONMENT()
+    CHECK_MAKEFLAGS(env)
+    if not Options.options.TESTS:
+        Options.options.DUP_SYMBOLCHECK = True
+
     Scripting.commands.append('build')
     Scripting.commands.append('testonly')
diff --git a/source4/dsdb/tests/python/deletetest.py b/source4/dsdb/tests/python/deletetest.py
index 80c6937..ce972ab 100755
--- a/source4/dsdb/tests/python/deletetest.py
+++ b/source4/dsdb/tests/python/deletetest.py
@@ -40,13 +40,14 @@ host = args[0]
 lp = sambaopts.get_loadparm()
 creds = credopts.get_credentials(lp)
 
-class BasicDeleteTests(unittest.TestCase):
+class BasicDeleteTests(samba.tests.TestCase):
 
 
     def GUID_string(self, guid):
         return self.ldb.schema_format_value("objectGUID", guid)
 
     def setUp(self):
+        super(BasicDeleteTests, self).setUp()
         self.ldb = ldb
         self.base_dn = ldb.domain_dn()
         self.configuration_dn = ldb.get_config_basedn().get_linearized()
diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py
index 9009c74..61443ef 100755
--- a/source4/dsdb/tests/python/ldap.py
+++ b/source4/dsdb/tests/python/ldap.py
@@ -60,7 +60,7 @@ host = args[0]
 lp = sambaopts.get_loadparm()
 creds = credopts.get_credentials(lp)
 
-class BasicTests(unittest.TestCase):
+class BasicTests(samba.tests.TestCase):
 
     def setUp(self):
         super(BasicTests, self).setUp()
@@ -2768,7 +2768,7 @@ nTSecurityDescriptor:: """ + desc_base64
         self.assertTrue("whenCreated" in res[0])
         self.assertTrue("whenChanged" in res[0])
 
-class BaseDnTests(unittest.TestCase):
+class BaseDnTests(samba.tests.TestCase):
 
     def setUp(self):
         super(BaseDnTests, self).setUp()
diff --git a/source4/dsdb/tests/python/ldap_schema.py b/source4/dsdb/tests/python/ldap_schema.py
index a6503e2..5de0479 100755
--- a/source4/dsdb/tests/python/ldap_schema.py
+++ b/source4/dsdb/tests/python/ldap_schema.py
@@ -48,7 +48,7 @@ lp = sambaopts.get_loadparm()
 creds = credopts.get_credentials(lp)
 
 
-class SchemaTests(unittest.TestCase):
+class SchemaTests(samba.tests.TestCase):
 
     def setUp(self):
         super(SchemaTests, self).setUp()
@@ -246,7 +246,7 @@ instanceType: 4
         delete_force(self.ldb, "ou=%s,%s" % (object_name, self.base_dn))
 
 
-class SchemaTests_msDS_IntId(unittest.TestCase):
+class SchemaTests_msDS_IntId(samba.tests.TestCase):
 
     def setUp(self):
         super(SchemaTests_msDS_IntId, self).setUp()
@@ -518,7 +518,7 @@ systemOnly: FALSE
                 self.assertTrue("msDS-IntId" not in ldb_msg)
 
 
-class SchemaTests_msDS_isRODC(unittest.TestCase):
+class SchemaTests_msDS_isRODC(samba.tests.TestCase):
 
     def setUp(self):
         super(SchemaTests_msDS_isRODC, self).setUp()
diff --git a/source4/dsdb/tests/python/ldap_syntaxes.py b/source4/dsdb/tests/python/ldap_syntaxes.py
index 64e0c42..ad89cb1 100644
--- a/source4/dsdb/tests/python/ldap_syntaxes.py
+++ b/source4/dsdb/tests/python/ldap_syntaxes.py
@@ -44,7 +44,7 @@ lp = sambaopts.get_loadparm()
 creds = credopts.get_credentials(lp)
 
 
-class SyntaxTests(unittest.TestCase):
+class SyntaxTests(samba.tests.TestCase):
 
     def setUp(self):
         super(SyntaxTests, self).setUp()
diff --git a/source4/dsdb/tests/python/sam.py b/source4/dsdb/tests/python/sam.py
index b08fba5..7f5b74d 100755
--- a/source4/dsdb/tests/python/sam.py
+++ b/source4/dsdb/tests/python/sam.py
@@ -63,7 +63,7 @@ host = args[0]
 lp = sambaopts.get_loadparm()
 creds = credopts.get_credentials(lp)
 
-class SamTests(unittest.TestCase):
+class SamTests(samba.tests.TestCase):
 
     def setUp(self):


-- 
Samba Shared Repository


More information about the samba-cvs mailing list