1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

perftest:ndr_pack_performance: remove irrelevant imports, options

This includes removing the ANCIENT_SAMBA switch for pre-4.3, as
nobody cares anymore and many tests would not run correctly anyway.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15574
This commit is contained in:
Douglas Bagnall 2024-01-04 01:51:56 +13:00 committed by Andrew Bartlett
parent d25fe2447b
commit ceb5389260

View File

@ -4,10 +4,7 @@ import optparse
import sys
sys.path.insert(0, 'bin/python')
import os
import samba
import samba.getopt as options
import random
import gzip
# We try to use the test infrastructure of Samba 4.3+, but if it
@ -16,45 +13,13 @@ import gzip
#
# Don't copy this horror into ordinary tests -- it is special for
# performance tests that want to apply to old versions.
try:
from samba.tests.subunitrun import SubunitOptions, TestProgram
ANCIENT_SAMBA = False
except ImportError:
ANCIENT_SAMBA = True
samba.ensure_external_module("testtools", "testtools")
samba.ensure_external_module("subunit", "subunit/python")
from subunit.run import SubunitTestRunner
import unittest
from samba.tests.subunitrun import TestProgram
from samba.ndr import ndr_pack, ndr_unpack
from samba.dcerpc import security
from samba.dcerpc import drsuapi
parser = optparse.OptionParser("ndr_pack_performance.py [options] <host>")
sambaopts = options.SambaOptions(parser)
parser.add_option_group(sambaopts)
parser.add_option_group(options.VersionOptions(parser))
if not ANCIENT_SAMBA:
subunitopts = SubunitOptions(parser)
parser.add_option_group(subunitopts)
# use command line creds if available
credopts = options.CredentialsOptions(parser)
parser.add_option_group(credopts)
opts, args = parser.parse_args()
if len(args) < 1:
parser.print_usage()
sys.exit(1)
host = args[0]
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
random.seed(1)
BIG_SD_SDDL = ''.join(
"""O:S-1-5-21-3328325300-3937145445-4190589019-512G:S-1-5-2
@ -246,18 +211,4 @@ class UserTests(samba.tests.TestCase):
self._test_pack(desc, cycles=20)
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host
else:
host = "ldap://%s" % host
if ANCIENT_SAMBA:
runner = SubunitTestRunner()
if not runner.run(unittest.TestLoader().loadTestsFromTestCase(
UserTests)).wasSuccessful():
sys.exit(1)
sys.exit(0)
else:
TestProgram(module=__name__, opts=subunitopts)
TestProgram(module=__name__)