selftest: Make sure system subunit.run has TestProgram.
[Samba/gebeck_regimport.git] / source4 / selftest / tests.py
blobd8a04e4ec0343c1809ccbcf126db80f704dc9485
1 #!/usr/bin/python
2 # This script generates a list of testsuites that should be run as part of
3 # the Samba 4 test suite.
5 # The output of this script is parsed by selftest.pl, which then decides
6 # which of the tests to actually run. It will, for example, skip all tests
7 # listed in selftest/skip or only run a subset during "make quicktest".
9 # The idea is that this script outputs all of the tests of Samba 4, not
10 # just those that are known to pass, and list those that should be skipped
11 # or are known to fail in selftest/skip or selftest/knownfail. This makes it
12 # very easy to see what functionality is still missing in Samba 4 and makes
13 # it possible to run the testsuite against other servers, such as Samba 3 or
14 # Windows that have a different set of features.
16 # The syntax for a testsuite is "-- TEST --" on a single line, followed
17 # by the name of the test, the environment it needs and the command to run, all
18 # three separated by newlines. All other lines in the output are considered
19 # comments.
21 import os
22 import subprocess
24 def binpath(name):
25 return os.path.join(samba4bindir, "%s%s" % (name, os.getenv("EXEEXT", "")))
27 perl = os.getenv("PERL", "perl")
29 if subprocess.call([perl, "-e", "eval require Test::More;"]) == 0:
30 has_perl_test_more = True
31 else:
32 has_perl_test_more = False
34 try:
35 from subunit.run import TestProgram
36 except ImportError:
37 has_system_subunit_run = False
38 else:
39 has_system_subunit_run = True
41 python = os.getenv("PYTHON", "python")
43 def valgrindify(cmdline):
44 """Run a command under valgrind, if $VALGRIND was set."""
45 valgrind = os.getenv("VALGRIND")
46 if valgrind is None:
47 return cmdline
48 return valgrind + " " + cmdline
51 def plantestsuite(name, env, cmdline, allow_empty_output=False):
52 """Plan a test suite.
54 :param name: Testsuite name
55 :param env: Environment to run the testsuite in
56 :param cmdline: Command line to run
57 """
58 print "-- TEST --"
59 print name
60 print env
61 if isinstance(cmdline, list):
62 cmdline = " ".join(cmdline)
63 filter_subunit_args = []
64 if not allow_empty_output:
65 filter_subunit_args.append("--fail-on-empty")
66 print "%s 2>&1 | ../selftest/filter-subunit %s --prefix=\"%s.\"" % (cmdline, " ".join(filter_subunit_args), name)
67 if allow_empty_output:
68 print "WARNING: allowing empty subunit output from %s" % name
71 def plantestsuite_loadlist(name, env, cmdline):
72 print "-- TEST-LOADLIST --"
73 if env == "none":
74 fullname = name
75 else:
76 fullname = "%s(%s)" % (name, env)
77 print fullname
78 print env
79 if isinstance(cmdline, list):
80 cmdline = " ".join(cmdline)
81 print "%s $LOADLIST 2>&1 | ../selftest/filter-subunit --fail-on-empty --prefix=\"%s.\"" % (cmdline, fullname)
84 def plantestsuite_idlist(name, env, cmdline):
85 print "-- TEST-IDLIST --"
86 print name
87 print env
88 if isinstance(cmdline, list):
89 cmdline = " ".join(cmdline)
90 print cmdline
93 def skiptestsuite(name, reason):
94 """Indicate that a testsuite was skipped.
96 :param name: Test suite name
97 :param reason: Reason the test suite was skipped
98 """
99 # FIXME: Report this using subunit, but re-adjust the testsuite count somehow
100 print "skipping %s (%s)" % (name, reason)
103 def normalize_testname(name):
104 """Normalize a smbtorture test suite name.
106 return name.lower().replace(" ", "_").replace("-", ".")
109 def planperltestsuite(name, path):
110 """Run a perl test suite.
112 :param name: Name of the test suite
113 :param path: Path to the test runner
115 if has_perl_test_more:
116 plantestsuite(name, "none", "%s %s | %s" % (perl, path, tap2subunit))
117 else:
118 skiptestsuite(name, "Test::More not available")
121 def planpythontestsuite(env, module):
122 if has_system_subunit_run:
123 plantestsuite_idlist(module, env, [python, "-m", "subunit.run", "$LISTOPT", module])
124 else:
125 plantestsuite_idlist(module, env, "PYTHONPATH=$PYTHONPATH:%s/../lib/subunit/python:%s/../lib/testtools %s -m subunit.run $LISTOPT %s" % (samba4srcdir, samba4srcdir, python, module))
127 def plansmbtorturetestsuite(name, env, options):
128 modname = "samba4.%s" % normalize_testname(name)
129 cmdline = "%s %s %s" % (valgrindify(smb4torture), options, name)
130 plantestsuite_loadlist(modname, env, cmdline)
133 samba4srcdir = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
134 builddir = os.getenv("BUILDDIR", samba4srcdir)
135 samba4bindir = os.path.normpath(os.path.join(builddir, "bin"))
136 smb4torture = binpath("smbtorture")
137 smb4torture_testsuite_list = subprocess.Popen([smb4torture, "--list-suites"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate("")[0].splitlines()
138 validate = os.getenv("VALIDATE", "")
139 if validate:
140 validate_list = [validate]
141 else:
142 validate_list = []
143 def smb4torture_testsuites(prefix):
144 return filter(lambda x: x.startswith(prefix), smb4torture_testsuite_list)
146 sub = subprocess.Popen("tap2subunit 2> /dev/null", stdout=subprocess.PIPE, stdin=subprocess.PIPE, shell=True)
147 sub.communicate("")
148 if sub.returncode != 0:
149 tap2subunit = "PYTHONPATH=%s/../lib/subunit/python:%s/../lib/testtools %s %s/../lib/subunit/filters/tap2subunit" % (samba4srcdir, samba4srcdir, python, samba4srcdir)
150 else:
151 cmd = "echo -ne \"1..1\nok 1 # skip doesn't seem to work yet\n\" | tap2subunit 2> /dev/null | grep skip"
152 sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
153 if sub.returncode == 0:
154 tap2subunit = "tap2subunit"
155 else:
156 tap2subunit = "PYTHONPATH=%s/../lib/subunit/python:%s/../lib/testtools %s %s/../lib/subunit/filters/tap2subunit" % (samba4srcdir, samba4srcdir, python, samba4srcdir)
158 subprocess.call([smb4torture, "-V"])
160 bbdir = "../testprogs/blackbox"
162 configuration = "--configfile=$SMB_CONF_PATH"
164 torture_options = [configuration, "--maximum-runtime=$SELFTEST_MAXTIME", "--target=$SELFTEST_TARGET", "--basedir=$SELFTEST_TMPDIR"]
165 if not os.getenv("SELFTEST_VERBOSE"):
166 torture_options.append("--option=torture:progress=no")
167 torture_options.append("--format=subunit")
168 if os.getenv("SELFTEST_QUICK"):
169 torture_options.append("--option=torture:quick=yes")
170 smb4torture += " " + " ".join(torture_options)
172 print "OPTIONS %s" % " ".join(torture_options)
174 # Simple tests for LDAP and CLDAP
175 for options in ['-U"$USERNAME%$PASSWORD" --option=socket:testnonblock=true', '-U"$USERNAME%$PASSWORD"', '-U"$USERNAME%$PASSWORD" -k yes', '-U"$USERNAME%$PASSWORD" -k no', '-U"$USERNAME%$PASSWORD" -k no --sign', '-U"$USERNAME%$PASSWORD" -k no --encrypt', '-U"$USERNAME%$PASSWORD" -k yes --encrypt', '-U"$USERNAME%$PASSWORD" -k yes --sign']:
176 plantestsuite("samba4.ldb.ldap with options %s(dc)" % options, "dc", "%s/test_ldb.sh ldap $SERVER %s" % (bbdir, options))
178 # see if we support ldaps
179 try:
180 config_h = os.environ["CONFIG_H"]
181 except KeyError:
182 config_h = os.path.join(samba4bindir, "default/source4/include/config.h")
183 f = open(config_h, 'r')
184 try:
185 have_tls_support = ("ENABLE_GNUTLS 1" in f.read())
186 finally:
187 f.close()
189 if have_tls_support:
190 for options in ['-U"$USERNAME%$PASSWORD"']:
191 plantestsuite("samba4.ldb.ldaps with options %s(dc)" % options, "dc",
192 "%s/test_ldb.sh ldaps $SERVER_IP %s" % (bbdir, options))
194 for options in ['-U"$USERNAME%$PASSWORD"']:
195 plantestsuite("samba4.ldb.ldapi with options %s(dc:local)" % options, "dc:local",
196 "%s/test_ldb.sh ldapi $PREFIX_ABS/dc/private/ldapi %s" % (bbdir, options))
198 for t in smb4torture_testsuites("LDAP-"):
199 plansmbtorturetestsuite(t, "dc", '-U"$USERNAME%$PASSWORD" //$SERVER_IP/_none_')
201 ldbdir = os.path.join(samba4srcdir, "lib/ldb")
202 # Don't run LDB tests when using system ldb, as we won't have ldbtest installed
203 if os.path.exists(os.path.join(samba4bindir, "ldbtest")):
204 plantestsuite("ldb.base", "none",
205 "TEST_DATA_PREFIX=$PREFIX %s/tests/test-tdb.sh" % ldbdir,
206 allow_empty_output=True)
207 else:
208 skiptestsuite("ldb.base", "Using system LDB, ldbtest not available")
210 # Tests for RPC
212 # add tests to this list as they start passing, so we test
213 # that they stay passing
214 ncacn_np_tests = ["RPC-SCHANNEL", "RPC-JOIN", "RPC-LSA", "RPC-DSSETUP", "RPC-ALTERCONTEXT", "RPC-MULTIBIND", "RPC-NETLOGON", "RPC-HANDLES", "RPC-SAMSYNC", "RPC-SAMBA3-SESSIONKEY", "RPC-SAMBA3-GETUSERNAME", "RPC-SAMBA3-LSA", "RPC-SAMBA3-BIND", "RPC-SAMBA3-NETLOGON", "RPC-ASYNCBIND", "RPC-LSALOOKUP", "RPC-LSA-GETUSER", "RPC-SCHANNEL2", "RPC-AUTHCONTEXT"]
215 ncalrpc_tests = ["RPC-SCHANNEL", "RPC-JOIN", "RPC-LSA", "RPC-DSSETUP", "RPC-ALTERCONTEXT", "RPC-MULTIBIND", "RPC-NETLOGON", "RPC-DRSUAPI", "RPC-ASYNCBIND", "RPC-LSALOOKUP", "RPC-LSA-GETUSER", "RPC-SCHANNEL2", "RPC-AUTHCONTEXT"]
216 drs_rpc_tests = smb4torture_testsuites("DRS-RPC")
217 ncacn_ip_tcp_tests = ["RPC-SCHANNEL", "RPC-JOIN", "RPC-LSA", "RPC-DSSETUP", "RPC-ALTERCONTEXT", "RPC-MULTIBIND", "RPC-NETLOGON", "RPC-HANDLES", "RPC-ASYNCBIND", "RPC-LSALOOKUP", "RPC-LSA-GETUSER", "RPC-SCHANNEL2", "RPC-AUTHCONTEXT", "RPC-OBJECTUUID"] + drs_rpc_tests
218 slow_ncacn_np_tests = ["RPC-SAMLOGON", "RPC-SAMR-USERS", "RPC-SAMR-LARGE-DC", "RPC-SAMR-USERS-PRIVILEGES", "RPC-SAMR-PASSWORDS", "RPC-SAMR-PASSWORDS-PWDLASTSET"]
219 slow_ncacn_ip_tcp_tests = ["RPC-SAMR", "RPC-CRACKNAMES"]
221 all_rpc_tests = ncalrpc_tests + ncacn_np_tests + ncacn_ip_tcp_tests + slow_ncacn_np_tests + slow_ncacn_ip_tcp_tests + ["RPC-LSA-SECRETS", "RPC-PAC", "RPC-SAMBA3-SHARESEC", "RPC-COUNTCALLS"]
223 # Make sure all tests get run
224 rpc_tests = smb4torture_testsuites("RPC-")
225 auto_rpc_tests = filter(lambda t: t not in all_rpc_tests, rpc_tests)
227 for bindoptions in ["seal,padcheck"] + validate_list + ["bigendian"]:
228 for transport in ["ncalrpc", "ncacn_np", "ncacn_ip_tcp"]:
229 env = "dc"
230 if transport == "ncalrpc":
231 tests = ncalrpc_tests
232 env = "dc:local"
233 elif transport == "ncacn_np":
234 tests = ncacn_np_tests
235 elif transport == "ncacn_ip_tcp":
236 tests = ncacn_ip_tcp_tests
237 for t in tests:
238 plantestsuite_loadlist("samba4.%s on %s with %s" % (normalize_testname(t), transport, bindoptions), env, [valgrindify(smb4torture), "%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t])
239 plantestsuite_loadlist("samba4.rpc.samba3.sharesec on %s with %s" % (transport, bindoptions), env, [valgrindify(smb4torture), "%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', '--option=torture:share=tmp', 'RPC-SAMBA3-SHARESEC'])
241 for bindoptions in [""] + validate_list + ["bigendian"]:
242 for t in auto_rpc_tests:
243 plantestsuite_loadlist("samba4.%s with %s" % (normalize_testname(t), bindoptions), "dc", [valgrindify(smb4torture), "$SERVER[%s]" % bindoptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t])
245 t = "RPC-COUNTCALLS"
246 plantestsuite_loadlist("samba4.%s" % normalize_testname(t), "dc:local", [valgrindify(smb4torture), "$SERVER[%s]" % bindoptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t])
248 for transport in ["ncacn_np", "ncacn_ip_tcp"]:
249 env = "dc"
250 if transport == "ncacn_np":
251 tests = slow_ncacn_np_tests
252 elif transport == "ncacn_ip_tcp":
253 tests = slow_ncacn_ip_tcp_tests
254 for t in tests:
255 plantestsuite_loadlist("samba4.%s on %s" % (normalize_testname(t), transport), env, [valgrindify(smb4torture), "%s:$SERVER" % transport, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t])
257 # Tests for the DFS referral calls implementation
258 for t in smb4torture_testsuites("DFS-"):
259 plansmbtorturetestsuite(t, "dc", '//$SERVER/ipc\$ -U$USERNAME%$PASSWORD')
261 # Tests for the NET API (NET-API-BECOME-DC tested below against all the roles)
262 net_tests = filter(lambda x: "NET-API-BECOME-DC" not in x, smb4torture_testsuites("NET-"))
263 for t in net_tests:
264 plansmbtorturetestsuite(t, "dc", '$SERVER[%s] -U$USERNAME%%$PASSWORD -W $DOMAIN' % validate)
266 # Tests for session keys and encryption of RPC pipes
267 # FIXME: Integrate these into a single smbtorture test
269 transport = "ncacn_np"
270 for ntlmoptions in [
271 "-k no --option=usespnego=yes",
272 "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no",
273 "-k no --option=usespnego=yes --option=ntlmssp_client:56bit=yes",
274 "-k no --option=usespnego=yes --option=ntlmssp_client:56bit=no",
275 "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes",
276 "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=no",
277 "-k no --option=usespnego=yes --option=clientntlmv2auth=yes",
278 "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no",
279 "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes",
280 "-k no --option=usespnego=no --option=clientntlmv2auth=yes",
281 "-k no --option=gensec:spnego=no --option=clientntlmv2auth=yes",
282 "-k no --option=usespnego=no"]:
283 name = "rpc.lsa.secrets on %s with with %s" % (transport, ntlmoptions)
284 plantestsuite_loadlist("samba4.%s" % name, "dc", [smb4torture, "%s:$SERVER[]" % (transport), ntlmoptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', '--option=gensec:target_hostname=$NETBIOSNAME', 'RPC-LSA-SECRETS'])
286 transports = ["ncacn_np", "ncacn_ip_tcp"]
288 #Kerberos varies between functional levels, so it is important to check this on all of them
289 for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
290 transport = "ncacn_np"
291 plantestsuite_loadlist("samba4.rpc.pac on %s" % (transport,), env, [smb4torture, "%s:$SERVER[]" % (transport, ), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'RPC-PAC'])
292 for transport in transports:
293 plantestsuite_loadlist("samba4.rpc.lsa.secrets on %s with Kerberos" % (transport,), env, [smb4torture, "%s:$SERVER[]" % (transport, ), '-k', 'yes', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', '--option=gensec:target_hostname=$NETBIOSNAME', 'RPC-LSA-SECRETS'])
294 plantestsuite_loadlist("samba4.rpc.lsa.secrets on %s with Kerberos - use target principal" % (transport,), env, [smb4torture, "%s:$SERVER[]" % (transport, ), '-k', 'yes', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', "--option=clientusespnegoprincipal=yes", '--option=gensec:target_hostname=$NETBIOSNAME', 'RPC-LSA-SECRETS'])
295 plantestsuite_loadlist("samba4.rpc.lsa.secrets on %s with Kerberos - use Samba3 style login" % transport, env, [smb4torture, "%s:$SERVER" % transport, '-k', 'yes', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', "--option=gensec:fake_gssapi_krb5=yes", '--option=gensec:gssapi_krb5=no', '--option=gensec:target_hostname=$NETBIOSNAME', "RPC-LSA-SECRETS-none*"])
296 plantestsuite_loadlist("samba4.rpc.lsa.secrets on %s with Kerberos - use Samba3 style login, use target principal" % transport, env, [smb4torture, "%s:$SERVER" % transport, '-k', 'yes', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', "--option=clientusespnegoprincipal=yes", '--option=gensec:fake_gssapi_krb5=yes', '--option=gensec:gssapi_krb5=no', '--option=gensec:target_hostname=$NETBIOSNAME', "RPC-LSA-SECRETS-none*"])
297 plantestsuite_loadlist("samba4.rpc.echo on %s" % (transport, ), env, [smb4torture, "%s:$SERVER[]" % (transport,), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'RPC-ECHO'])
299 # Echo tests test bulk Kerberos encryption of DCE/RPC
300 for bindoptions in ["connect", "spnego", "spnego,sign", "spnego,seal"] + validate_list + ["padcheck", "bigendian", "bigendian,seal"]:
301 echooptions = "--option=socket:testnonblock=True --option=torture:quick=yes -k yes"
302 plantestsuite_loadlist("samba4.rpc.echo on %s with %s and %s" % (transport, bindoptions, echooptions), env, [smb4torture, "%s:$SERVER[%s]" % (transport, bindoptions), echooptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'RPC-ECHO'])
303 plansmbtorturetestsuite("NET-API-BECOME-DC", env, '$SERVER[%s] -U$USERNAME%%$PASSWORD -W $DOMAIN' % validate)
305 for transport in transports:
306 for bindoptions in ["sign", "seal"]:
307 for ntlmoptions in [
308 "--option=ntlmssp_client:ntlm2=yes --option=torture:quick=yes",
309 "--option=ntlmssp_client:ntlm2=no --option=torture:quick=yes",
310 "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:128bit=no --option=torture:quick=yes",
311 "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:128bit=no --option=torture:quick=yes",
312 "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes",
313 "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes",
314 "--option=clientntlmv2auth=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes",
315 "--option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=yes --option=torture:quick=yes",
316 "--option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes"]:
317 if transport == "ncalrpc":
318 env = "dc:local"
319 else:
320 env = "dc"
321 plantestsuite_loadlist("samba4.rpc.echo on %s with %s and %s" % (transport, bindoptions, ntlmoptions), env, [smb4torture, "%s:$SERVER[%s]" % (transport, bindoptions), ntlmoptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'RPC-ECHO'])
323 plantestsuite_loadlist("samba4.rpc.echo on ncacn_np over smb2", "dc", [smb4torture, 'ncacn_np:$SERVER[smb2]', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'RPC-ECHO'])
325 plantestsuite_loadlist("samba4.ntp.signd", "dc:local", [smb4torture, 'ncacn_np:$SERVER', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'NTP-SIGND'])
327 # Tests against the NTVFS POSIX backend
328 ntvfsargs = ["--option=torture:sharedelay=10000", "--option=torture:oplocktimeout=3", "--option=torture:writetimeupdatedelay=50000"]
330 smb2 = smb4torture_testsuites("SMB2-")
331 #The QFILEINFO-IPC test needs to be on ipc$
332 raw = filter(lambda x: "RAW-QFILEINFO-IPC" not in x, smb4torture_testsuites("RAW-"))
333 base = smb4torture_testsuites("BASE-")
335 for t in base + raw + smb2:
336 plansmbtorturetestsuite(t, "dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD' + " " + " ".join(ntvfsargs))
338 plansmbtorturetestsuite("RAW-QFILEINFO-IPC", "dc", '//$SERVER/ipc\$ -U$USERNAME%$PASSWORD')
340 for t in smb4torture_testsuites("RAP-"):
341 plansmbtorturetestsuite(t, "dc", '//$SERVER/IPC\$ -U$USERNAME%$PASSWORD')
343 # Tests against the NTVFS CIFS backend
344 for t in base + raw:
345 plantestsuite_loadlist("samba4.ntvfs.cifs.%s" % normalize_testname(t), "dc", [valgrindify(smb4torture), '//$NETBIOSNAME/cifs', '-U$USERNAME%$PASSWORD'] + ntvfsargs + [t])
347 plansmbtorturetestsuite('ECHO-UDP', 'dc:local', '//$SERVER/whatever')
349 # Local tests
350 for t in smb4torture_testsuites("LOCAL-"):
351 plansmbtorturetestsuite(t, "none", "ncalrpc:")
353 tdbtorture4 = binpath("tdbtorture")
354 if os.path.exists(tdbtorture4):
355 plantestsuite("tdb.stress", "none", valgrindify(tdbtorture4))
356 else:
357 skiptestsuite("tdb.stress", "Using system TDB, tdbtorture not available")
359 plansmbtorturetestsuite("DRS-UNIT", "none", "ncalrpc:")
361 # Pidl tests
362 for f in sorted(os.listdir(os.path.join(samba4srcdir, "../pidl/tests"))):
363 if f.endswith(".pl"):
364 planperltestsuite("pidl.%s" % f[:-3], os.path.normpath(os.path.join(samba4srcdir, "../pidl/tests", f)))
365 planperltestsuite("selftest.samba4", os.path.normpath(os.path.join(samba4srcdir, "../selftest/test_samba4.pl")))
367 # Blackbox Tests:
368 # tests that interact directly with the command-line tools rather than using
369 # the API. These mainly test that the various command-line options of commands
370 # work correctly.
372 planpythontestsuite("none", "samba.tests.blackbox.ndrdump")
373 plantestsuite("samba4.blackbox.samba_tool(dc:local)", "dc:local", [os.path.join(samba4srcdir, "utils/tests/test_samba_tool.sh"), '$SERVER', "$USERNAME", "$PASSWORD", "$DOMAIN"])
374 plantestsuite("samba4.blackbox.pkinit(dc:local)", "dc:local", [os.path.join(bbdir, "test_pkinit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', "aes256-cts-hmac-sha1-96", configuration])
375 plantestsuite("samba4.blackbox.kinit(dc:local)", "dc:local", [os.path.join(bbdir, "test_kinit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', "aes256-cts-hmac-sha1-96", configuration])
376 plantestsuite("samba4.blackbox.kinit(fl2000dc:local)", "fl2000dc:local", [os.path.join(bbdir, "test_kinit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', "arcfour-hmac-md5", configuration])
377 plantestsuite("samba4.blackbox.kinit(fl2008r2dc:local)", "fl2008r2dc:local", [os.path.join(bbdir, "test_kinit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', "aes256-cts-hmac-sha1-96", configuration])
378 plantestsuite("samba4.blackbox.ktpass(dc)", "dc", [os.path.join(bbdir, "test_ktpass.sh"), '$PREFIX'])
379 plantestsuite("samba4.blackbox.passwords(dc:local)", "dc:local", [os.path.join(bbdir, "test_passwords.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', "$PREFIX"])
380 plantestsuite("samba4.blackbox.export.keytab(dc:local)", "dc:local", [os.path.join(bbdir, "test_export_keytab.sh"), '$SERVER', '$USERNAME', '$REALM', '$DOMAIN', "$PREFIX"])
381 plantestsuite("samba4.blackbox.cifsdd(dc)", "dc", [os.path.join(samba4srcdir, "client/tests/test_cifsdd.sh"), '$SERVER', '$USERNAME', '$PASSWORD', "$DOMAIN"])
382 plantestsuite("samba4.blackbox.nmblookup(dc)", "dc", [os.path.join(samba4srcdir, "utils/tests/test_nmblookup.sh"), '$NETBIOSNAME', '$NETBIOSALIAS', '$SERVER', '$SERVER_IP'])
383 plantestsuite("samba4.blackbox.nmblookup(member)", "member", [os.path.join(samba4srcdir, "utils/tests/test_nmblookup.sh"), '$NETBIOSNAME', '$NETBIOSALIAS', '$SERVER', '$SERVER_IP'])
384 plantestsuite("samba4.blackbox.locktest(dc)", "dc", [os.path.join(samba4srcdir, "torture/tests/test_locktest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', '$PREFIX'])
385 plantestsuite("samba4.blackbox.masktest", "dc", [os.path.join(samba4srcdir, "torture/tests/test_masktest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', '$PREFIX'])
386 plantestsuite("samba4.blackbox.gentest(dc)", "dc", [os.path.join(samba4srcdir, "torture/tests/test_gentest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', "$PREFIX"])
387 plantestsuite("samba4.blackbox.wbinfo(dc:local)", "dc:local", [os.path.join(samba4srcdir, "../nsswitch/tests/test_wbinfo.sh"), '$DOMAIN', '$USERNAME', '$PASSWORD', "dc"])
388 plantestsuite("samba4.blackbox.wbinfo(member:local)", "member:local", [os.path.join(samba4srcdir, "../nsswitch/tests/test_wbinfo.sh"), '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', "member"])
389 plantestsuite("samba4.blackbox.chgdcpass(dc)", "dc", [os.path.join(bbdir, "test_chgdcpass.sh"), '$SERVER', "LOCALDC\$", '$REALM', '$DOMAIN', '$PREFIX', "aes256-cts-hmac-sha1-96", '$SELFTEST_PREFIX/dc'])
391 # Tests using the "Simple" NTVFS backend
392 for t in ["BASE-RW1"]:
393 plantestsuite_loadlist("samba4.ntvfs.simple.%s" % normalize_testname(t), "dc", [valgrindify(smb4torture), "//$SERVER/simple", '-U$USERNAME%$PASSWORD', t])
395 # Domain Member Tests
396 plantestsuite_loadlist("samba4.rpc.echo against member server with local creds", "member", [valgrindify(smb4torture), 'ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD', 'RPC-ECHO'])
397 plantestsuite_loadlist("samba4.rpc.echo against member server with domain creds", "member", [valgrindify(smb4torture), 'ncacn_np:$NETBIOSNAME', '-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD', 'RPC-ECHO'])
398 plantestsuite_loadlist("samba4.rpc.samr against member server with local creds", "member", [valgrindify(smb4torture), 'ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD', "RPC-SAMR"])
399 plantestsuite_loadlist("samba4.rpc.samr.users against member server with local creds", "member", [valgrindify(smb4torture), 'ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD', "RPC-SAMR-USERS"])
400 plantestsuite_loadlist("samba4.rpc.samr.passwords against member server with local creds", "member", [valgrindify(smb4torture), 'ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD', "RPC-SAMR-PASSWORDS"])
401 plantestsuite("samba4.blackbox.smbclient against member server with local creds", "member", [os.path.join(samba4srcdir, "client/tests/test_smbclient.sh"), '$NETBIOSNAME', '$USERNAME', '$PASSWORD', '$NETBIOSNAME', '$PREFIX'])
403 # RPC Proxy
404 plantestsuite_loadlist("samba4.rpc.echo against rpc proxy with domain creds", "rpc_proxy", [valgrindify(smb4torture), 'ncacn_ip_tcp:$NETBIOSNAME', '-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD', "RPC-ECHO"])
406 # Tests SMB signing
407 for mech in [
408 "-k no",
409 "-k no --option=usespnego=no",
410 "-k no --option=gensec:spengo=no",
411 "-k yes",
412 "-k yes --option=gensec:fake_gssapi_krb5=yes --option=gensec:gssapi_krb5=no"]:
413 for signing in ["--signing=on", "--signing=required"]:
414 signoptions = "%s %s" % (mech, signing)
415 name = "smb.signing on with %s" % signoptions
416 plantestsuite_loadlist("samba4.%s" % name, "dc", [valgrindify(smb4torture), '//$NETBIOSNAME/tmp', signoptions, '-U$USERNAME%$PASSWORD', 'BASE-XCOPY'])
418 for mech in [
419 "-k no",
420 "-k no --option=usespnego=no",
421 "-k no --option=gensec:spengo=no",
422 "-k yes",
423 "-k yes --option=gensec:fake_gssapi_krb5=yes --option=gensec:gssapi_krb5=no"]:
424 signoptions = "%s --signing=off" % mech
425 name = "smb.signing on with %s" % signoptions
426 plantestsuite_loadlist("samba4.%s domain-creds" % name, "member", [valgrindify(smb4torture), '//$NETBIOSNAME/tmp', signoptions, '-U$DC_USERNAME%$DC_PASSWORD', 'BASE-XCOPY'])
428 for mech in [
429 "-k no",
430 "-k no --option=usespnego=no",
431 "-k no --option=gensec:spengo=no"]:
432 signoptions = "%s --signing=off" % mech
433 name = "smb.signing on with %s" % signoptions
434 plantestsuite_loadlist("samba4.%s local-creds" % name, "member", [valgrindify(smb4torture), '//$NETBIOSNAME/tmp', signoptions, '-U$NETBIOSNAME/$USERNAME%$PASSWORD', 'BASE-XCOPY'])
435 plantestsuite_loadlist("samba4.smb.signing --signing=yes anon", "dc", [valgrindify(smb4torture), '//$NETBIOSNAME/tmp', '-k', 'no', '--signing=yes', '-U%', 'BASE-XCOPY'])
436 plantestsuite_loadlist("samba4.smb.signing --signing=required anon", "dc", [valgrindify(smb4torture), '//$NETBIOSNAME/tmp', '-k', 'no', '--signing=required', '-U%', 'BASE-XCOPY'])
437 plantestsuite_loadlist("samba4.smb.signing --signing=no anon", "member", [valgrindify(smb4torture), '//$NETBIOSNAME/tmp', '-k', 'no', '--signing=no', '-U%', 'BASE-XCOPY'])
439 nbt_tests = smb4torture_testsuites("NBT-")
440 for t in nbt_tests:
441 plansmbtorturetestsuite(t, "dc", "//$SERVER/_none_ -U\"$USERNAME%$PASSWORD\"")
443 wb_opts = ["--option=\"torture:strict mode=no\"", "--option=\"torture:timelimit=1\"", "--option=\"torture:winbindd_separator=/\"", "--option=\"torture:winbindd_netbios_name=$SERVER\"", "--option=\"torture:winbindd_netbios_domain=$DOMAIN\""]
445 winbind_struct_tests = smb4torture_testsuites("WINBIND-STRUCT")
446 winbind_ndr_tests = smb4torture_testsuites("WINBIND-NDR")
447 for env in ["dc", "member"]:
448 for t in winbind_struct_tests:
449 plansmbtorturetestsuite(t, env, "%s //_none_/_none_" % " ".join(wb_opts))
451 for t in winbind_ndr_tests:
452 plansmbtorturetestsuite(t, env, "%s //_none_/_none_" % " ".join(wb_opts))
454 nsstest4 = binpath("nsstest")
455 if os.path.exists(nsstest4):
456 plantestsuite("samba4.nss.test using winbind(member)", "member", [valgrindify(nsstest4), os.path.join(samba4bindir, "shared/libnss_winbind.so")])
457 else:
458 skiptestsuite("samba4.nss.test using winbind(member)", "nsstest not available")
460 subunitrun = valgrindify(python) + " " + os.path.join(samba4srcdir, "scripting/bin/subunitrun")
461 def plansambapythontestsuite(name, env, path, module, environ={}, extra_args=[]):
462 environ = dict(environ)
463 environ["PYTHONPATH"] = "$PYTHONPATH:" + path
464 args = ["%s=%s" % item for item in environ.iteritems()]
465 args += [subunitrun, "$LISTOPT", module]
466 args += extra_args
467 plantestsuite(name, env, args)
470 plansambapythontestsuite("ldb.python", "none", "./lib/ldb/tests/python/", 'api')
471 planpythontestsuite("none", "samba.tests.credentials")
472 planpythontestsuite("none", "samba.tests.gensec")
473 planpythontestsuite("none", "samba.tests.registry")
474 plansambapythontestsuite("tdb.python", "none", "../lib/tdb/python/tests", 'simple')
475 planpythontestsuite("none", "samba.tests.auth")
476 planpythontestsuite("none", "samba.tests.security")
477 planpythontestsuite("none", "samba.tests.dcerpc.misc")
478 planpythontestsuite("none", "samba.tests.param")
479 planpythontestsuite("none", "samba.tests.upgrade")
480 planpythontestsuite("none", "samba.tests.core")
481 planpythontestsuite("none", "samba.tests.provision")
482 planpythontestsuite("none", "samba.tests.samba3")
483 planpythontestsuite("dc:local", "samba.tests.dcerpc.sam")
484 planpythontestsuite("dc:local", "samba.tests.dsdb")
485 planpythontestsuite("none", "samba.tests.netcmd")
486 planpythontestsuite("dc:local", "samba.tests.dcerpc.bare")
487 planpythontestsuite("dc:local", "samba.tests.dcerpc.unix")
488 planpythontestsuite("none", "samba.tests.dcerpc.rpc_talloc")
489 planpythontestsuite("none", "samba.tests.samdb")
490 planpythontestsuite("none", "samba.tests.hostconfig")
491 planpythontestsuite("none", "samba.tests.messaging")
492 planpythontestsuite("none", "samba.tests.samba3sam")
493 planpythontestsuite("none", "subunit")
494 planpythontestsuite("dc:local", "samba.tests.dcerpc.rpcecho")
495 plantestsuite_idlist("samba.tests.dcerpc.registry", "dc:local", [subunitrun, "$LISTOPT", '-U"$USERNAME%$PASSWORD"', "samba.tests.dcerpc.registry"])
496 plantestsuite("samba4.ldap.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
497 plantestsuite("samba4.sam.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sam.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
498 plansambapythontestsuite("samba4.schemaInfo.python(dc)", "dc", os.path.join(samba4srcdir, 'dsdb/tests/python'), 'dsdb_schema_info', extra_args=['-U"$DOMAIN/$DC_USERNAME%$DC_PASSWORD"'])
499 plantestsuite("samba4.urgent_replication.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/urgent_replication.py"), '$PREFIX_ABS/dc/private/sam.ldb'], allow_empty_output=True)
500 for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
501 plantestsuite("samba4.ldap_schema.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap_schema.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
502 plantestsuite("samba4.ldap.possibleInferiors.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/samdb/ldb_modules/tests/possibleinferiors.py"), "ldap://$SERVER", '-U"$USERNAME%$PASSWORD"', "-W", "$DOMAIN"])
503 plantestsuite("samba4.ldap.secdesc.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/sec_descriptor.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
504 plantestsuite("samba4.ldap.acl.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/acl.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
505 if env != "fl2000dc":
506 # This test makes excessively use of the "userPassword" attribute which
507 # isn't available on DCs with Windows 2000 domain function level -
508 # therefore skip it in that configuration
509 plantestsuite("samba4.ldap.passwords.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/passwords.py"), "$SERVER", '-U"$USERNAME%$PASSWORD"', "-W", "$DOMAIN"])
510 planpythontestsuite("dc:local", "samba.tests.upgradeprovisionneeddc")
511 planpythontestsuite("none", "samba.tests.upgradeprovision")
512 planpythontestsuite("none", "samba.tests.xattr")
513 planpythontestsuite("none", "samba.tests.ntacls")
514 plantestsuite("samba4.deletetest.python(dc)", "dc", ['PYTHONPATH="$PYTHONPATH:../lib/subunit/python:../lib/testtools"', python, os.path.join(samba4srcdir, "dsdb/tests/python/deletetest.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
515 plansambapythontestsuite("samba4.policy.python", "none", "lib/policy/tests/python", 'bindings')
516 plantestsuite("samba4.blackbox.samba3dump", "none", [python, os.path.join(samba4srcdir, "scripting/bin/samba3dump"), os.path.join(samba4srcdir, "../testdata/samba3")], allow_empty_output=True)
517 plantestsuite("samba4.blackbox.upgrade", "none", ["rm -rf $PREFIX/upgrade;", python, os.path.join(samba4srcdir, "setup/upgrade_from_s3"), "--targetdir=$PREFIX/upgrade", os.path.normpath(os.path.join(samba4srcdir, "../testdata/samba3")), os.path.normpath(os.path.join(samba4srcdir, "../testdata/samba3/smb.conf"))], allow_empty_output=True)
518 plantestsuite("samba4.blackbox.provision.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_provision.sh"), '$PREFIX/provision'])
519 plantestsuite("samba4.blackbox.upgradeprovision.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_upgradeprovision.sh"), '$PREFIX/provision'])
520 plantestsuite("samba4.blackbox.setpassword.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_setpassword.sh"), '$PREFIX/provision'])
521 plantestsuite("samba4.blackbox.newuser.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_newuser.sh"), '$PREFIX/provision'])
522 plantestsuite("samba4.blackbox.group.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_group.sh"), '$PREFIX/provision'])
523 plantestsuite("samba4.blackbox.spn.py(dc:local)", "dc:local", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_spn.sh"), '$PREFIX/dc'])
524 plantestsuite("samba4.ldap.bind(dc)", "dc", [python, os.path.join(samba4srcdir, "auth/credentials/tests/bind.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"'])
526 # DRS python tests
527 plansambapythontestsuite("samba4.drs.delete_object.python(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'torture/drs/python'), "delete_object", environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
528 plansambapythontestsuite("samba4.drs.fsmo.python(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'torture/drs/python'), "fsmo", environ={'DC1': "$DC_SERVER", 'DC2': "$VAMPIRE_DC_SERVER"}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
529 plansambapythontestsuite("samba4.drs.repl_schema.python(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'torture/drs/python'), "repl_schema", environ={'DC1': "$DC_SERVER", 'DC2': '$VAMPIRE_DC_SERVER'}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
531 # This makes sure we test the rid allocation code
532 t = "RPC-SAMR-LARGE-DC"
533 plantestsuite_loadlist("samba4.%s.one" % normalize_testname(t), "vampire_dc", [valgrindify(smb4torture), '$SERVER', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t])
534 plantestsuite_loadlist("samba4.%s.two" % normalize_testname(t), "vampire_dc", [valgrindify(smb4torture), '$SERVER', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t])
536 # some RODC testing
537 plantestsuite_loadlist("samba4.rpc.echo", "rodc", [smb4torture, 'ncacn_np:$SERVER', "-k", "yes", '-U$USERNAME%$PASSWORD', '-W' '$DOMAIN', 'RPC-ECHO'])
538 plantestsuite("samba4.blackbox.provision-backend.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_provision-backend.sh"), '$PREFIX/provision'])