summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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