summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-04-14 19:13:41 +0200
committerAndrew Bartlett <abartlet@samba.org>2008-04-14 19:13:41 +0200
commit1bcbc4afcf2f9984081652c1fbe50d329c86b3b5 (patch)
tree074fbaf796f82a4bd3fe48488c880f196a915507 /source4
parentc1d9167fbcc5df9da4f603084ad732915c68c0c0 (diff)
downloadsamba-1bcbc4afcf2f9984081652c1fbe50d329c86b3b5.tar.gz
samba-1bcbc4afcf2f9984081652c1fbe50d329c86b3b5.tar.bz2
samba-1bcbc4afcf2f9984081652c1fbe50d329c86b3b5.zip
Allow command line options in the subunitrun script.
(This used to be commit 524ec0796efebd48e7b5b2eb5fcc92ecc13c0071)
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/scripting/bin/subunitrun22
-rw-r--r--source4/scripting/python/samba/tests/__init__.py12
2 files changed, 26 insertions, 8 deletions
diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun
index 11ac426589..3730a15e1b 100755
--- a/source4/scripting/bin/subunitrun
+++ b/source4/scripting/bin/subunitrun
@@ -20,6 +20,26 @@
from subunit import SubunitTestRunner
import sys
from unittest import TestProgram
+import optparse
+import os
+import param
+import samba.getopt as options
+import samba.tests
+
+parser = optparse.OptionParser("subunitrun [options] <tests>")
+credopts = options.CredentialsOptions(parser)
+parser.add_option_group(credopts)
+sambaopts = options.SambaOptions(parser)
+parser.add_option_group(sambaopts)
+parser.add_option_group(options.VersionOptions(parser))
+
+args = parser.parse_args()[1]
+
+samba.tests.cmdline_loadparm = sambaopts.get_loadparm()
+samba.tests.cmdline_credentials = credopts.get_credentials(samba.tests.cmdline_loadparm)
+
+import pdb
+pdb.set_trace()
runner = SubunitTestRunner()
-TestProgram(module=None, argv=sys.argv, testRunner=runner)
+program = TestProgram(module=None, argv=[sys.argv[0]] + args, testRunner=runner)
diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py
index ceb7dd23f3..e29b4a87d5 100644
--- a/source4/scripting/python/samba/tests/__init__.py
+++ b/source4/scripting/python/samba/tests/__init__.py
@@ -85,15 +85,13 @@ class LdbExtensionTests(TestCaseInTempDir):
os.unlink(path)
-def get_loadparm():
- import param
- lp = param.LoadParm()
- lp.load(os.getenv("SMB_CONF_PATH"))
- return lp
+cmdline_loadparm = None
+cmdline_credentials = None
class RpcInterfaceTestCase(unittest.TestCase):
def get_loadparm(self):
- return get_loadparm()
+ assert cmdline_loadparm is not None
+ return cmdline_loadparm
def get_credentials(self):
- return None
+ return cmdline_credentials