[SCM] Samba Shared Repository - branch master updated

Jelmer Vernooij jelmer at samba.org
Mon Nov 24 05:07:03 MST 2014


The branch, master has been updated
       via  b7efc12 Print number of slow tests from script rather than wscript.
       via  869a9f7 sam: Use samba.tests.subunitrun.
       via  4f75f17 Use samba.tests.subunitrun in dsdb ldap and ldap_schema tests.
       via  98b5380 Use samba.tests.subunitrun in urgent replication test.
      from  2c67d55 Include mimeparse, which is used by subunit/testtools.

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


- Log -----------------------------------------------------------------
commit b7efc124065612d9c4c35e2e7447a5ee5d150d1f
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Nov 1 13:54:31 2014 -0700

    Print number of slow tests from script rather than wscript.
    
    Change-Id: I6eaa0803b95cc81f514a2176f4e06f1e3fff4077
    Signed-Off-By: Jelmer Vernooij <jelmer at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Jelmer Vernooij <jelmer at samba.org>
    Autobuild-Date(master): Mon Nov 24 13:06:46 CET 2014 on sn-devel-104

commit 869a9f7a3a01810c1c1e3287b82034f67457b0b5
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Nov 2 09:00:09 2014 -0800

    sam: Use samba.tests.subunitrun.
    
    Change-Id: Ic2ac4b335cf805ddbd442a065c4eaf6ef2b210d9
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 4f75f17ba7c9b80cf3aa0ce2db57e1754464403a
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Nov 1 21:31:18 2014 -0700

    Use samba.tests.subunitrun in dsdb ldap and ldap_schema tests.
    
    Change-Id: I51ddc55720a23013a2c6ae20e3225f027348083c
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 98b5380af65ea1ec760d00187355384de0757b04
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Nov 1 21:22:59 2014 -0700

    Use samba.tests.subunitrun in urgent replication test.
    
    Change-Id: I3e7a32876d557ac376326ab75e851298e874d584
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 script/show_testsuite_time                      |  2 +
 selftest/wscript                                |  5 +--
 source4/dsdb/tests/python/ldap.py               | 34 ++++++++-------
 source4/dsdb/tests/python/ldap_schema.py        | 55 ++++++++++++++-----------
 source4/dsdb/tests/python/sam.py                | 12 ++----
 source4/dsdb/tests/python/urgent_replication.py | 17 ++------
 6 files changed, 62 insertions(+), 63 deletions(-)


Changeset truncated at 500 lines:

diff --git a/script/show_testsuite_time b/script/show_testsuite_time
index fb9ea2f..6e5808a 100755
--- a/script/show_testsuite_time
+++ b/script/show_testsuite_time
@@ -22,6 +22,8 @@ if ($#ARGV >= 1) {
 	}
 }
 
+print "TOP $max slowest tests\n";
+
 while(<$fh>)
 {
 	if (m/^testsuite: (.*)/) {
diff --git a/selftest/wscript b/selftest/wscript
index fd92531..cf57adc 100644
--- a/selftest/wscript
+++ b/selftest/wscript
@@ -135,10 +135,10 @@ def cmd_testonly(opt):
                       'nmblookup4:nmblookup4,' +
                       'smbclient3:smbclient,' +
                       'smbclient4:smbclient4,' +
-                      'smbtorture4:smbtorture,' + 
+                      'smbtorture4:smbtorture,' +
                       'ntlm_auth3:ntlm_auth')
 
-    env.OPTIONS = '--binary-mapping=%s' % binary_mapping 
+    env.OPTIONS = '--binary-mapping=%s' % binary_mapping
     if not Options.options.SLOWTEST:
         env.OPTIONS += ' --exclude=${srcdir}/selftest/slow'
     if Options.options.QUICKTEST:
@@ -241,7 +241,6 @@ def cmd_testonly(opt):
     subunit_file = "%s/subunit" % env.SELFTEST_PREFIX
     if os.path.exists(subunit_file):
         nb = Options.options.NB_SLOWEST
-        print "TOP %d slowest tests" % nb
         cmd = "./script/show_testsuite_time %s %d" % (subunit_file, nb)
         runcmd = EXPAND_VARIABLES(opt, cmd)
         RUN_COMMAND(runcmd, env=env)
diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py
index b1f0d6a..7139f3c 100755
--- a/source4/dsdb/tests/python/ldap.py
+++ b/source4/dsdb/tests/python/ldap.py
@@ -2,6 +2,21 @@
 # -*- coding: utf-8 -*-
 # This is a port of the original in testprogs/ejs/ldap.js
 
+# Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2008-2011
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 import optparse
 import sys
 import time
@@ -10,9 +25,7 @@ import os
 
 sys.path.insert(0, "bin/python")
 import samba
-samba.ensure_external_module("testtools", "testtools")
-samba.ensure_external_module("subunit", "subunit/python")
-
+from samba.tests.subunitrun import SubunitOptions, TestProgram
 import samba.getopt as options
 
 from samba.auth import system_session
@@ -35,9 +48,6 @@ from samba.dsdb import (UF_NORMAL_ACCOUNT,
     SYSTEM_FLAG_CONFIG_ALLOW_RENAME, SYSTEM_FLAG_CONFIG_ALLOW_MOVE,
     SYSTEM_FLAG_CONFIG_ALLOW_LIMITED_MOVE)
 
-from subunit.run import SubunitTestRunner
-import unittest
-
 from samba.ndr import ndr_pack, ndr_unpack
 from samba.dcerpc import security, lsa
 from samba.tests import delete_force
@@ -49,6 +59,8 @@ parser.add_option_group(options.VersionOptions(parser))
 # use command line creds if available
 credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
+subunitopts = SubunitOptions(parser)
+parser.add_option_group(subunitopts)
 opts, args = parser.parse_args()
 
 if len(args) < 1:
@@ -2974,12 +2986,4 @@ if not "tdb://" in host:
 else:
     gc_ldb = None
 
-runner = SubunitTestRunner()
-suite = unittest.TestSuite()
-suite.addTests(unittest.makeSuite(BaseDnTests))
-suite.addTests(unittest.makeSuite(BasicTests))
-if not runner.run(suite).wasSuccessful():
-    rc = 1
-else:
-    rc = 0
-sys.exit(rc)
+TestProgram(module=__name__, opts=subunitopts)
diff --git a/source4/dsdb/tests/python/ldap_schema.py b/source4/dsdb/tests/python/ldap_schema.py
index fb0ef9c..1de6519 100755
--- a/source4/dsdb/tests/python/ldap_schema.py
+++ b/source4/dsdb/tests/python/ldap_schema.py
@@ -2,6 +2,23 @@
 # -*- coding: utf-8 -*-
 # This is a port of the original in testprogs/ejs/ldap.js
 
+# Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2008-2011
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+
 import optparse
 import sys
 import time
@@ -10,8 +27,7 @@ import os
 
 sys.path.insert(0, "bin/python")
 import samba
-samba.ensure_external_module("testtools", "testtools")
-samba.ensure_external_module("subunit", "subunit/python")
+from samba.tests.subunitrun import TestProgram, SubunitOptions
 
 import samba.getopt as options
 
@@ -26,9 +42,6 @@ from samba.samdb import SamDB
 from samba.dsdb import DS_DOMAIN_FUNCTION_2003
 from samba.tests import delete_force
 
-from subunit.run import SubunitTestRunner
-import unittest
-
 parser = optparse.OptionParser("ldap_schema.py [options] <host>")
 sambaopts = options.SambaOptions(parser)
 parser.add_option_group(sambaopts)
@@ -36,6 +49,8 @@ parser.add_option_group(options.VersionOptions(parser))
 # use command line creds if available
 credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
+subunitopts = SubunitOptions(parser)
+parser.add_option_group(subunitopts)
 opts, args = parser.parse_args()
 
 if len(args) < 1:
@@ -52,9 +67,10 @@ class SchemaTests(samba.tests.TestCase):
 
     def setUp(self):
         super(SchemaTests, self).setUp()
-        self.ldb = ldb
-        self.base_dn = ldb.domain_dn()
-        self.schema_dn = ldb.get_schema_basedn().get_linearized()
+        self.ldb = SamDB(host, credentials=creds,
+            session_info=system_session(lp), lp=lp, options=ldb_options)
+        self.base_dn = self.ldb.domain_dn()
+        self.schema_dn = self.ldb.get_schema_basedn().get_linearized()
 
     def test_generated_schema(self):
         """Testing we can read the generated schema via LDAP"""
@@ -264,8 +280,9 @@ class SchemaTests_msDS_IntId(samba.tests.TestCase):
 
     def setUp(self):
         super(SchemaTests_msDS_IntId, self).setUp()
-        self.ldb = ldb
-        res = ldb.search(base="", expression="", scope=SCOPE_BASE,
+        self.ldb = SamDB(host, credentials=creds,
+            session_info=system_session(lp), lp=lp, options=ldb_options)
+        res = self.ldb.search(base="", expression="", scope=SCOPE_BASE,
                          attrs=["schemaNamingContext", "defaultNamingContext",
                                 "forestFunctionality"])
         self.assertEquals(len(res), 1)
@@ -540,8 +557,9 @@ class SchemaTests_msDS_isRODC(samba.tests.TestCase):
 
     def setUp(self):
         super(SchemaTests_msDS_isRODC, self).setUp()
-        self.ldb = ldb
-        res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["defaultNamingContext"])
+        self.ldb =  SamDB(host, credentials=creds,
+            session_info=system_session(lp), lp=lp, options=ldb_options)
+        res = self.ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["defaultNamingContext"])
         self.assertEquals(len(res), 1)
         self.base_dn = res[0]["defaultNamingContext"][0]
 
@@ -585,15 +603,4 @@ if host.startswith("ldap://"):
     # user 'paged_search' module when connecting remotely
     ldb_options = ["modules:paged_searches"]
 
-ldb = SamDB(host, credentials=creds, session_info=system_session(lp), lp=lp, options=ldb_options)
-
-runner = SubunitTestRunner()
-rc = 0
-if not runner.run(unittest.makeSuite(SchemaTests)).wasSuccessful():
-    rc = 1
-if not runner.run(unittest.makeSuite(SchemaTests_msDS_IntId)).wasSuccessful():
-    rc = 1
-if not runner.run(unittest.makeSuite(SchemaTests_msDS_isRODC)).wasSuccessful():
-    rc = 1
-
-sys.exit(rc)
+TestProgram(module=__name__, opts=subunitopts)
diff --git a/source4/dsdb/tests/python/sam.py b/source4/dsdb/tests/python/sam.py
index 804905b..31b5a39 100755
--- a/source4/dsdb/tests/python/sam.py
+++ b/source4/dsdb/tests/python/sam.py
@@ -8,6 +8,7 @@ import os
 
 sys.path.insert(0, "bin/python")
 import samba
+from samba.tests.subunitrun import SubunitOptions, TestProgram
 samba.ensure_external_module("testtools", "testtools")
 samba.ensure_external_module("subunit", "subunit/python")
 
@@ -39,9 +40,6 @@ from samba.dsdb import (UF_NORMAL_ACCOUNT, UF_ACCOUNTDISABLE,
 from samba.dcerpc.security import (DOMAIN_RID_USERS, DOMAIN_RID_ADMINS,
     DOMAIN_RID_DOMAIN_MEMBERS, DOMAIN_RID_DCS, DOMAIN_RID_READONLY_DCS)
 
-from subunit.run import SubunitTestRunner
-import unittest
-
 from samba.dcerpc import security
 from samba.tests import delete_force
 
@@ -52,6 +50,8 @@ parser.add_option_group(options.VersionOptions(parser))
 # use command line creds if available
 credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
+subunitopts = SubunitOptions(parser)
+parser.add_option_group(subunitopts)
 opts, args = parser.parse_args()
 
 if len(args) < 1:
@@ -2885,8 +2885,4 @@ if not "://" in host:
 
 ldb = SamDB(host, credentials=creds, session_info=system_session(lp), lp=lp)
 
-runner = SubunitTestRunner()
-rc = 0
-if not runner.run(unittest.makeSuite(SamTests)).wasSuccessful():
-    rc = 1
-sys.exit(rc)
+TestProgram(module=__name__, opts=subunitopts)
diff --git a/source4/dsdb/tests/python/urgent_replication.py b/source4/dsdb/tests/python/urgent_replication.py
index 8083ce4..19176c1 100755
--- a/source4/dsdb/tests/python/urgent_replication.py
+++ b/source4/dsdb/tests/python/urgent_replication.py
@@ -5,8 +5,7 @@ import optparse
 import sys
 sys.path.insert(0, "bin/python")
 import samba
-samba.ensure_external_module("testtools", "testtools")
-samba.ensure_external_module("subunit", "subunit/python")
+from samba.tests.subunitrun import TestProgram, SubunitOptions
 
 from ldb import (LdbError, ERR_NO_SUCH_OBJECT, Message,
     MessageElement, Dn, FLAG_MOD_REPLACE)
@@ -14,10 +13,6 @@ import samba.tests
 import samba.dsdb as dsdb
 import samba.getopt as options
 
-from subunit.run import SubunitTestRunner
-
-import unittest
-
 parser = optparse.OptionParser("urgent_replication.py [options] <host>")
 sambaopts = options.SambaOptions(parser)
 parser.add_option_group(sambaopts)
@@ -26,6 +21,8 @@ parser.add_option_group(options.VersionOptions(parser))
 # use command line creds if available
 credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
+subunitopts = SubunitOptions(parser)
+parser.add_option_group(subunitopts)
 opts, args = parser.parse_args()
 
 if len(args) < 1:
@@ -342,10 +339,4 @@ rIDAvailablePool: 133001-1073741823""", ["relax:0"])
         self.assertNotEquals(res["uSNHighest"], res["uSNUrgent"])
 
 
-runner = SubunitTestRunner()
-rc = 0
-#
-if not runner.run(unittest.makeSuite(UrgentReplicationTests)).wasSuccessful():
-    rc = 1
-
-sys.exit(rc)
+TestProgram(module=__name__, opts=subunitopts)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list