60e16a5d1684e6be3d99dfb1ce047fa4f75edf00
[kai/samba.git] / source4 / selftest / tests.py
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.
4
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".
8
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.
15
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.
20
21 import os, sys
22 sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../selftest"))
23 from selftesthelpers import *
24 import subprocess
25
26 samba4srcdir = source4dir()
27 samba4bindir = bindir()
28 smb4torture = binpath("smbtorture4")
29 smb4torture_testsuite_list = subprocess.Popen([smb4torture, "--list-suites"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate("")[0].splitlines()
30 validate = os.getenv("VALIDATE", "")
31 if validate:
32     validate_list = [validate]
33 else:
34     validate_list = []
35
36 def plansmbtorturetestsuite(name, env, options):
37     modname = "samba4.%s" % name
38     cmdline = "%s $LISTOPT %s %s" % (valgrindify(smb4torture), options, name)
39     plantestsuite_loadlist(modname, env, cmdline)
40
41 def smb4torture_testsuites(prefix):
42     return filter(lambda x: x.startswith(prefix), smb4torture_testsuite_list)
43
44 subprocess.call([smb4torture, "-V"])
45
46 bbdir = os.path.join(srcdir(), "testprogs/blackbox")
47
48 configuration = "--configfile=$SMB_CONF_PATH"
49
50 torture_options = [configuration, "--maximum-runtime=$SELFTEST_MAXTIME", "--target=samba4", "--basedir=$SELFTEST_TMPDIR"]
51 if not os.getenv("SELFTEST_VERBOSE"):
52     torture_options.append("--option=torture:progress=no")
53 torture_options.append("--format=subunit")
54 if os.getenv("SELFTEST_QUICK"):
55     torture_options.append("--option=torture:quick=yes")
56 smb4torture += " " + " ".join(torture_options)
57
58 print "OPTIONS %s" % " ".join(torture_options)
59
60 # Simple tests for LDAP and CLDAP
61 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']:
62     plantestsuite("samba4.ldb.ldap with options %s(dc)" % options, "dc", "%s/test_ldb.sh ldap $SERVER %s" % (bbdir, options))
63
64 # see if we support ADS on the Samba3 side
65 try:
66     config_h = os.environ["CONFIG_H"]
67 except KeyError:
68     config_h = os.path.join(samba4bindir, "default/include/config.h")
69
70 f = open(config_h, 'r')
71 try:
72     # The other parts of the HAVE_ADS test are always supplied by the top level build
73     have_ads_support = ("HAVE_LDAP 1" in f.read())
74 finally:
75     f.close()
76
77 # see if we support ldaps
78 f = open(config_h, 'r')
79 try:
80     have_tls_support = ("ENABLE_GNUTLS 1" in f.read())
81 finally:
82     f.close()
83
84 if have_tls_support:
85     for options in ['-U"$USERNAME%$PASSWORD"']:
86         plantestsuite("samba4.ldb.ldaps with options %s(dc)" % options, "dc",
87                 "%s/test_ldb.sh ldaps $SERVER_IP %s" % (bbdir, options))
88
89 for options in ['-U"$USERNAME%$PASSWORD"']:
90     plantestsuite("samba4.ldb.ldapi with options %s(dc:local)" % options, "dc:local",
91             "%s/test_ldb.sh ldapi $PREFIX_ABS/dc/private/ldapi %s" % (bbdir, options))
92
93 for t in smb4torture_testsuites("ldap."):
94     plansmbtorturetestsuite(t, "dc", '-U"$USERNAME%$PASSWORD" //$SERVER_IP/_none_')
95
96 ldbdir = os.path.join(srcdir(), "lib/ldb")
97 # Don't run LDB tests when using system ldb, as we won't have ldbtest installed
98 if os.path.exists(os.path.join(samba4bindir, "ldbtest")):
99     plantestsuite("ldb.base", "none", "%s/tests/test-tdb.sh" % ldbdir,
100                   allow_empty_output=True)
101 else:
102     skiptestsuite("ldb.base", "Using system LDB, ldbtest not available")
103
104 # Tests for RPC
105
106 # add tests to this list as they start passing, so we test
107 # that they stay passing
108 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"]
109 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"]
110 drs_rpc_tests = smb4torture_testsuites("drs.rpc")
111 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
112 slow_ncacn_np_tests = ["rpc.samlogon", "rpc.samr.users", "rpc.samr.large-dc", "rpc.samr.users.privileges", "rpc.samr.passwords", "rpc.samr.passwords.pwdlastset"]
113 slow_ncacn_ip_tcp_tests = ["rpc.samr", "rpc.cracknames"]
114
115 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"]
116
117 # Make sure all tests get run
118 rpc_tests = smb4torture_testsuites("rpc.")
119 auto_rpc_tests = filter(lambda t: t not in all_rpc_tests, rpc_tests)
120
121 for bindoptions in ["seal,padcheck"] + validate_list + ["bigendian"]:
122     for transport in ["ncalrpc", "ncacn_np", "ncacn_ip_tcp"]:
123         env = "dc"
124         if transport == "ncalrpc":
125             tests = ncalrpc_tests
126             env = "dc:local"
127         elif transport == "ncacn_np":
128             tests = ncacn_np_tests
129         elif transport == "ncacn_ip_tcp":
130             tests = ncacn_ip_tcp_tests
131         for t in tests:
132             plantestsuite_loadlist("samba4.%s on %s with %s" % (t, transport, bindoptions), env, [valgrindify(smb4torture), "$LISTOPT", "%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t])
133         plantestsuite_loadlist("samba4.rpc.samba3.sharesec on %s with %s" % (transport, bindoptions), env, [valgrindify(smb4torture), "$LISTOPT", "%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', '--option=torture:share=tmp', 'rpc.samba3-sharesec'])
134
135 #Plugin S4 DC tests (confirms named pipe auth forwarding).  This can be expanded once kerberos is supported in the plugin DC
136 #
137 if have_ads_support:
138     for bindoptions in ["seal,padcheck"] + validate_list + ["bigendian"]:
139         for t in ncacn_np_tests:
140             env = "plugin_s4_dc"
141             transport = "ncacn_np"
142             plantestsuite_loadlist("samba4.%s with %s" % (t, bindoptions), env, [valgrindify(smb4torture), "$LISTOPT", "%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', '-k', 'no', t])
143
144 for bindoptions in [""] + validate_list + ["bigendian"]:
145     for t in auto_rpc_tests:
146         plantestsuite_loadlist("samba4.%s with %s" % (t, bindoptions), "dc", [valgrindify(smb4torture), "$LISTOPT", "$SERVER[%s]" % bindoptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t])
147
148 t = "rpc.countcalls"
149 plantestsuite_loadlist("samba4.%s" % t, "dc:local", [valgrindify(smb4torture), "$LISTOPT", "$SERVER[%s]" % bindoptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t])
150
151 for transport in ["ncacn_np", "ncacn_ip_tcp"]:
152     env = "dc"
153     if transport == "ncacn_np":
154         tests = slow_ncacn_np_tests
155     elif transport == "ncacn_ip_tcp":
156         tests = slow_ncacn_ip_tcp_tests
157     for t in tests:
158         plantestsuite_loadlist("samba4.%s on %s" % (t, transport), env, [valgrindify(smb4torture), "$LISTOPT", "%s:$SERVER" % transport, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t])
159
160 # Tests for the DFS referral calls implementation
161 for t in smb4torture_testsuites("dfs."):
162     plansmbtorturetestsuite(t, "dc", '//$SERVER/ipc\$ -U$USERNAME%$PASSWORD')
163
164 # Tests for the NET API (net.api.become.dc tested below against all the roles)
165 net_tests = filter(lambda x: "net.api.become.dc" not in x, smb4torture_testsuites("net."))
166 for t in net_tests:
167     plansmbtorturetestsuite(t, "dc", '$SERVER[%s] -U$USERNAME%%$PASSWORD -W $DOMAIN' % validate)
168
169 # Tests for session keys and encryption of RPC pipes
170 # FIXME: Integrate these into a single smbtorture test
171
172 transport = "ncacn_np"
173 for ntlmoptions in [
174     "-k no --option=usespnego=yes",
175     "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no",
176     "-k no --option=usespnego=yes --option=ntlmssp_client:56bit=yes",
177     "-k no --option=usespnego=yes --option=ntlmssp_client:56bit=no",
178     "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes",
179     "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=no",
180     "-k no --option=usespnego=yes --option=clientntlmv2auth=yes",
181     "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no",
182     "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes",
183     "-k no --option=usespnego=no --option=clientntlmv2auth=yes",
184     "-k no --option=gensec:spnego=no --option=clientntlmv2auth=yes",
185     "-k no --option=usespnego=no"]:
186     name = "rpc.lsa.secrets on %s with with %s" % (transport, ntlmoptions)
187     plantestsuite_loadlist("samba4.%s" % name, "dc", [smb4torture, "$LISTOPT", "%s:$SERVER[]" % (transport), ntlmoptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', '--option=gensec:target_hostname=$NETBIOSNAME', 'rpc.lsa.secrets'])
188
189 transports = ["ncacn_np", "ncacn_ip_tcp"]
190
191 #Kerberos varies between functional levels, so it is important to check this on all of them
192 for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
193     transport = "ncacn_np"
194     plantestsuite_loadlist("samba4.rpc.pac on %s" % (transport,), env, [smb4torture, "$LISTOPT", "%s:$SERVER[]" % (transport, ), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'rpc.pac'])
195     for transport in transports:
196         plantestsuite_loadlist("samba4.rpc.lsa.secrets on %s with Kerberos" % (transport,), env, [smb4torture, "$LISTOPT", "%s:$SERVER[]" % (transport, ), '-k', 'yes', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', '--option=gensec:target_hostname=$NETBIOSNAME', 'rpc.lsa.secrets'])
197         plantestsuite_loadlist("samba4.rpc.lsa.secrets on %s with Kerberos - use target principal" % (transport,), env, [smb4torture, "$LISTOPT", "%s:$SERVER[]" % (transport, ), '-k', 'yes', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', "--option=clientusespnegoprincipal=yes", '--option=gensec:target_hostname=$NETBIOSNAME', 'rpc.lsa.secrets'])
198         plantestsuite_loadlist("samba4.rpc.lsa.secrets on %s with Kerberos - use Samba3 style login" % transport, env, [smb4torture, "$LISTOPT", "%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*"])
199         plantestsuite_loadlist("samba4.rpc.lsa.secrets on %s with Kerberos - use Samba3 style login, use target principal" % transport, env, [smb4torture, "$LISTOPT", "%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*"])
200         plantestsuite_loadlist("samba4.rpc.echo on %s" % (transport, ), env, [smb4torture, "$LISTOPT", "%s:$SERVER[]" % (transport,), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'rpc.echo'])
201
202         # Echo tests test bulk Kerberos encryption of DCE/RPC
203         for bindoptions in ["connect", "spnego", "spnego,sign", "spnego,seal"] + validate_list + ["padcheck", "bigendian", "bigendian,seal"]:
204             echooptions = "--option=socket:testnonblock=True --option=torture:quick=yes -k yes"
205             plantestsuite_loadlist("samba4.rpc.echo on %s with %s and %s" % (transport, bindoptions, echooptions), env, [smb4torture, "$LISTOPT", "%s:$SERVER[%s]" % (transport, bindoptions), echooptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'rpc.echo'])
206     plansmbtorturetestsuite("net.api.become.dc", env, '$SERVER[%s] -U$USERNAME%%$PASSWORD -W $DOMAIN' % validate)
207
208 for bindoptions in ["sign", "seal"]:
209     env = "dc"
210     plantestsuite_loadlist("samba4.rpc.backupkey with %s" % (bindoptions), env, [smb4torture, "$LISTOPT", "ncacn_np:$SERVER[%s]" % ( bindoptions), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'rpc.backupkey'])
211
212 for transport in transports:
213     for bindoptions in ["sign", "seal"]:
214         for ntlmoptions in [
215         "--option=ntlmssp_client:ntlm2=yes --option=torture:quick=yes",
216         "--option=ntlmssp_client:ntlm2=no --option=torture:quick=yes",
217         "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:128bit=no --option=torture:quick=yes",
218         "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:128bit=no --option=torture:quick=yes",
219         "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes",
220         "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes",
221         "--option=clientntlmv2auth=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes",
222         "--option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=yes --option=torture:quick=yes",
223         "--option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes"]:
224             if transport == "ncalrpc":
225                 env = "dc:local"
226             else:
227                 env = "dc"
228             plantestsuite_loadlist("samba4.rpc.echo on %s with %s and %s" % (transport, bindoptions, ntlmoptions), env, [smb4torture, "$LISTOPT", "%s:$SERVER[%s]" % (transport, bindoptions), ntlmoptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'rpc.echo'])
229
230 plantestsuite_loadlist("samba4.rpc.echo on ncacn_np over smb2", "dc", [smb4torture, "$LISTOPT", 'ncacn_np:$SERVER[smb2]', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'rpc.echo'])
231
232 plantestsuite_loadlist("samba4.ntp.signd", "dc:local", [smb4torture, "$LISTOPT", 'ncacn_np:$SERVER', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'ntp.signd'])
233
234 nbt_tests = smb4torture_testsuites("nbt.")
235 for t in nbt_tests:
236     plansmbtorturetestsuite(t, "dc", "//$SERVER/_none_ -U\"$USERNAME%$PASSWORD\"")
237
238 # Tests against the NTVFS POSIX backend
239 ntvfsargs = ["--option=torture:sharedelay=10000", "--option=torture:oplocktimeout=3", "--option=torture:writetimeupdatedelay=50000"]
240
241 smb2 = smb4torture_testsuites("smb2.")
242 #The QFILEINFO-IPC test needs to be on ipc$
243 raw = filter(lambda x: "raw.qfileinfo.ipc" not in x, smb4torture_testsuites("raw."))
244 base = smb4torture_testsuites("base.")
245
246 netapi = smb4torture_testsuites("netapi.")
247
248 libsmbclient = smb4torture_testsuites("libsmbclient.")
249
250 for t in base + raw + smb2 + netapi + libsmbclient:
251     plansmbtorturetestsuite(t, "dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD' + " " + " ".join(ntvfsargs))
252
253 plansmbtorturetestsuite("raw.qfileinfo.ipc", "dc", '//$SERVER/ipc\$ -U$USERNAME%$PASSWORD')
254
255 for t in smb4torture_testsuites("rap."):
256     plansmbtorturetestsuite(t, "dc", '//$SERVER/IPC\$ -U$USERNAME%$PASSWORD')
257
258 # Tests against the NTVFS CIFS backend
259 for t in base + raw:
260     plantestsuite_loadlist("samba4.ntvfs.cifs.krb5.%s" % t, "dc", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/cifs', '-U$USERNAME%$PASSWORD', '--kerberos=yes'] + ntvfsargs + [t])
261
262 # Test NTVFS CIFS backend with S4U2Self and S4U2Proxy
263 t = "base.unlink"
264 plantestsuite_loadlist("samba4.ntvfs.cifs.ntlm.%s" % t, "dc", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/cifs', '-U$USERNAME%$PASSWORD', '--kerberos=no'] + ntvfsargs + [t])
265 plantestsuite_loadlist("samba4.ntvfs.cifs.krb5.%s" % t, "rpc_proxy", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/cifs_to_dc', '-U$DC_USERNAME%$DC_PASSWORD', '--kerberos=yes'] + ntvfsargs + [t])
266 plantestsuite_loadlist("samba4.ntvfs.cifs.ntlm.%s" % t, "rpc_proxy", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/cifs_to_dc', '-U$DC_USERNAME%$DC_PASSWORD', '--kerberos=no'] + ntvfsargs + [t])
267
268 plansmbtorturetestsuite('echo.udp', 'dc:local', '//$SERVER/whatever')
269
270 # Local tests
271 for t in smb4torture_testsuites("local."):
272     plansmbtorturetestsuite(t, "none", "ncalrpc:")
273
274 # Confirm these tests with the system iconv too
275 for t in ["local.convert_string_handle", "local.convert_string", "local.ndr"]:
276     modname = "samba4.%s.iconv.modules" % t
277     cmdline = "%s %s %s" % (valgrindify(smb4torture), "ncalrpc: --option='iconv:native=false'", t)
278     plantestsuite_loadlist(modname, env, cmdline)
279
280 tdbtorture4 = binpath("tdbtorture")
281 if os.path.exists(tdbtorture4):
282     plantestsuite("tdb.stress", "none", valgrindify(tdbtorture4))
283 else:
284     skiptestsuite("tdb.stress", "Using system TDB, tdbtorture not available")
285
286 plansmbtorturetestsuite("drs.unit", "none", "ncalrpc:")
287
288 # Pidl tests
289 for f in sorted(os.listdir(os.path.join(samba4srcdir, "../pidl/tests"))):
290     if f.endswith(".pl"):
291         planperltestsuite("pidl.%s" % f[:-3], os.path.normpath(os.path.join(samba4srcdir, "../pidl/tests", f)))
292
293 # Blackbox Tests:
294 # tests that interact directly with the command-line tools rather than using
295 # the API. These mainly test that the various command-line options of commands
296 # work correctly.
297
298 planpythontestsuite("none", "samba.tests.blackbox.ndrdump")
299 planpythontestsuite("none", "samba.tests.source")
300 plantestsuite("samba4.blackbox.samba_tool(dc:local)", "dc:local", [os.path.join(samba4srcdir, "utils/tests/test_samba_tool.sh"),  '$SERVER', "$USERNAME", "$PASSWORD", "$DOMAIN"])
301 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])
302 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])
303 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])
304 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])
305 plantestsuite("samba4.blackbox.ktpass(dc)", "dc", [os.path.join(bbdir, "test_ktpass.sh"), '$PREFIX'])
306 plantestsuite("samba4.blackbox.passwords(dc:local)", "dc:local", [os.path.join(bbdir, "test_passwords.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', "$PREFIX"])
307 plantestsuite("samba4.blackbox.export.keytab(dc:local)", "dc:local", [os.path.join(bbdir, "test_export_keytab.sh"), '$SERVER', '$USERNAME', '$REALM', '$DOMAIN', "$PREFIX"])
308 plantestsuite("samba4.blackbox.cifsdd(dc)", "dc", [os.path.join(samba4srcdir, "client/tests/test_cifsdd.sh"), '$SERVER', '$USERNAME', '$PASSWORD', "$DOMAIN"])
309 plantestsuite("samba4.blackbox.nmblookup(dc)", "dc", [os.path.join(samba4srcdir, "utils/tests/test_nmblookup.sh"), '$NETBIOSNAME', '$NETBIOSALIAS', '$SERVER', '$SERVER_IP'])
310 plantestsuite("samba4.blackbox.locktest(dc)", "dc", [os.path.join(samba4srcdir, "torture/tests/test_locktest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', '$PREFIX'])
311 plantestsuite("samba4.blackbox.masktest", "dc", [os.path.join(samba4srcdir, "torture/tests/test_masktest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', '$PREFIX'])
312 plantestsuite("samba4.blackbox.gentest(dc)", "dc", [os.path.join(samba4srcdir, "torture/tests/test_gentest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', "$PREFIX"])
313 plantestsuite("samba4.blackbox.wbinfo(dc:local)", "dc:local", [os.path.join(samba4srcdir, "../nsswitch/tests/test_wbinfo.sh"), '$DOMAIN', '$USERNAME', '$PASSWORD', "dc"])
314 plantestsuite("samba4.blackbox.wbinfo(s4member:local)", "s4member:local", [os.path.join(samba4srcdir, "../nsswitch/tests/test_wbinfo.sh"), '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', "s4member"])
315 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'])
316
317 # Tests using the "Simple" NTVFS backend
318 for t in ["base.rw1"]:
319     plantestsuite_loadlist("samba4.ntvfs.simple.%s" % t, "dc", [valgrindify(smb4torture), "$LISTOPT", "//$SERVER/simple", '-U$USERNAME%$PASSWORD', t])
320
321 # Domain S4member Tests
322 plantestsuite_loadlist("samba4.rpc.echo against s4member server with local creds", "s4member", [valgrindify(smb4torture), "$LISTOPT", 'ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD', 'rpc.echo'])
323 plantestsuite_loadlist("samba4.rpc.echo against s4member server with domain creds", "s4member", [valgrindify(smb4torture), "$LISTOPT", 'ncacn_np:$NETBIOSNAME', '-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD', 'rpc.echo'])
324 plantestsuite_loadlist("samba4.rpc.samr against s4member server with local creds", "s4member", [valgrindify(smb4torture), "$LISTOPT", 'ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD', "rpc.samr"])
325 plantestsuite_loadlist("samba4.rpc.samr.users against s4member server with local creds", "s4member", [valgrindify(smb4torture), "$LISTOPT", 'ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD', "rpc.samr.users"])
326 plantestsuite_loadlist("samba4.rpc.samr.passwords against s4member server with local creds", "s4member", [valgrindify(smb4torture), "$LISTOPT", 'ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD', "rpc.samr.passwords"])
327 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'])
328
329 # RPC Proxy
330 plantestsuite_loadlist("samba4.rpc.echo against rpc proxy with domain creds", "rpc_proxy", [valgrindify(smb4torture), "$LISTOPT", 'ncacn_ip_tcp:$NETBIOSNAME', '-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD', "rpc.echo"])
331
332 # Tests SMB signing
333 for mech in [
334     "-k no",
335     "-k no --option=usespnego=no",
336     "-k no --option=gensec:spengo=no",
337     "-k yes",
338     "-k yes --option=gensec:fake_gssapi_krb5=yes --option=gensec:gssapi_krb5=no"]:
339     for signing in ["--signing=on", "--signing=required"]:
340         signoptions = "%s %s" % (mech, signing)
341         name = "smb.signing on with %s" % signoptions
342         plantestsuite_loadlist("samba4.%s" % name, "dc", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', signoptions, '-U$USERNAME%$PASSWORD', 'base.xcopy'])
343
344 for mech in [
345     "-k no",
346     "-k no --option=usespnego=no",
347     "-k no --option=gensec:spengo=no",
348     "-k yes"]:
349     signoptions = "%s --signing=off" % mech
350     name = "smb.signing disabled on with %s" % signoptions
351     plantestsuite_loadlist("samba4.%s domain-creds" % name, "s4member", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', signoptions, '-U$DC_USERNAME%$DC_PASSWORD', 'base.xcopy'])
352     if have_ads_support:
353         plantestsuite_loadlist("samba4.%s domain-creds" % name, "s3member", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', signoptions, '-U$DC_USERNAME%$DC_PASSWORD', 'base.xcopy'])
354         plantestsuite_loadlist("samba4.%s" % name, "plugin_s4_dc", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', signoptions, '-U$USERNAME%$PASSWORD', 'base.xcopy'])
355         plantestsuite_loadlist("samba4.%s administrator" % name, "plugin_s4_dc",
356                                [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', signoptions, '-U$DC_USERNAME%$DC_PASSWORD', 'base.xcopy'])
357
358 for mech in [
359     "-k no",
360     "-k no --option=usespnego=no",
361     "-k no --option=gensec:spengo=no"]:
362     signoptions = "%s --signing=off" % mech
363     name = "smb.signing on with %s" % signoptions
364     plantestsuite_loadlist("samba4.%s local-creds" % name, "s4member", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', signoptions, '-U$NETBIOSNAME/$USERNAME%$PASSWORD', 'base.xcopy'])
365
366 plantestsuite_loadlist("samba4.smb.signing --signing=yes anon", "dc", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', '-k', 'no', '--signing=yes', '-U%', 'base.xcopy'])
367 plantestsuite_loadlist("samba4.smb.signing --signing=required anon", "dc", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', '-k', 'no', '--signing=required', '-U%', 'base.xcopy'])
368 plantestsuite_loadlist("samba4.smb.signing --signing=no anon", "s4member",  [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', '-k', 'no', '--signing=no', '-U%', 'base.xcopy'])
369
370
371 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\""]
372
373 winbind_struct_tests = smb4torture_testsuites("winbind.struct")
374 winbind_ndr_tests = smb4torture_testsuites("winbind.ndr")
375 for env in ["dc", "s4member"]:
376     for t in winbind_struct_tests:
377         plansmbtorturetestsuite(t, env, "%s //_none_/_none_" % " ".join(wb_opts))
378
379     for t in winbind_ndr_tests:
380         plansmbtorturetestsuite(t, env, "%s //_none_/_none_" % " ".join(wb_opts))
381
382 nsstest4 = binpath("nsstest")
383 if os.path.exists(nsstest4):
384     plantestsuite("samba4.nss.test using winbind(s4member)", "s4member", [valgrindify(nsstest4), os.path.join(samba4bindir, "shared/libnss_winbind.so")])
385 else:
386     skiptestsuite("samba4.nss.test using winbind(s4member)", "nsstest not available")
387
388 subunitrun = valgrindify(python) + " " + os.path.join(samba4srcdir, "scripting/bin/subunitrun")
389 def plansambapythontestsuite(name, env, path, module, environ={}, extra_args=[]):
390     environ = dict(environ)
391     environ["PYTHONPATH"] = "$PYTHONPATH:" + path
392     args = ["%s=%s" % item for item in environ.iteritems()]
393     args += [subunitrun, "$LISTOPT", module]
394     args += extra_args
395     plantestsuite(name, env, args)
396
397
398 plansambapythontestsuite("ldb.python", "none", "%s/lib/ldb/tests/python/" % srcdir(), 'api')
399 planpythontestsuite("none", "samba.tests.credentials")
400 plantestsuite_idlist("samba.tests.gensec", "dc:local", [subunitrun, "$LISTOPT", '-U"$USERNAME%$PASSWORD"', "samba.tests.gensec"])
401 planpythontestsuite("none", "samba.tests.registry")
402 plansambapythontestsuite("tdb.python", "none", "%s/lib/tdb/python/tests" % srcdir(), 'simple')
403 planpythontestsuite("none", "samba.tests.auth")
404 planpythontestsuite("none", "samba.tests.security")
405 planpythontestsuite("none", "samba.tests.dcerpc.misc")
406 planpythontestsuite("none", "samba.tests.param")
407 planpythontestsuite("none", "samba.tests.upgrade")
408 planpythontestsuite("none", "samba.tests.core")
409 planpythontestsuite("none", "samba.tests.provision")
410 planpythontestsuite("none", "samba.tests.samba3")
411 planpythontestsuite("none", "samba.tests.strings")
412 planpythontestsuite("dc:local", "samba.tests.dcerpc.sam")
413 planpythontestsuite("dc:local", "samba.tests.dsdb")
414 planpythontestsuite("none", "samba.tests.netcmd")
415 planpythontestsuite("dc:local", "samba.tests.dcerpc.bare")
416 planpythontestsuite("dc:local", "samba.tests.dcerpc.unix")
417 planpythontestsuite("none", "samba.tests.dcerpc.rpc_talloc")
418 planpythontestsuite("none", "samba.tests.samdb")
419 planpythontestsuite("none", "samba.tests.hostconfig")
420 planpythontestsuite("none", "samba.tests.messaging")
421 planpythontestsuite("none", "samba.tests.samba3sam")
422 planpythontestsuite("none", "subunit")
423 planpythontestsuite("dc:local", "samba.tests.dcerpc.rpcecho")
424 plantestsuite_idlist("samba.tests.dcerpc.registry", "dc:local", [subunitrun, "$LISTOPT", '-U"$USERNAME%$PASSWORD"', "samba.tests.dcerpc.registry"])
425 plantestsuite("samba4.ldap.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
426 plantestsuite("samba4.tokengroups.python(dc)", "dc:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/token_group.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
427 plantestsuite("samba4.sam.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sam.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
428 plansambapythontestsuite("samba4.schemaInfo.python(dc)", "dc", os.path.join(samba4srcdir, 'dsdb/tests/python'), 'dsdb_schema_info', extra_args=['-U"$DOMAIN/$DC_USERNAME%$DC_PASSWORD"'])
429 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)
430 plantestsuite("samba4.ldap.dirsync.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/dirsync.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
431 for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
432     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'])
433     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"])
434     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'])
435     plantestsuite("samba4.ldap.acl.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/acl.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
436     if env != "fl2000dc":
437         # This test makes excessively use of the "userPassword" attribute which
438         # isn't available on DCs with Windows 2000 domain function level -
439         # therefore skip it in that configuration
440         plantestsuite("samba4.ldap.passwords.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/passwords.py"), "$SERVER", '-U"$USERNAME%$PASSWORD"', "-W", "$DOMAIN"])
441 planpythontestsuite("dc:local", "samba.tests.upgradeprovisionneeddc")
442 planpythontestsuite("none", "samba.tests.upgradeprovision")
443 planpythontestsuite("none", "samba.tests.xattr")
444 planpythontestsuite("none", "samba.tests.ntacls")
445 plantestsuite("samba4.deletetest.python(dc)", "dc", ['PYTHONPATH="$PYTHONPATH:%s/lib/subunit/python:%s/lib/testtools"' % (srcdir(), srcdir()),
446                                                      python, os.path.join(samba4srcdir, "dsdb/tests/python/deletetest.py"),
447                                                      '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN'])
448 plansambapythontestsuite("samba4.policy.python", "none", "%s/lib/policy/tests/python" % samba4srcdir, 'bindings')
449 plantestsuite("samba4.blackbox.samba3dump", "none", [python, os.path.join(samba4srcdir, "scripting/bin/samba3dump"), os.path.join(samba4srcdir, "../testdata/samba3")], allow_empty_output=True)
450 plantestsuite("samba4.blackbox.upgrade", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_s3upgrade.sh"), '$PREFIX/provision'])
451 plantestsuite("samba4.blackbox.provision.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_provision.sh"), '$PREFIX/provision'])
452 plantestsuite("samba4.blackbox.upgradeprovision.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_upgradeprovision.sh"), '$PREFIX/provision'])
453 plantestsuite("samba4.blackbox.setpassword.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_setpassword.sh"), '$PREFIX/provision'])
454 plantestsuite("samba4.blackbox.newuser.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_newuser.sh"), '$PREFIX/provision'])
455 plantestsuite("samba4.blackbox.group.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_group.sh"), '$PREFIX/provision'])
456 plantestsuite("samba4.blackbox.spn.py(dc:local)", "dc:local", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_spn.sh"), '$PREFIX/dc'])
457 plantestsuite("samba4.ldap.bind(dc)", "dc", [python, os.path.join(samba4srcdir, "auth/credentials/tests/bind.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"'])
458
459 # DRS python tests
460 plansambapythontestsuite("samba4.blackbox.samba-tool.drs(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'scripting/python'), "samba.tests.blackbox.samba_tool_drs", environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
461 plansambapythontestsuite("samba4.drs.replica_sync.python(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'torture/drs/python'), "replica_sync", environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
462 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'])
463 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'])
464 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'])
465
466 # This makes sure we test the rid allocation code
467 t = "rpc.samr.large-dc"
468 plantestsuite_loadlist("samba4.%s.one" % t, "vampire_dc", [valgrindify(smb4torture), "$LISTOPT", '$SERVER', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t])
469 plantestsuite_loadlist("samba4.%s.two" % t, "vampire_dc", [valgrindify(smb4torture), "$LISTOPT", '$SERVER', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t])
470
471 # some RODC testing
472 for env in ['rodc']:
473     plantestsuite_loadlist("samba4.rpc.echo", env, [smb4torture, "$LISTOPT", 'ncacn_np:$SERVER', "-k", "yes", '-U$USERNAME%$PASSWORD', '-W' '$DOMAIN', 'rpc.echo'])
474     plantestsuite_loadlist("samba4.rpc.echo", "%s:local" % env, [smb4torture, "$LISTOPT", 'ncacn_np:$SERVER', "-k", "yes", '-P', '-W' '$DOMAIN', 'rpc.echo'])
475 plantestsuite("samba4.blackbox.provision-backend.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_provision-backend.sh"), '$PREFIX/provision'])
476
477 # Test renaming the DC
478 plantestsuite("samba4.blackbox.renamedc.sh", "none", ["PYTHON=%s" % python, os.path.join(bbdir, "renamedc.sh"), '$PREFIX/provision'])
479
480 # check the databases are all OK. PLEASE LEAVE THIS AS THE LAST TEST
481 for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
482     plantestsuite("samba4.blackbox.dbcheck(%s)" % env, env + ":local" , ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck.sh"), '$PREFIX/provision', configuration])