s3-lsasd: Don't leak file descriptors. Reviewed-by: Alexander Bokovoy <ab@samba.org>
[Samba.git] / source4 / selftest / tests.py
blob977b5396ef6eb604be967ff2dad3c4bc3c68b663
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, sys
22 sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../selftest"))
23 import selftesthelpers
24 from selftesthelpers import *
26 print >>sys.stderr, "OPTIONS %s" % " ".join(smbtorture4_options)
28 def plansmbtorture4testsuite(name, env, options, modname=None):
29 return selftesthelpers.plansmbtorture4testsuite(name, env, options,
30 target='samba4', modname=modname)
32 samba4srcdir = source4dir()
33 samba4bindir = bindir()
34 validate = os.getenv("VALIDATE", "")
35 if validate:
36 validate_list = [validate]
37 else:
38 validate_list = []
40 nmblookup4 = binpath('nmblookup4')
41 smbclient4 = binpath('smbclient4')
43 print_smbtorture4_version()
45 bbdir = os.path.join(srcdir(), "testprogs/blackbox")
47 # Simple tests for LDAP and CLDAP
48 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']:
49 plantestsuite("samba4.ldb.ldap with options %s(dc)" % options, "dc", "%s/test_ldb.sh ldap $SERVER %s" % (bbdir, options))
51 # see if we support ADS on the Samba3 side
52 try:
53 config_h = os.environ["CONFIG_H"]
54 except KeyError:
55 config_h = os.path.join(samba4bindir, "default/include/config.h")
57 # see if we support ldaps
58 f = open(config_h, 'r')
59 try:
60 have_tls_support = ("ENABLE_GNUTLS 1" in f.read())
61 finally:
62 f.close()
64 if have_tls_support:
65 for options in ['-U"$USERNAME%$PASSWORD"']:
66 plantestsuite("samba4.ldb.ldaps with options %s(dc)" % options, "dc",
67 "%s/test_ldb.sh ldaps $SERVER_IP %s" % (bbdir, options))
69 for options in ['-U"$USERNAME%$PASSWORD"']:
70 plantestsuite("samba4.ldb.ldapi with options %s(dc:local)" % options, "dc:local",
71 "%s/test_ldb.sh ldapi $PREFIX_ABS/dc/private/ldapi %s" % (bbdir, options))
73 for t in smbtorture4_testsuites("ldap."):
74 plansmbtorture4testsuite(t, "dc", '-U"$USERNAME%$PASSWORD" //$SERVER_IP/_none_')
76 ldbdir = os.path.join(srcdir(), "lib/ldb")
77 # Don't run LDB tests when using system ldb, as we won't have ldbtest installed
78 if os.path.exists(os.path.join(samba4bindir, "ldbtest")):
79 plantestsuite("ldb.base", "none", "%s/tests/test-tdb-subunit.sh %s" % (ldbdir, samba4bindir))
80 else:
81 skiptestsuite("ldb.base", "Using system LDB, ldbtest not available")
83 # Tests for RPC
85 # add tests to this list as they start passing, so we test
86 # that they stay passing
87 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"]
88 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"]
89 drs_rpc_tests = smbtorture4_testsuites("drs.rpc")
90 ncacn_ip_tcp_tests = ["rpc.schannel", "rpc.join", "rpc.lsa", "rpc.dssetup", "rpc.multibind", "rpc.netlogon", "rpc.asyncbind", "rpc.lsalookup", "rpc.lsa-getuser", "rpc.schannel2", "rpc.authcontext"] + drs_rpc_tests
91 slow_ncacn_np_tests = ["rpc.samlogon", "rpc.samr.users", "rpc.samr.large-dc", "rpc.samr.users.privileges", "rpc.samr.passwords", "rpc.samr.passwords.pwdlastset"]
92 slow_ncacn_ip_tcp_tests = ["rpc.samr", "rpc.cracknames"]
94 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"]
96 # Make sure all tests get run
97 rpc_tests = smbtorture4_testsuites("rpc.")
98 auto_rpc_tests = filter(lambda t: t not in all_rpc_tests, rpc_tests)
100 for bindoptions in ["seal,padcheck"] + validate_list + ["bigendian"]:
101 for transport in ["ncalrpc", "ncacn_np", "ncacn_ip_tcp"]:
102 env = "dc"
103 if transport == "ncalrpc":
104 tests = ncalrpc_tests
105 env = "dc:local"
106 elif transport == "ncacn_np":
107 tests = ncacn_np_tests
108 elif transport == "ncacn_ip_tcp":
109 tests = ncacn_ip_tcp_tests
110 else:
111 raise AssertionError("invalid transport %r"% transport)
112 for t in tests:
113 plansmbtorture4testsuite(t, env, ["%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.%s on %s with %s" % (t, transport, bindoptions))
114 plansmbtorture4testsuite('rpc.samba3-sharesec', env, ["%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', '--option=torture:share=tmp'], "samba4.rpc.samba3.sharesec on %s with %s" % (transport, bindoptions))
116 #Plugin S4 DC tests (confirms named pipe auth forwarding). This can be expanded once kerberos is supported in the plugin DC
118 for bindoptions in ["seal,padcheck"] + validate_list + ["bigendian"]:
119 for t in ncacn_np_tests:
120 env = "plugin_s4_dc"
121 transport = "ncacn_np"
122 plansmbtorture4testsuite(t, env, ["%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.%s with %s" % (t, bindoptions))
124 for bindoptions in [""] + validate_list + ["bigendian"]:
125 for t in auto_rpc_tests:
126 plansmbtorture4testsuite(t, "dc", ["$SERVER[%s]" % bindoptions, '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.%s with %s" % (t, bindoptions))
128 t = "rpc.countcalls"
129 plansmbtorture4testsuite(t, "dc:local", ["$SERVER[%s]" % bindoptions, '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], modname="samba4.%s" % t)
131 for transport in ["ncacn_np", "ncacn_ip_tcp"]:
132 env = "dc"
133 if transport == "ncacn_np":
134 tests = slow_ncacn_np_tests
135 elif transport == "ncacn_ip_tcp":
136 tests = slow_ncacn_ip_tcp_tests
137 else:
138 raise AssertionError("Invalid transport %r" % transport)
139 for t in tests:
140 plansmbtorture4testsuite(t, env, ["%s:$SERVER" % transport, '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.%s on %s" % (t, transport))
142 # Tests for the DFS referral calls implementation
143 for t in smbtorture4_testsuites("dfs."):
144 plansmbtorture4testsuite(t, "dc", '//$SERVER/ipc\$ -U$USERNAME%$PASSWORD')
145 plansmbtorture4testsuite(t, "plugin_s4_dc", '//$SERVER/ipc\$ -U$USERNAME%$PASSWORD')
147 # Tests for the NET API (net.api.become.dc tested below against all the roles)
148 net_tests = filter(lambda x: "net.api.become.dc" not in x, smbtorture4_testsuites("net."))
149 for t in net_tests:
150 plansmbtorture4testsuite(t, "dc", '$SERVER[%s] -U$USERNAME%%$PASSWORD -W$DOMAIN' % validate)
152 # Tests for session keys and encryption of RPC pipes
153 # FIXME: Integrate these into a single smbtorture test
155 transport = "ncacn_np"
156 for env in ["dc", "s3dc"]:
157 for ntlmoptions in [
158 "-k no --option=usespnego=yes",
159 "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no",
160 "-k no --option=usespnego=yes --option=ntlmssp_client:56bit=yes",
161 "-k no --option=usespnego=yes --option=ntlmssp_client:56bit=no",
162 "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes",
163 "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=no",
164 "-k no --option=usespnego=yes --option=clientntlmv2auth=yes",
165 "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no",
166 "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes",
167 "-k no --option=usespnego=no --option=clientntlmv2auth=yes",
168 "-k no --option=gensec:spnego=no --option=clientntlmv2auth=yes",
169 "-k no --option=usespnego=no"]:
170 name = "rpc.lsa.secrets on %s with with %s" % (transport, ntlmoptions)
171 plansmbtorture4testsuite('rpc.lsa.secrets', env, ["%s:$SERVER[]" % (transport), ntlmoptions, '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', '--option=gensec:target_hostname=$NETBIOSNAME'], "samba4.%s" % name)
172 plantestsuite("samba.blackbox.pdbtest", "%s:local" % env, [os.path.join(bbdir, "test_pdbtest.sh"), '$SERVER', "$PREFIX", smbclient4, '$SMB_CONF_PATH', configuration])
174 transports = ["ncacn_np", "ncacn_ip_tcp"]
176 #Kerberos varies between functional levels, so it is important to check this on all of them
177 for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc", "plugin_s4_dc"]:
178 transport = "ncacn_np"
179 plansmbtorture4testsuite('rpc.pac', env, ["%s:$SERVER[]" % (transport, ), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.pac on %s" % (transport,))
180 plansmbtorture4testsuite('rpc.lsa.secrets', env, ["%s:$SERVER[]" % (transport, ), '-k', 'yes', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', '--option=gensec:target_hostname=$NETBIOSNAME', 'rpc.lsa.secrets'], "samba4.rpc.lsa.secrets on %s with Kerberos" % (transport,))
181 plansmbtorture4testsuite('rpc.lsa.secrets', env, ["%s:$SERVER[]" % (transport, ), '-k', 'yes', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', "--option=clientusespnegoprincipal=yes", '--option=gensec:target_hostname=$NETBIOSNAME'], "samba4.rpc.lsa.secrets on %s with Kerberos - use target principal" % (transport,))
182 plansmbtorture4testsuite('rpc.lsa.secrets.none*', env, ["%s:$SERVER" % transport, '-k', 'yes', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', "--option=gensec:fake_gssapi_krb5=yes", '--option=gensec:gssapi_krb5=no', '--option=gensec:target_hostname=$NETBIOSNAME'], "samba4.rpc.lsa.secrets on %s with Kerberos - use Samba3 style login" % transport)
183 plansmbtorture4testsuite('rpc.lsa.secrets.none*', env, ["%s:$SERVER" % transport, '-k', 'yes', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', "--option=clientusespnegoprincipal=yes", '--option=gensec:fake_gssapi_krb5=yes', '--option=gensec:gssapi_krb5=no', '--option=gensec:target_hostname=$NETBIOSNAME'], "samba4.rpc.lsa.secrets on %s with Kerberos - use Samba3 style login, use target principal" % transport)
184 for transport in transports:
185 plansmbtorture4testsuite('rpc.echo', env, ["%s:$SERVER[]" % (transport,), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.echo on %s" % (transport, ))
187 # Echo tests test bulk Kerberos encryption of DCE/RPC
188 for bindoptions in ["connect", "spnego", "spnego,sign", "spnego,seal"] + validate_list + ["padcheck", "bigendian", "bigendian,seal"]:
189 echooptions = "--option=socket:testnonblock=True --option=torture:quick=yes -k yes"
190 plansmbtorture4testsuite('rpc.echo', env, ["%s:$SERVER[%s]" % (transport, bindoptions), echooptions, '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.echo on %s with %s and %s" % (transport, bindoptions, echooptions))
191 plansmbtorture4testsuite("net.api.become.dc", env, '$SERVER[%s] -U$USERNAME%%$PASSWORD -W$DOMAIN' % validate)
193 for bindoptions in ["sign", "seal"]:
194 plansmbtorture4testsuite('rpc.backupkey', "dc", ["ncacn_np:$SERVER[%s]" % ( bindoptions), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.backupkey with %s" % (bindoptions))
196 for transport in transports:
197 for bindoptions in ["sign", "seal"]:
198 for ntlmoptions in [
199 "--option=ntlmssp_client:ntlm2=yes --option=torture:quick=yes",
200 "--option=ntlmssp_client:ntlm2=no --option=torture:quick=yes",
201 "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:128bit=no --option=torture:quick=yes",
202 "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:128bit=no --option=torture:quick=yes",
203 "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes",
204 "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes",
205 "--option=clientntlmv2auth=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes",
206 "--option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=yes --option=torture:quick=yes",
207 "--option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes"]:
208 if transport == "ncalrpc":
209 env = "dc:local"
210 else:
211 env = "dc"
212 plansmbtorture4testsuite('rpc.echo', env, ["%s:$SERVER[%s]" % (transport, bindoptions), ntlmoptions, '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.echo on %s with %s and %s" % (transport, bindoptions, ntlmoptions))
214 plansmbtorture4testsuite('rpc.echo', "dc", ['ncacn_np:$SERVER[smb2]', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.echo on ncacn_np over smb2")
216 plansmbtorture4testsuite('ntp.signd', "dc:local", ['ncacn_np:$SERVER', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.ntp.signd")
218 nbt_tests = smbtorture4_testsuites("nbt.")
219 for t in nbt_tests:
220 plansmbtorture4testsuite(t, "dc", "//$SERVER/_none_ -U\"$USERNAME%$PASSWORD\"")
222 # Tests against the NTVFS POSIX backend
223 ntvfsargs = ["--option=torture:sharedelay=10000", "--option=torture:oplocktimeout=3", "--option=torture:writetimeupdatedelay=50000"]
225 smb2 = smbtorture4_testsuites("smb2.")
226 #The QFILEINFO-IPC test needs to be on ipc$
227 raw = filter(lambda x: "raw.qfileinfo.ipc" not in x, smbtorture4_testsuites("raw."))
228 base = smbtorture4_testsuites("base.")
230 netapi = smbtorture4_testsuites("netapi.")
232 libsmbclient = smbtorture4_testsuites("libsmbclient.")
234 for t in base + raw + smb2 + netapi + libsmbclient:
235 plansmbtorture4testsuite(t, "dc", ['//$SERVER/tmp', '-U$USERNAME%$PASSWORD'] + ntvfsargs)
237 plansmbtorture4testsuite("raw.qfileinfo.ipc", "dc", '//$SERVER/ipc\$ -U$USERNAME%$PASSWORD')
239 for t in smbtorture4_testsuites("rap."):
240 plansmbtorture4testsuite(t, "dc", '//$SERVER/IPC\$ -U$USERNAME%$PASSWORD')
242 # Tests against the NTVFS CIFS backend
243 for t in base + raw:
244 plansmbtorture4testsuite(t, "dc", ['//$NETBIOSNAME/cifs', '-U$USERNAME%$PASSWORD', '--kerberos=yes'] + ntvfsargs, modname="samba4.ntvfs.cifs.krb5.%s" % t)
246 # Test NTVFS CIFS backend with S4U2Self and S4U2Proxy
247 t = "base.unlink"
248 plansmbtorture4testsuite(t, "dc", ['//$NETBIOSNAME/cifs', '-U$USERNAME%$PASSWORD', '--kerberos=no'] + ntvfsargs, "samba4.ntvfs.cifs.ntlm.%s" % t)
249 plansmbtorture4testsuite(t, "rpc_proxy", ['//$NETBIOSNAME/cifs_to_dc', '-U$DC_USERNAME%$DC_PASSWORD', '--kerberos=yes'] + ntvfsargs, "samba4.ntvfs.cifs.krb5.%s" % t)
250 plansmbtorture4testsuite(t, "rpc_proxy", ['//$NETBIOSNAME/cifs_to_dc', '-U$DC_USERNAME%$DC_PASSWORD', '--kerberos=no'] + ntvfsargs, "samba4.ntvfs.cifs.ntlm.%s" % t)
252 plansmbtorture4testsuite('echo.udp', 'dc:local', '//$SERVER/whatever')
254 # Local tests
255 for t in smbtorture4_testsuites("local."):
256 #The local.resolve test needs a name to look up using real system (not emulated) name routines
257 plansmbtorture4testsuite(t, "none", "ncalrpc:localhost")
259 # Confirm these tests with the system iconv too
260 for t in ["local.convert_string_handle", "local.convert_string", "local.ndr"]:
261 options = "ncalrpc: --option='iconv:use_builtin_handlers=false'"
262 plansmbtorture4testsuite(t, "none", options,
263 modname="samba4.%s.system.iconv" % t)
265 tdbtorture4 = binpath("tdbtorture")
266 if os.path.exists(tdbtorture4):
267 plantestsuite("tdb.stress", "none", valgrindify(tdbtorture4))
268 else:
269 skiptestsuite("tdb.stress", "Using system TDB, tdbtorture not available")
271 plansmbtorture4testsuite("drs.unit", "none", "ncalrpc:")
273 # Pidl tests
274 for f in sorted(os.listdir(os.path.join(samba4srcdir, "../pidl/tests"))):
275 if f.endswith(".pl"):
276 planperltestsuite("pidl.%s" % f[:-3], os.path.normpath(os.path.join(samba4srcdir, "../pidl/tests", f)))
278 # DNS tests
279 planpythontestsuite("fl2003dc", "samba.tests.dns")
280 for t in smbtorture4_testsuites("dns_internal."):
281 plansmbtorture4testsuite(t, "dc:local", '//$SERVER/whavever')
283 # Local tests
284 for t in smbtorture4_testsuites("dlz_bind9."):
285 #The dlz_bind9 tests needs to look at the DNS database
286 plansmbtorture4testsuite(t, "chgdcpass:local", "ncalrpc:localhost")
288 planpythontestsuite("s3dc", "samba.tests.libsmb_samba_internal");
290 # Blackbox Tests:
291 # tests that interact directly with the command-line tools rather than using
292 # the API. These mainly test that the various command-line options of commands
293 # work correctly.
295 for env in ["s3member", "s4member", "dc", "chgdcpass"]:
296 plantestsuite("samba4.blackbox.smbclient(%s:local)" % env, "%s:local" % env, [os.path.join(samba4srcdir, "utils/tests/test_smbclient.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$DOMAIN', smbclient4])
298 plantestsuite("samba4.blackbox.samba_tool(dc:local)", "dc:local", [os.path.join(samba4srcdir, "utils/tests/test_samba_tool.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$DOMAIN', smbclient4])
299 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", smbclient4, configuration])
300 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", smbclient4, configuration])
301 plantestsuite("samba4.blackbox.kinit(fl2000dc:local)", "fl2000dc:local", [os.path.join(bbdir, "test_kinit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', "arcfour-hmac-md5", smbclient4, configuration])
302 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", smbclient4, configuration])
303 plantestsuite("samba4.blackbox.ktpass(dc)", "dc", [os.path.join(bbdir, "test_ktpass.sh"), '$PREFIX'])
304 plantestsuite("samba4.blackbox.passwords(dc:local)", "dc:local", [os.path.join(bbdir, "test_passwords.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', "$PREFIX", smbclient4])
305 plantestsuite("samba4.blackbox.export.keytab(dc:local)", "dc:local", [os.path.join(bbdir, "test_export_keytab.sh"), '$SERVER', '$USERNAME', '$REALM', '$DOMAIN', "$PREFIX", smbclient4])
306 plantestsuite("samba4.blackbox.cifsdd(dc)", "dc", [os.path.join(samba4srcdir, "client/tests/test_cifsdd.sh"), '$SERVER', '$USERNAME', '$PASSWORD', "$DOMAIN"])
307 plantestsuite("samba4.blackbox.nmblookup(dc)", "dc", [os.path.join(samba4srcdir, "utils/tests/test_nmblookup.sh"), '$NETBIOSNAME', '$NETBIOSALIAS', '$SERVER', '$SERVER_IP', nmblookup4])
308 plantestsuite("samba4.blackbox.locktest(dc)", "dc", [os.path.join(samba4srcdir, "torture/tests/test_locktest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', '$PREFIX'])
309 plantestsuite("samba4.blackbox.masktest", "dc", [os.path.join(samba4srcdir, "torture/tests/test_masktest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', '$PREFIX'])
310 plantestsuite("samba4.blackbox.gentest(dc)", "dc", [os.path.join(samba4srcdir, "torture/tests/test_gentest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', "$PREFIX"])
311 plantestsuite("samba4.blackbox.wbinfo(dc:local)", "dc:local", [os.path.join(samba4srcdir, "../nsswitch/tests/test_wbinfo.sh"), '$DOMAIN', '$USERNAME', '$PASSWORD', "dc"])
312 plantestsuite("samba4.blackbox.wbinfo(s4member:local)", "s4member:local", [os.path.join(samba4srcdir, "../nsswitch/tests/test_wbinfo.sh"), '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', "s4member"])
313 plantestsuite("samba4.blackbox.chgdcpass", "chgdcpass", [os.path.join(bbdir, "test_chgdcpass.sh"), '$SERVER', "CHGDCPASS\$", '$REALM', '$DOMAIN', '$PREFIX', "aes256-cts-hmac-sha1-96", '$SELFTEST_PREFIX/chgdcpass', smbclient4])
314 plantestsuite_loadlist("samba4.rpc.echo against NetBIOS alias", "dc", [valgrindify(smbtorture4), "$LISTOPT", 'ncacn_np:$NETBIOSALIAS', '-U$DOMAIN/$USERNAME%$PASSWORD', 'rpc.echo'])
316 # Tests using the "Simple" NTVFS backend
317 for t in ["base.rw1"]:
318 plansmbtorture4testsuite(t, "dc", ["//$SERVER/simple", '-U$USERNAME%$PASSWORD'], modname="samba4.ntvfs.simple.%s" % t)
320 # Domain S4member Tests
321 plansmbtorture4testsuite('rpc.echo', "s4member", ['ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD'], "samba4.rpc.echo against s4member server with local creds")
322 plansmbtorture4testsuite('rpc.echo', "s4member", ['ncacn_np:$NETBIOSNAME', '-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'], "samba4.rpc.echo against s4member server with domain creds")
323 plansmbtorture4testsuite('rpc.samr', "s4member", ['ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD'], "samba4.rpc.samr against s4member server with local creds")
324 plansmbtorture4testsuite('rpc.samr.users', "s4member", ['ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD'], "samba4.rpc.samr.users against s4member server with local creds",)
325 plansmbtorture4testsuite('rpc.samr.passwords', "s4member", ['ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD'], "samba4.rpc.samr.passwords against s4member server with local creds")
326 plantestsuite("samba4.blackbox.smbclient against s4member server with local creds", "s4member", [os.path.join(samba4srcdir, "client/tests/test_smbclient.sh"), '$NETBIOSNAME', '$USERNAME', '$PASSWORD', '$NETBIOSNAME', '$PREFIX', smbclient4])
328 # RPC Proxy
329 plansmbtorture4testsuite("rpc.echo", "rpc_proxy", ['ncacn_ip_tcp:$NETBIOSNAME', '-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'], modname="samba4.rpc.echo against rpc proxy with domain creds")
331 # Tests SMB signing
332 for mech in [
333 "-k no",
334 "-k no --option=usespnego=no",
335 "-k no --option=gensec:spengo=no",
336 "-k yes",
337 "-k yes --option=gensec:fake_gssapi_krb5=yes --option=gensec:gssapi_krb5=no"]:
338 for signing in ["--signing=on", "--signing=required"]:
339 signoptions = "%s %s" % (mech, signing)
340 name = "smb.signing on with %s" % signoptions
341 plansmbtorture4testsuite('base.xcopy', "dc", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$USERNAME%$PASSWORD'], modname="samba4.%s" % name)
343 for mech in [
344 "-k no",
345 "-k no --option=usespnego=no",
346 "-k no --option=gensec:spengo=no",
347 "-k yes"]:
348 signoptions = "%s --signing=off" % mech
349 name = "smb.signing disabled on with %s" % signoptions
350 plansmbtorture4testsuite('base.xcopy', "s4member", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$DC_USERNAME%$DC_PASSWORD'], "samba4.%s domain-creds" % name)
351 plansmbtorture4testsuite('base.xcopy', "s3member", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$DC_USERNAME%$DC_PASSWORD'], "samba4.%s domain-creds" % name)
352 plansmbtorture4testsuite('base.xcopy', "plugin_s4_dc", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$USERNAME%$PASSWORD'], "samba4.%s" % name)
353 plansmbtorture4testsuite('base.xcopy', "plugin_s4_dc",
354 ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$DC_USERNAME%$DC_PASSWORD'], "samba4.%s administrator" % name)
356 plantestsuite("samba4.blackbox.bogusdomain", "s3member", ["testprogs/blackbox/bogus.sh", "$NETBIOSNAME", "xcopy_share", '$USERNAME', '$PASSWORD', '$DC_USERNAME', '$DC_PASSWORD', smbclient4])
357 for mech in [
358 "-k no",
359 "-k no --option=usespnego=no",
360 "-k no --option=gensec:spengo=no"]:
361 signoptions = "%s --signing=off" % mech
362 plansmbtorture4testsuite('base.xcopy', "s4member", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$NETBIOSNAME/$USERNAME%$PASSWORD'], modname="samba4.smb.signing on with %s local-creds" % signoptions)
364 plansmbtorture4testsuite('base.xcopy', "dc", ['//$NETBIOSNAME/xcopy_share', '-k', 'no', '--signing=yes', '-U%'], modname="samba4.smb.signing --signing=yes anon")
365 plansmbtorture4testsuite('base.xcopy', "dc", ['//$NETBIOSNAME/xcopy_share', '-k', 'no', '--signing=required', '-U%'], modname="samba4.smb.signing --signing=required anon")
366 plansmbtorture4testsuite('base.xcopy', "s4member", ['//$NETBIOSNAME/xcopy_share', '-k', 'no', '--signing=no', '-U%'], modname="samba4.smb.signing --signing=no anon")
369 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\""]
371 winbind_struct_tests = smbtorture4_testsuites("winbind.struct")
372 winbind_ndr_tests = smbtorture4_testsuites("winbind.ndr")
373 for env in ["plugin_s4_dc", "dc", "s4member"]:
374 for t in winbind_struct_tests:
375 plansmbtorture4testsuite(t, env, wb_opts + ['//_none_/_none_'])
377 for t in winbind_ndr_tests:
378 plansmbtorture4testsuite(t, env, wb_opts + ['//_none_/_none_'])
380 nsstest4 = binpath("nsstest")
381 for env in ["plugin_s4_dc", "dc", "s4member", "s3dc", "s3member", "member"]:
382 if os.path.exists(nsstest4):
383 plantestsuite("samba4.nss.test using winbind(%s)" % env, env, [os.path.join(bbdir, "nsstest.sh"), nsstest4, os.path.join(samba4bindir, "default/nsswitch/libnss-winbind.so")])
384 else:
385 skiptestsuite("samba4.nss.test using winbind(%s)" % env, "nsstest not available")
387 subunitrun = valgrindify(python) + " " + os.path.join(samba4srcdir, "scripting/bin/subunitrun")
388 def planoldpythontestsuite(env, module, name=None, extra_path=[], environ={}, extra_args=[]):
389 environ = dict(environ)
390 py_path = list(extra_path)
391 if py_path:
392 environ["PYTHONPATH"] = ":".join(["$PYTHONPATH"] + py_path)
393 args = ["%s=%s" % item for item in environ.iteritems()]
394 args += [subunitrun, "$LISTOPT", module]
395 args += extra_args
396 if name is None:
397 name = module
398 plantestsuite(name, env, args)
400 planoldpythontestsuite("dc:local", "samba.tests.gensec", extra_args=['-U"$USERNAME%$PASSWORD"'])
401 planoldpythontestsuite("none", "simple", extra_path=["%s/lib/tdb/python/tests" % srcdir()], name="tdb.python")
402 planpythontestsuite("dc:local", "samba.tests.dcerpc.sam")
403 planpythontestsuite("dc:local", "samba.tests.dsdb")
404 planpythontestsuite("dc:local", "samba.tests.dcerpc.bare")
405 planpythontestsuite("dc:local", "samba.tests.dcerpc.unix")
406 planpythontestsuite("dc:local", "samba.tests.dcerpc.srvsvc")
407 planpythontestsuite("dc:local", "samba.tests.samba_tool.timecmd")
409 # We run this test against both AD DC implemetnations because it is
410 # the only test we have of GPO get/set behaviour, and this involves
411 # the file server as well as the LDAP server.
412 planpythontestsuite("dc:local", "samba.tests.samba_tool.gpo")
413 planpythontestsuite("plugin_s4_dc:local", "samba.tests.samba_tool.gpo")
415 planpythontestsuite("dc:local", "samba.tests.samba_tool.processes")
416 planpythontestsuite("dc:local", "samba.tests.samba_tool.user")
417 planpythontestsuite("dc:local", "samba.tests.samba_tool.group")
418 planpythontestsuite("plugin_s4_dc:local", "samba.tests.samba_tool.ntacl")
420 planpythontestsuite("dc:local", "samba.tests.dcerpc.rpcecho")
421 planoldpythontestsuite("dc:local", "samba.tests.dcerpc.registry", extra_args=['-U"$USERNAME%$PASSWORD"'])
422 planoldpythontestsuite("dc", "samba.tests.dcerpc.dnsserver", extra_args=['-U"$USERNAME%$PASSWORD"'])
423 planoldpythontestsuite("plugin_s4_dc", "samba.tests.dcerpc.dnsserver", extra_args=['-U"$USERNAME%$PASSWORD"'])
424 plantestsuite("samba4.ldap.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
425 plantestsuite("samba4.tokengroups.python(dc)", "dc:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/token_group.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
426 plantestsuite("samba4.sam.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sam.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
427 planoldpythontestsuite("dc", "dsdb_schema_info",
428 extra_path=[os.path.join(samba4srcdir, 'dsdb/tests/python')],
429 name="samba4.schemaInfo.python(dc)",
430 extra_args=['-U"$DOMAIN/$DC_USERNAME%$DC_PASSWORD"'])
431 plantestsuite("samba4.urgent_replication.python(dc)", "dc:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/urgent_replication.py"), '$PREFIX_ABS/dc/private/sam.ldb'], allow_empty_output=True)
432 plantestsuite("samba4.ldap.dirsync.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/dirsync.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
433 plantestsuite("samba4.ldap.sites.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sites.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
434 for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
435 plantestsuite("samba4.ldap_schema.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap_schema.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
436 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"])
437 plantestsuite("samba4.ldap.secdesc.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/sec_descriptor.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
438 plantestsuite("samba4.ldap.acl.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/acl.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
439 if env != "fl2000dc":
440 # This test makes excessive use of the "userPassword" attribute which
441 # isn't available on DCs with Windows 2000 domain function level -
442 # therefore skip it in that configuration
443 plantestsuite("samba4.ldap.passwords.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/passwords.py"), "$SERVER", '-U"$USERNAME%$PASSWORD"', "-W$DOMAIN"])
445 planpythontestsuite("dc:local", "samba.tests.upgradeprovisionneeddc")
446 planpythontestsuite("plugin_s4_dc:local", "samba.tests.posixacl")
447 plantestsuite("samba4.deletetest.python(dc)", "dc", ['PYTHONPATH="$PYTHONPATH:%s/lib/subunit/python:%s/lib/testtools"' % (srcdir(), srcdir()),
448 python, os.path.join(samba4srcdir, "dsdb/tests/python/deletetest.py"),
449 '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
450 plantestsuite("samba4.blackbox.samba3dump", "none", [python, os.path.join(samba4srcdir, "scripting/bin/samba3dump"), os.path.join(samba4srcdir, "../testdata/samba3")], allow_empty_output=True)
451 plantestsuite("samba4.blackbox.upgrade", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_s3upgrade.sh"), '$PREFIX/provision'])
452 plantestsuite("samba4.blackbox.provision.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_provision.sh"), '$PREFIX/provision'])
453 plantestsuite("samba4.blackbox.upgradeprovision.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_upgradeprovision.sh"), '$PREFIX/provision'])
454 plantestsuite("samba4.blackbox.setpassword.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_setpassword.sh"), '$PREFIX/provision'])
455 plantestsuite("samba4.blackbox.newuser.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_newuser.sh"), '$PREFIX/provision'])
456 plantestsuite("samba4.blackbox.group.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_group.sh"), '$PREFIX/provision'])
457 plantestsuite("samba4.blackbox.spn.py(dc:local)", "dc:local", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_spn.sh"), '$PREFIX/dc'])
458 plantestsuite("samba4.ldap.bind(dc)", "dc", [python, os.path.join(srcdir(), "auth/credentials/tests/bind.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"'])
460 # DRS python tests
461 planoldpythontestsuite("vampire_dc", "samba.tests.blackbox.samba_tool_drs",
462 environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'},
463 extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
464 planoldpythontestsuite("vampire_dc:local", "replica_sync",
465 extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
466 name="samba4.drs.replica_sync.python(vampire_dc)",
467 environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'},
468 extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
469 planoldpythontestsuite("vampire_dc", "delete_object",
470 extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
471 name="samba4.drs.delete_object.python(vampire_dc)",
472 environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'},
473 extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
474 planoldpythontestsuite("vampire_dc", "fsmo",
475 name="samba4.drs.fsmo.python(vampire_dc)",
476 extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
477 environ={'DC1': "$DC_SERVER", 'DC2': "$VAMPIRE_DC_SERVER"},
478 extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
479 planoldpythontestsuite("vampire_dc", "repl_schema",
480 extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
481 name="samba4.drs.repl_schema.python(vampire_dc)",
482 environ={'DC1': "$DC_SERVER", 'DC2': '$VAMPIRE_DC_SERVER'},
483 extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
485 # This makes sure we test the rid allocation code
486 t = "rpc.samr.large-dc"
487 plansmbtorture4testsuite(t, "vampire_dc", ['$SERVER', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], modname=("samba4.%s.one" % t))
488 plansmbtorture4testsuite(t, "vampire_dc", ['$SERVER', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], modname="samba4.%s.two" % t)
490 # some RODC testing
491 for env in ['rodc']:
492 plansmbtorture4testsuite('rpc.echo', env, ['ncacn_np:$SERVER', "-k", "yes", '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], modname="samba4.rpc.echo")
493 plansmbtorture4testsuite('rpc.echo', "%s:local" % env, ['ncacn_np:$SERVER', "-k", "yes", '-P', '--workgroup=$DOMAIN'], modname="samba4.rpc.echo")
494 plantestsuite("samba4.blackbox.provision-backend", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_provision-backend.sh"), '$PREFIX/provision'])
496 # Test renaming the DC
497 plantestsuite("samba4.blackbox.renamedc.sh", "none", ["PYTHON=%s" % python, os.path.join(bbdir, "renamedc.sh"), '$PREFIX/provision'])
499 # Demote the vampire DC, it must be the last test on the VAMPIRE DC
500 for env in ['vampire_dc', 'promoted_dc']:
501 plantestsuite("samba4.blackbox.samba_tool_demote(%s)" % env, env, [os.path.join(samba4srcdir, "utils/tests/test_demote.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$DOMAIN', '$DC_SERVER', '$PREFIX/%s' % env, smbclient4])
502 # TODO: Verifying the databases really should be a part of the
503 # environment teardown.
504 # check the databases are all OK. PLEASE LEAVE THIS AS THE LAST TEST
505 for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc", 'vampire_dc', 'promoted_dc']:
506 plantestsuite("samba4.blackbox.dbcheck(%s)" % env, env + ":local" , ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck.sh"), '$PREFIX/provision', configuration])