summaryrefslogtreecommitdiffstats
path: root/source4/scripting
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2014-11-02 08:32:24 -0800
committerJelmer Vernooij <jelmer@samba.org>2014-11-22 02:23:10 +0100
commitd6545fe27b35e63781f9f87fe9262bb933ffa9be (patch)
tree870c2eef3b17325600dbcc40db8286cc5ab479ed /source4/scripting
parent8d933a84c96859cbb782d5ac693f9badf2531947 (diff)
downloadsamba-d6545fe27b35e63781f9f87fe9262bb933ffa9be.tar.gz
samba-d6545fe27b35e63781f9f87fe9262bb933ffa9be.tar.xz
samba-d6545fe27b35e63781f9f87fe9262bb933ffa9be.zip
speedtest: Use samba.tests.subunitrun.
Change-Id: Id842c3f74aec24faeab68e975ff4d9e9a0dc337b Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/scripting')
-rwxr-xr-xsource4/scripting/devel/speedtest.py18
1 files changed, 4 insertions, 14 deletions
diff --git a/source4/scripting/devel/speedtest.py b/source4/scripting/devel/speedtest.py
index 84d3760c05..581966b617 100755
--- a/source4/scripting/devel/speedtest.py
+++ b/source4/scripting/devel/speedtest.py
@@ -30,8 +30,7 @@ from decimal import Decimal
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
@@ -45,18 +44,17 @@ from samba.samdb import SamDB
from samba.credentials import Credentials
import samba.tests
from samba.tests import delete_force
-from subunit.run import SubunitTestRunner
-import unittest
parser = optparse.OptionParser("speedtest.py [options] <host>")
sambaopts = options.SambaOptions(parser)
parser.add_option_group(sambaopts)
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:
@@ -230,12 +228,4 @@ if not "://" in host:
ldb_options = ["modules:paged_searches"]
ldb = SamDB(host, credentials=creds, session_info=system_session(), lp=lp, options=ldb_options)
-runner = SubunitTestRunner()
-suite = unittest.TestSuite()
-suite.addTests(unittest.makeSuite(SpeedTestAddDel))
-suite.addTests(unittest.makeSuite(AclSearchSpeedTest))
-if not runner.run(suite).wasSuccessful():
- rc = 1
-else:
- rc = 0
-sys.exit(rc)
+TestProgram(module=__name__, opts=subunitopts)