summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/samba/tests/subunitrun.py11
-rwxr-xr-xsource4/dsdb/tests/python/dirsync.py14
-rwxr-xr-xsource4/scripting/bin/subunitrun14
-rwxr-xr-xsource4/selftest/tests.py2
4 files changed, 21 insertions, 20 deletions
diff --git a/python/samba/tests/subunitrun.py b/python/samba/tests/subunitrun.py
index abb98813db..d45467607e 100644
--- a/python/samba/tests/subunitrun.py
+++ b/python/samba/tests/subunitrun.py
@@ -63,8 +63,13 @@ class SubunitOptions(optparse.OptionGroup):
class TestProgram(BaseTestProgram):
- def __init__(self, module=None, argv=None):
- if argv is None:
- argv = [sys.argv[0]]
+ def __init__(self, module=None, args=None, opts=None):
+ if args is None:
+ args = []
+ if getattr(opts, "listtests", False):
+ args.insert(0, "--list")
+ if getattr(opts, 'load_list', None):
+ args.insert(0, "--load-list=%s" % opts.load_list)
+ argv = [sys.argv[0]] + args
super(TestProgram, self).__init__(module=module, argv=argv,
testRunner=subunit.run.SubunitTestRunner())
diff --git a/source4/dsdb/tests/python/dirsync.py b/source4/dsdb/tests/python/dirsync.py
index a480518790..e6c5bbab64 100755
--- a/source4/dsdb/tests/python/dirsync.py
+++ b/source4/dsdb/tests/python/dirsync.py
@@ -2,7 +2,7 @@
#
# Unit tests for dirsync control
# Copyright (C) Matthieu Patou <mat@matws.net> 2011
-#
+# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2014
#
# 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
@@ -22,7 +22,7 @@ import optparse
import sys
sys.path.insert(0, "bin/python")
import samba
-from samba.tests.subunitrun import TestProgram
+from samba.tests.subunitrun import TestProgram, SubunitOptions
import samba.getopt as options
import base64
@@ -48,6 +48,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:
@@ -693,13 +695,9 @@ class ExtendedDirsyncTests(SimpleDirsyncTests):
self.assertEqual(str(res[0].dn), "")
-if getattr(opts, "listtests", False):
- args.insert(0, "--list")
-else:
+if not getattr(opts, "listtests", False):
lp = sambaopts.get_loadparm()
samba.tests.cmdline_credentials = credopts.get_credentials(lp)
-if getattr(opts, 'load_list', None):
- args.insert(0, "--load-list=%s" % opts.load_list)
-TestProgram(module=__name__)
+TestProgram(module=__name__, opts=subunitopts)
diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun
index 48b507a7b4..99d53196ee 100755
--- a/source4/scripting/bin/subunitrun
+++ b/source4/scripting/bin/subunitrun
@@ -10,18 +10,18 @@
# get e.g. credentials passed via command-line options to this
# script.
-# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2011
-#
+# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2014
+#
# 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/>.
#
@@ -78,10 +78,8 @@ parser.add_option_group(subunitopts)
opts, args = parser.parse_args()
-if getattr(opts, "listtests", False):
- args.insert(0, "--list")
-else:
+if not getattr(opts, "listtests", False):
lp = sambaopts.get_loadparm()
samba.tests.cmdline_credentials = credopts.get_credentials(lp)
-TestProgram(module=None, argv=[sys.argv[0]] + args)
+TestProgram(module=None, args=args, opts=subunitopts)
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index 910fdbb876..9feb9ad99b 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -470,7 +470,7 @@ planoldpythontestsuite("dc", "dsdb_schema_info",
name="samba4.schemaInfo.python(dc)",
extra_args=['-U"$DOMAIN/$DC_USERNAME%$DC_PASSWORD"'])
plantestsuite("samba4.urgent_replication.python(dc)", "dc:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/urgent_replication.py"), '$PREFIX_ABS/dc/private/sam.ldb'])
-plantestsuite("samba4.ldap.dirsync.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/dirsync.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
+plantestsuite_loadlist("samba4.ldap.dirsync.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/dirsync.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
plantestsuite("samba4.ldap.sites.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sites.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
plantestsuite("samba4.ldap_schema.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap_schema.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])