PEP8: fix E202: whitespace before ')'
[samba.git] / source3 / 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 3 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 3, 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/samba3-knownfail. This makes it
12 # very easy to see what functionality is still missing in Samba 3 and makes
13 # it possible to run the testsuite against other servers, such as Samba 4 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.normpath(os.path.join(os.path.dirname(__file__), "../../selftest")))
23 import selftesthelpers
24 from selftesthelpers import *
25 smbtorture4_options.extend([
26     '--option=torture:sharedelay=100000',
27    '--option=torture:writetimeupdatedelay=500000',
28 ])
29
30 def plansmbtorture4testsuite(name, env, options, description=''):
31     if description == '':
32         modname = "samba3.%s" % (name, )
33     else:
34         modname = "samba3.%s %s" % (name, description)
35
36     selftesthelpers.plansmbtorture4testsuite(
37         name, env, options, target='samba3', modname=modname)
38
39 # find config.h
40 try:
41     config_h = os.environ["CONFIG_H"]
42 except KeyError:
43     samba4bindir = bindir()
44     config_h = os.path.join(samba4bindir, "default/include/config.h")
45
46 # check available features
47 config_hash = dict()
48 f = open(config_h, 'r')
49 try:
50     lines = f.readlines()
51     config_hash = dict((x[0], ' '.join(x[1:]))
52                        for x in map(lambda line: line.strip().split(' ')[1:],
53                                     filter(lambda line: (line[0:7] == '#define') and (len(line.split(' ')) > 2), lines)))
54 finally:
55     f.close()
56
57 have_linux_kernel_oplocks = ("HAVE_KERNEL_OPLOCKS_LINUX" in config_hash)
58 have_inotify = ("HAVE_INOTIFY" in config_hash)
59 have_ldwrap = ("HAVE_LDWRAP" in config_hash)
60 with_pthreadpool = ("WITH_PTHREADPOOL" in config_hash)
61
62
63 plantestsuite("samba3.blackbox.success", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/test_success.sh")])
64 plantestsuite("samba3.blackbox.failure", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/test_failure.sh")])
65
66 plantestsuite("samba3.local_s3", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/test_local_s3.sh")])
67
68 plantestsuite("samba3.blackbox.registry.upgrade", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/test_registry_upgrade.sh"), net, dbwrap_tool])
69
70 tests = ["FDPASS", "LOCK1", "LOCK2", "LOCK3", "LOCK4", "LOCK5", "LOCK6", "LOCK7", "LOCK9",
71          "UNLINK", "BROWSE", "ATTR", "TRANS2", "TORTURE",
72          "OPLOCK1", "OPLOCK2", "OPLOCK4", "STREAMERROR",
73          "DIR", "DIR1", "DIR-CREATETIME", "TCON", "TCONDEV", "RW1", "RW2", "RW3", "LARGE_READX", "RW-SIGNING",
74          "OPEN", "XCOPY", "RENAME", "DELETE", "DELETE-LN", "WILDDELETE", "PROPERTIES", "W2K",
75          "TCON2", "IOCTL", "CHKPATH", "FDSESS", "CHAIN1", "CHAIN2", "OWNER-RIGHTS",
76          "CHAIN3", "PIDHIGH", "CLI_SPLICE",
77          "UID-REGRESSION-TEST", "SHORTNAME-TEST",
78          "CASE-INSENSITIVE-CREATE", "SMB2-BASIC", "NTTRANS-FSCTL", "SMB2-NEGPROT",
79          "SMB2-SESSION-REAUTH", "SMB2-SESSION-RECONNECT", "SMB2-FTRUNCATE",
80          "SMB2-ANONYMOUS", "SMB2-DIR-FSYNC",
81          "CLEANUP1",
82          "CLEANUP2",
83          "CLEANUP4",
84          "BAD-NBT-SESSION"]
85
86 for t in tests:
87     plantestsuite("samba3.smbtorture_s3.plain(fileserver).%s" % t, "fileserver", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmp', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
88     plantestsuite("samba3.smbtorture_s3.crypt_client(nt4_dc).%s" % t, "nt4_dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmp', '$USERNAME', '$PASSWORD', smbtorture3, "-e", "-l $LOCAL_PATH"])
89     if t == "TORTURE":
90         # this is a negative test to verify that the server rejects
91         # access without encryption
92         plantestsuite("samba3.smbtorture_s3.crypt_server(nt4_dc).%s" % t, "nt4_dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmpenc', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
93     if t == "CLI_SPLICE":
94         # We must test this against the SMB1 fallback.
95         plantestsuite("samba3.smbtorture_s3.plain(fileserver).%s" % t, "fileserver", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmp', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH", "-mNT1"])
96     plantestsuite("samba3.smbtorture_s3.plain(ad_dc_ntvfs).%s" % t, "ad_dc_ntvfs", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmp', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
97
98 t = "TLDAP"
99 plantestsuite("samba3.smbtorture_s3.plain.%s(ad_dc)" % t, "ad_dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER/tmp', '$DC_USERNAME', '$DC_PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
100
101 #
102 # RENAME-ACCESS needs to run against a special share - acl_xattr_ign_sysacl_windows
103 #
104 plantestsuite("samba3.smbtorture_s3.plain(nt4_dc).%s" % "RENAME-ACCESS","nt4_dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), "RENAME-ACCESS", '//$SERVER_IP/acl_xattr_ign_sysacl_windows', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
105 plantestsuite("samba3.smbtorture_s3.crypt_client(nt4_dc).%s" % "RENAME-ACCESS", "nt4_dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), "RENAME-ACCESS", '//$SERVER_IP/acl_xattr_ign_sysacl_windows', '$USERNAME', '$PASSWORD', smbtorture3, "-e", "-l $LOCAL_PATH"])
106 # non-crypt only
107
108 tests = ["OPLOCK-CANCEL"]
109 for t in tests:
110     plantestsuite("samba3.smbtorture_s3.plain(nt4_dc).%s" % t, "nt4_dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmp', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
111
112 env = "nt4_dc"
113 tests = ["MANGLE-ILLEGAL"]
114 for t in tests:
115     plantestsuite("samba3.smbtorture_s3.plain(%s).%s" % (env, t), env, [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/mangle_illegal', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
116
117 tests = ["RW1", "RW2", "RW3", "SMB2-BASIC"]
118 for t in tests:
119     plantestsuite("samba3.smbtorture_s3.vfs_aio_pthread(simpleserver).%s" % t, "simpleserver", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/vfs_aio_pthread', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
120     plantestsuite("samba3.smbtorture_s3.vfs_aio_fork(simpleserver).%s" % t, "simpleserver", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/vfs_aio_fork', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
121
122 shares = [
123     "vfs_aio_pthread_async_dosmode_default1",
124     "vfs_aio_pthread_async_dosmode_default2",
125     "vfs_aio_pthread_async_dosmode_force_sync1",
126     "vfs_aio_pthread_async_dosmode_force_sync2"
127 ]
128 for s in shares:
129     plantestsuite("samba3.smbtorture_s3.%s(simpleserver).SMB2-BASIC" % s, "simpleserver", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), 'SMB2-BASIC', '//$SERVER_IP/' + s, '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
130     t = "smb2.compound_find"
131     plansmbtorture4testsuite(t, "simpleserver", "//%s/%s %s" % ('$SERVER_IP', s, ' -U$USERNAME%$PASSWORD'), description=s)
132
133 posix_tests = ["POSIX", "POSIX-APPEND", "POSIX-SYMLINK-ACL", "POSIX-SYMLINK-EA", "POSIX-OFD-LOCK",
134                "POSIX-STREAM-DELETE", "WINDOWS-BAD-SYMLINK"]
135
136 for t in posix_tests:
137     plantestsuite("samba3.smbtorture_s3.plain(nt4_dc).%s" % t, "nt4_dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/posix_share', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
138     plantestsuite("samba3.smbtorture_s3.crypt(nt4_dc).%s" % t, "nt4_dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/posix_share', '$USERNAME', '$PASSWORD', smbtorture3, "-e", "-l $LOCAL_PATH"])
139     plantestsuite("samba3.smbtorture_s3.plain(ad_dc_ntvfs).%s" % t, "ad_dc_ntvfs", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/posix_share', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
140
141 env = "nt4_dc:local"
142 t = "CLEANUP3"
143 plantestsuite("samba3.smbtorture_s3.plain(%s).%s" % (env, t), env, [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmp', '$USERNAME', '$PASSWORD', binpath('smbtorture3'), "", "-l $LOCAL_PATH"])
144
145 local_tests = [
146     "LOCAL-SUBSTITUTE",
147     "LOCAL-GENCACHE",
148     "LOCAL-BASE64",
149     "LOCAL-RBTREE",
150     "LOCAL-MEMCACHE",
151     "LOCAL-STREAM-NAME",
152     "LOCAL-string_to_sid",
153     "LOCAL-sid_to_string",
154     "LOCAL-binary_to_sid",
155     "LOCAL-DBTRANS",
156     "LOCAL-TEVENT-POLL",
157     "LOCAL-CONVERT-STRING",
158     "LOCAL-CONV-AUTH-INFO",
159     "LOCAL-IDMAP-TDB-COMMON",
160     "LOCAL-MESSAGING-READ1",
161     "LOCAL-MESSAGING-READ2",
162     "LOCAL-MESSAGING-READ3",
163     "LOCAL-MESSAGING-READ4",
164     "LOCAL-MESSAGING-FDPASS1",
165     "LOCAL-MESSAGING-FDPASS2",
166     "LOCAL-MESSAGING-FDPASS2a",
167     "LOCAL-MESSAGING-FDPASS2b",
168     "LOCAL-MESSAGING-SEND-ALL",
169     "LOCAL-PTHREADPOOL-TEVENT",
170     "LOCAL-CANONICALIZE-PATH",
171     "LOCAL-DBWRAP-WATCH1",
172     "LOCAL-DBWRAP-WATCH2",
173     "LOCAL-DBWRAP-DO-LOCKED1",
174     "LOCAL-G-LOCK1",
175     "LOCAL-G-LOCK2",
176     "LOCAL-G-LOCK3",
177     "LOCAL-G-LOCK4",
178     "LOCAL-G-LOCK5",
179     "LOCAL-G-LOCK6",
180     "LOCAL-NAMEMAP-CACHE1",
181     "LOCAL-hex_encode_buf",
182     "LOCAL-remove_duplicate_addrs2"]
183
184 for t in local_tests:
185     plantestsuite("samba3.smbtorture_s3.%s" % t, "none", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//foo/bar', '""', '""', smbtorture3, ""])
186
187 plantestsuite("samba.vfstest.stream_depot", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/stream-depot/run.sh"), binpath("vfstest"), "$PREFIX", configuration])
188 plantestsuite("samba.vfstest.xattr-tdb-1", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/xattr-tdb-1/run.sh"), binpath("vfstest"), "$PREFIX", configuration])
189 plantestsuite("samba.vfstest.acl", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/vfstest-acl/run.sh"), binpath("vfstest"), "$PREFIX", configuration])
190 plantestsuite("samba.vfstest.catia", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/vfstest-catia/run.sh"), binpath("vfstest"), "$PREFIX", configuration])
191
192 plantestsuite("samba3.blackbox.smbclient_basic.NT1", "nt4_dc_schannel", [os.path.join(samba3srcdir, "script/tests/test_smbclient_basic.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration, "-mNT1"])
193 plantestsuite("samba3.blackbox.smbclient_basic.SMB2_02", "nt4_dc_schannel", [os.path.join(samba3srcdir, "script/tests/test_smbclient_basic.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration, "-mSMB2_02"])
194 plantestsuite("samba3.blackbox.smbclient_basic.SMB2_10", "nt4_dc_schannel", [os.path.join(samba3srcdir, "script/tests/test_smbclient_basic.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration, "-mSMB2_10"])
195 plantestsuite("samba3.blackbox.smbclient_basic.SMB3_02", "nt4_dc_schannel", [os.path.join(samba3srcdir, "script/tests/test_smbclient_basic.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration, "-mSMB3_02"])
196 plantestsuite("samba3.blackbox.smbclient_basic.SMB3_11", "nt4_dc_schannel", [os.path.join(samba3srcdir, "script/tests/test_smbclient_basic.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration, "-mSMB3_11"])
197
198 plantestsuite("samba3.blackbox.smbclient_basic", "ad_member", [os.path.join(samba3srcdir, "script/tests/test_smbclient_basic.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration])
199 for options in ["", "--option=clientntlmv2auth=no", "--option=clientusespnego=no", "--option=clientusespnego=no --option=clientntlmv2auth=no", "--option=clientntlmv2auth=no --option=clientlanmanauth=yes --max-protocol=LANMAN2", "--option=clientntlmv2auth=no --option=clientlanmanauth=yes --option=clientmaxprotocol=NT1"]:
200     env = "nt4_dc"
201     plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) %s" % (env, options), env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration, options])
202
203 for env in ["nt4_dc", "nt4_member", "ad_member", "ad_dc", "ad_dc_ntvfs", "s4member", "fl2000dc"]:
204     plantestsuite("samba3.blackbox.smbclient_machine_auth.plain (%s:local)" % env, "%s:local" % env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_machine_auth.sh"), '$SERVER', smbclient3, configuration])
205     plantestsuite("samba3.blackbox.smbclient_ntlm.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_ntlm.sh"), '$SERVER', '$DC_USERNAME', '$DC_PASSWORD', "never", smbclient3, configuration])
206
207 for options in ["--option=clientntlmv2auth=no", "--option=clientusespnego=no --option=clientntlmv2auth=no", "--option=clientusespnego=no --option=clientntlmv2auth=no -mNT1", ""]:
208     for env in ["nt4_member", "ad_member"]:
209         plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) %s" % (env, options), env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration, options])
210         plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) %s member creds" % (env, options), env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$SERVER/$USERNAME', '$PASSWORD', smbclient3, configuration, options])
211
212 env="ad_dc"
213 plantestsuite("samba3.blackbox.smbspool", env, [os.path.join(samba3srcdir, "script/tests/test_smbspool.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', env])
214
215 for env in ["ad_member:local", "nt4_dc:local"]:
216     plantestsuite("samba3.blackbox.smbpasswd", env, [os.path.join(samba3srcdir, "script/tests/test_smbpasswd.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD'])
217
218 env="nt4_dc"
219 plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) ipv6" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IPV6', '$SERVER/$USERNAME', '$PASSWORD', smbclient3, configuration])
220
221 for env in ["nt4_member", "ad_member"]:
222     plantestsuite("samba3.blackbox.net_cred_change.(%s:local)" % env, "%s:local" % env, [os.path.join(samba3srcdir, "script/tests/test_net_cred_change.sh"), configuration])
223
224 env = "ad_member"
225 t = "--krb5auth=$DOMAIN/$DC_USERNAME%$DC_PASSWORD"
226 plantestsuite("samba3.wbinfo_simple.(%s:local).%s" % (env, t), "%s:local" % env, [os.path.join(srcdir(), "nsswitch/tests/test_wbinfo_simple.sh"), t])
227 plantestsuite("samba3.wbinfo_name_lookup", env,
228               [os.path.join(srcdir(),
229                              "nsswitch/tests/test_wbinfo_name_lookup.sh"),
230                 '$DOMAIN', '$REALM', '$DC_USERNAME'])
231
232 env = "ad_member:local"
233 plantestsuite("samba3.wbinfo_user_info", env,
234               [os.path.join(srcdir(),
235                              "nsswitch/tests/test_wbinfo_user_info.sh"),
236                 '$DOMAIN', '$REALM', '$DOMAIN', 'alice', 'alice', 'jane', 'jane.doe'])
237
238 env = "fl2008r2dc:local"
239 plantestsuite("samba3.wbinfo_user_info", env,
240               [os.path.join(srcdir(),
241                              "nsswitch/tests/test_wbinfo_user_info.sh"),
242                 '$TRUST_DOMAIN', '$TRUST_REALM', '$DOMAIN', 'alice', 'alice', 'jane', 'jane.doe'])
243
244 env = "ad_member"
245 t = "WBCLIENT-MULTI-PING"
246 plantestsuite("samba3.smbtorture_s3.%s" % t, env, [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//foo/bar', '""', '""', smbtorture3, ""])
247 plantestsuite("samba3.substitutions", env, [os.path.join(samba3srcdir, "script/tests/test_substitutions.sh"), "$SERVER", "alice", "Secret007", "$PREFIX"])
248
249 plantestsuite("samba3.ntlm_auth.krb5 with old ccache(ktest:local)", "ktest:local", [os.path.join(samba3srcdir, "script/tests/test_ntlm_auth_krb5.sh"), valgrindify(python), samba3srcdir, ntlm_auth3, '$PREFIX/ktest/krb5_ccache-2', '$SERVER', configuration])
250
251 plantestsuite("samba3.ntlm_auth.krb5(ktest:local)", "ktest:local", [os.path.join(samba3srcdir, "script/tests/test_ntlm_auth_krb5.sh"), valgrindify(python), samba3srcdir, ntlm_auth3, '$PREFIX/ktest/krb5_ccache-3', '$SERVER', configuration])
252
253
254 for env in ["maptoguest", "simpleserver"]:
255     plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) local creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', smbclient3, configuration + " --option=clientntlmv2auth=no --option=clientlanmanauth=yes"])
256
257 env = "maptoguest"
258 plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) bad username" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', 'notmy$USERNAME', '$PASSWORD', smbclient3, configuration + " --option=clientntlmv2auth=no --option=clientlanmanauth=yes"])
259 plantestsuite("samba3.blackbox.smbclient_ntlm.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_ntlm.sh"), '$SERVER', '$USERNAME', '$PASSWORD', "baduser", smbclient3, configuration])
260
261 # plain
262 for env in ["nt4_dc"]:
263     plantestsuite("samba3.blackbox.smbclient_s3.NT1.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "NT1"])
264     plantestsuite("samba3.blackbox.smbclient_s3.SMB3.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "SMB3"])
265
266 for env in ["nt4_member", "ad_member"]:
267     plantestsuite("samba3.blackbox.smbclient_s3.NT1.plain (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$SERVER', '$SERVER/$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "NT1"])
268     plantestsuite("samba3.blackbox.smbclient_s3.SMB3.plain (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$SERVER', '$SERVER/$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "SMB3"])
269
270 for env in ["nt4_dc"]:
271     plantestsuite("samba3.blackbox.smbclient_s3.NT1.sign (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "NT1", "--signing=required"])
272     plantestsuite("samba3.blackbox.smbclient_s3.SMB3.sign (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "SMB3", "--signing=required"])
273
274 for env in ["nt4_member", "ad_member"]:
275     plantestsuite("samba3.blackbox.smbclient_s3.NT1.sign (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$SERVER', '$SERVER/$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "NT1", "--signing=required"])
276     plantestsuite("samba3.blackbox.smbclient_s3.SMB3.sign (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$SERVER', '$SERVER/$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "SMB3", "--signing=required"])
277
278 for env in ["nt4_dc"]:
279     # encrypted
280     plantestsuite("samba3.blackbox.smbclient_s3.NT1.crypt (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "NT1", "-e"])
281     plantestsuite("samba3.blackbox.smbclient_s3.SMB3.crypt (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "SMB3", "-e"])
282
283 for env in ["fileserver"]:
284     plantestsuite("samba3.blackbox.preserve_case (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_preserve_case.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3])
285     plantestsuite("samba3.blackbox.dfree_command (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_dfree_command.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3])
286     plantestsuite("samba3.blackbox.dfree_quota (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_dfree_quota.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbclient3, smbcquotas, smbcacls])
287     plantestsuite("samba3.blackbox.smbcquotas (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbcquota.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbcquotas])
288     plantestsuite("samba3.blackbox.valid_users (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_valid_users.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3])
289     plantestsuite("samba3.blackbox.offline (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_offline.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/offline', smbclient3])
290     plantestsuite("samba3.blackbox.shadow_copy2 NT1 (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_shadow_copy.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/shadow', smbclient3, '-m', 'NT1'])
291     plantestsuite("samba3.blackbox.shadow_copy2 SMB3 (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_shadow_copy.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/shadow', smbclient3, '-m', 'SMB3'])
292     plantestsuite("samba3.blackbox.smbclient.forceuser_validusers (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_forceuser_validusers.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbclient3])
293     plantestsuite("samba3.blackbox.smbget (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbget.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', 'smbget_user', '$PASSWORD', '$LOCAL_PATH/smbget', smbget])
294     plantestsuite("samba3.blackbox.netshareenum (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_shareenum.sh"), '$SERVER', '$USERNAME', '$PASSWORD', rpcclient])
295     plantestsuite("samba3.blackbox.acl_xattr.NT1", env, [os.path.join(samba3srcdir, "script/tests/test_acl_xattr.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, smbcacls, '-mNT1'])
296     plantestsuite("samba3.blackbox.acl_xattr.SMB3", env, [os.path.join(samba3srcdir, "script/tests/test_acl_xattr.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, smbcacls, '-mSMB3'])
297     plantestsuite("samba3.blackbox.smb2.not_casesensitive (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smb2_not_casesensitive.sh"), '//$SERVER/tmp', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbclient3])
298     plantestsuite("samba3.blackbox.inherit_owner.default.NT1", env, [os.path.join(samba3srcdir, "script/tests/test_inherit_owner.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, smbcacls, net, 'tmp', '0', '0', '-m', 'NT1'])
299     plantestsuite("samba3.blackbox.inherit_owner.default.SMB3", env, [os.path.join(samba3srcdir, "script/tests/test_inherit_owner.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, smbcacls, net, 'tmp', '0', '0', '-m', 'SMB3'])
300     plantestsuite("samba3.blackbox.inherit_owner.full.NT1", env, [os.path.join(samba3srcdir, "script/tests/test_inherit_owner.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, smbcacls, net, 'inherit_owner', '1', '1', '-m', 'NT1'])
301     plantestsuite("samba3.blackbox.inherit_owner.full.SMB3", env, [os.path.join(samba3srcdir, "script/tests/test_inherit_owner.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, smbcacls, net, 'inherit_owner', '1', '1', '-m', 'SMB3'])
302     plantestsuite("samba3.blackbox.inherit_owner.unix.NT1", env, [os.path.join(samba3srcdir, "script/tests/test_inherit_owner.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, smbcacls, net, 'inherit_owner_u', '0', '1', '-m', 'NT1'])
303     plantestsuite("samba3.blackbox.inherit_owner.unix.SMB3", env, [os.path.join(samba3srcdir, "script/tests/test_inherit_owner.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, smbcacls, net, 'inherit_owner_u', '0', '1', '-m', 'SMB3'])
304     plantestsuite("samba3.blackbox.large_acl.NT1", env, [os.path.join(samba3srcdir, "script/tests/test_large_acl.sh"), '$SERVER', '$USERNAME', '$PASSWORD', smbclient3, smbcacls, '-m', 'NT1'])
305     plantestsuite("samba3.blackbox.large_acl.SMB3", env, [os.path.join(samba3srcdir, "script/tests/test_large_acl.sh"), '$SERVER', '$USERNAME', '$PASSWORD', smbclient3, smbcacls, '-m', 'SMB3'])
306     plantestsuite("samba3.blackbox.give_owner", env, [os.path.join(samba3srcdir, "script/tests/test_give_owner.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, smbcacls, net, 'tmp'])
307
308     #
309     # tar command tests
310     #
311
312     # Test smbclient/tarmode
313     plantestsuite("samba3.blackbox.smbclient_tarmode.NT1", env,
314                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.sh"),
315                    '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD',
316                    '$LOCAL_PATH/tarmode', '$PREFIX', smbclient3, configuration, "-mNT1"])
317     plantestsuite("samba3.blackbox.smbclient_tarmode.SMB3", env,
318                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.sh"),
319                    '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD',
320                    '$LOCAL_PATH/tarmode', '$PREFIX', smbclient3, configuration, "-mSMB3"])
321
322     # Test suite for new smbclient/tar with libarchive (GSoC 13)
323     plantestsuite("samba3.blackbox.smbclient_tar.NT1", env,
324                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.pl"),
325                    '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tmp',
326                    '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode',
327                    '-d', '$PREFIX', '-b', smbclient3,
328                    '--subunit', '--', configuration, '-mNT1'])
329     plantestsuite("samba3.blackbox.smbclient_tar.SMB3", env,
330                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.pl"),
331                    '-n', '$SERVER', '-i', '$SERVER_IP', '-s', 'tmp',
332                    '-u', '$USERNAME', '-p', '$PASSWORD', '-l', '$LOCAL_PATH/tarmode',
333                    '-d', '$PREFIX', '-b', smbclient3,
334                    '--subunit', '--', configuration, '-mSMB3'])
335
336 plantestsuite("samba3.blackbox.net_usershare", "fileserver:local", [os.path.join(samba3srcdir, "script/tests/test_net_usershare.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', smbclient3])
337
338 #TODO encrypted against member, with member creds, and with DC creds
339 plantestsuite("samba3.blackbox.net.misc", "nt4_dc:local",
340               [os.path.join(samba3srcdir, "script/tests/test_net_misc.sh"),
341                scriptdir, "$SMB_CONF_PATH", net, configuration])
342 plantestsuite("samba3.blackbox.net.local.registry", "nt4_dc:local",
343               [os.path.join(samba3srcdir, "script/tests/test_net_registry.sh"),
344                scriptdir, "$SMB_CONF_PATH", net, configuration])
345 plantestsuite("samba3.blackbox.net.registry.check", "nt4_dc:local",
346               [os.path.join(samba3srcdir, "script/tests/test_net_registry_check.sh"),
347                scriptdir, "$SMB_CONF_PATH", net, configuration, dbwrap_tool])
348 plantestsuite("samba3.blackbox.net.rpc.registry", "nt4_dc",
349               [os.path.join(samba3srcdir, "script/tests/test_net_registry.sh"),
350                scriptdir, "$SMB_CONF_PATH", net, configuration, 'rpc'])
351
352 plantestsuite("samba3.blackbox.net.local.registry.roundtrip", "nt4_dc:local",
353               [os.path.join(samba3srcdir, "script/tests/test_net_registry_roundtrip.sh"),
354                scriptdir, "$SMB_CONF_PATH", net, configuration])
355 plantestsuite("samba3.blackbox.net.rpc.registry.roundtrip", "nt4_dc",
356               [os.path.join(samba3srcdir, "script/tests/test_net_registry_roundtrip.sh"),
357                scriptdir, "$SMB_CONF_PATH", net, configuration, 'rpc'])
358
359 plantestsuite("samba3.blackbox.net.local.conf", "nt4_dc:local",
360               [os.path.join(samba3srcdir, "script/tests/test_net_conf.sh"),
361                scriptdir, "$SMB_CONF_PATH", net, configuration])
362 plantestsuite("samba3.blackbox.net.rpc.conf", "nt4_dc",
363               [os.path.join(samba3srcdir, "script/tests/test_net_conf.sh"),
364                scriptdir, "$SMB_CONF_PATH", net, configuration, 'rpc'])
365
366
367 plantestsuite("samba3.blackbox.testparm", "nt4_dc:local",
368               [os.path.join(samba3srcdir, "script/tests/test_testparm_s3.sh"),
369                "$LOCAL_PATH"])
370
371 plantestsuite(
372     "samba3.pthreadpool", "none",
373     [os.path.join(samba3srcdir, "script/tests/test_pthreadpool.sh")])
374
375 if with_pthreadpool and have_ldwrap:
376     plantestsuite("samba3.pthreadpool_cmocka", "none",
377                   [os.path.join(bindir(), "pthreadpooltest_cmocka")])
378
379 plantestsuite("samba3.async_req", "nt4_dc",
380               [os.path.join(samba3srcdir, "script/tests/test_async_req.sh")])
381
382 #smbtorture4 tests
383
384 base = ["base.attr", "base.charset", "base.chkpath", "base.createx_access", "base.defer_open", "base.delaywrite", "base.delete",
385         "base.deny1", "base.deny2", "base.deny3", "base.denydos", "base.dir1", "base.dir2",
386         "base.disconnect", "base.fdpass", "base.lock",
387         "base.mangle", "base.negnowait", "base.ntdeny1",
388         "base.ntdeny2", "base.open", "base.openattr", "base.properties", "base.rename", "base.rw1",
389         "base.secleak", "base.tcon", "base.tcondev", "base.trans2", "base.unlink", "base.vuid",
390         "base.xcopy", "base.samba3error"]
391
392 raw = ["raw.acls", "raw.chkpath", "raw.close", "raw.composite", "raw.context", "raw.eas",
393        "raw.ioctl", "raw.lock", "raw.mkdir", "raw.mux", "raw.notify", "raw.open", "raw.oplock",
394        "raw.qfileinfo", "raw.qfsinfo", "raw.read", "raw.rename", "raw.search", "raw.seek",
395        "raw.sfileinfo.base", "raw.sfileinfo.bug", "raw.streams", "raw.unlink", "raw.write",
396        "raw.samba3hide", "raw.samba3badpath", "raw.sfileinfo.rename", "raw.session",
397        "raw.samba3caseinsensitive", "raw.samba3posixtimedlock",
398        "raw.samba3rootdirfid", "raw.sfileinfo.end-of-file",
399        "raw.bench-oplock", "raw.bench-lock", "raw.bench-open", "raw.bench-tcon",
400        "raw.samba3checkfsp", "raw.samba3closeerr", "raw.samba3oplocklogoff", "raw.samba3badnameblob"]
401
402 smb2 = smbtorture4_testsuites("smb2.")
403
404 rpc = ["rpc.authcontext", "rpc.samba3.bind", "rpc.samba3.srvsvc", "rpc.samba3.sharesec",
405        "rpc.samba3.spoolss", "rpc.samba3.wkssvc", "rpc.samba3.winreg",
406        "rpc.samba3.getaliasmembership-0",
407        "rpc.samba3.netlogon", "rpc.samba3.sessionkey", "rpc.samba3.getusername",
408        "rpc.samba3.smb1-pipe-name", "rpc.samba3.smb2-pipe-name",
409        "rpc.samba3.smb-reauth1", "rpc.samba3.smb-reauth2",
410        "rpc.svcctl", "rpc.ntsvcs", "rpc.winreg", "rpc.eventlog",
411        "rpc.spoolss.printserver", "rpc.spoolss.win", "rpc.spoolss.notify", "rpc.spoolss.printer",
412        "rpc.spoolss.driver",
413        "rpc.lsa", "rpc.lsa-getuser", "rpc.lsa.lookupsids", "rpc.lsa.lookupnames",
414        "rpc.lsa.privileges", "rpc.lsa.secrets",
415        "rpc.samr", "rpc.samr.users", "rpc.samr.users.privileges", "rpc.samr.passwords",
416        "rpc.samr.passwords.pwdlastset", "rpc.samr.passwords.lockout", "rpc.samr.passwords.badpwdcount", "rpc.samr.large-dc", "rpc.samr.machine.auth",
417        "rpc.samr.priv", "rpc.samr.passwords.validate",
418        "rpc.netlogon.admin",
419        "rpc.schannel", "rpc.schannel2", "rpc.bench-schannel1", "rpc.schannel_anon_setpw", "rpc.join", "rpc.bind"]
420
421 local = ["local.nss"]
422
423 idmap = ["idmap.rfc2307", "idmap.alloc", "idmap.rid", "idmap.ad"]
424
425 rap = ["rap.basic", "rap.rpc", "rap.printing", "rap.sam"]
426
427 unix = ["unix.info2", "unix.whoami"]
428
429 nbt = ["nbt.dgram"]
430
431 libsmbclient = ["libsmbclient"]
432
433 vfs = ["vfs.fruit", "vfs.acl_xattr", "vfs.fruit_netatalk", "vfs.fruit_file_id", "vfs.fruit_timemachine"]
434
435 tests= base + raw + smb2 + rpc + unix + local + rap + nbt + libsmbclient + idmap + vfs
436
437 for t in tests:
438     if t == "base.delaywrite" or t == "base.deny1" or t == "base.deny2":
439         plansmbtorture4testsuite(t, "fileserver", '//$SERVER/tmp -U$USERNAME%$PASSWORD --maximum-runtime=900')
440     elif t == "base.createx_access":
441         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD -k yes --maximum-runtime=900')
442     elif t == "rap.sam":
443         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=doscharset=ISO-8859-1')
444         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=doscharset=ISO-8859-1')
445     elif t == "winbind.pac":
446         plansmbtorture4testsuite(t, "ad_member:local", '//$SERVER/tmp --realm=$REALM --machine-pass --option=torture:addc=$DC_SERVER', description="machine account")
447     elif t == "unix.whoami":
448         plansmbtorture4testsuite(t, "nt4_member:local", '//$SERVER/tmp --machine-pass', description="machine account")
449         plansmbtorture4testsuite(t, "ad_member:local", '//$SERVER/tmp --machine-pass --option=torture:addc=$DC_SERVER', description="machine account")
450         for env in ["nt4_dc", "nt4_member"]:
451             plansmbtorture4testsuite(t, env, '//$SERVER/tmp -U$DC_USERNAME%$DC_PASSWORD')
452             plansmbtorture4testsuite(t, env, '//$SERVER/tmpguest -U%', description='anonymous connection')
453         for env in ["ad_dc", "ad_member"]:
454             plansmbtorture4testsuite(t, env, '//$SERVER/tmp -U$DC_USERNAME@$REALM%$DC_PASSWORD --option=torture:addc=$DC_SERVER')
455             plansmbtorture4testsuite(t, env, '//$SERVER/tmp -k yes -U$DC_USERNAME@$REALM%$DC_PASSWORD --option=torture:addc=$DC_SERVER', description='kerberos connection')
456             plansmbtorture4testsuite(t, env, '//$SERVER/tmpguest -U% --option=torture:addc=$DC_SERVER', description='anonymous connection')
457             plansmbtorture4testsuite(t, env, '//$SERVER/tmp -k no -U$DC_USERNAME@$REALM%$DC_PASSWORD', description='ntlm user@realm')
458     elif t == "raw.samba3posixtimedlock":
459         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmpguest -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share')
460         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER_IP/tmpguest -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/ad_dc/share')
461     elif t == "raw.chkpath":
462         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmpcase -U$USERNAME%$PASSWORD')
463         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER_IP/tmpcase -U$USERNAME%$PASSWORD')
464     elif t == "raw.samba3hide" or t == "raw.samba3checkfsp" or t ==  "raw.samba3closeerr":
465         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
466         plansmbtorture4testsuite(t, "simpleserver", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
467         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
468     elif t == "raw.session" or t == "smb2.session":
469         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD', 'plain')
470         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmpenc -U$USERNAME%$PASSWORD', 'enc')
471         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -k no -U$USERNAME%$PASSWORD', 'ntlm')
472         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -k yes -U$USERNAME%$PASSWORD', 'krb5')
473     elif t == "rpc.lsa":
474         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD', 'over ncacn_np ')
475         plansmbtorture4testsuite(t, "nt4_dc", 'ncacn_ip_tcp:$SERVER_IP -U$USERNAME%$PASSWORD', 'over ncacn_ip_tcp ')
476         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD', 'over ncacn_np ')
477         plansmbtorture4testsuite(t, "ad_dc", 'ncacn_ip_tcp:$SERVER_IP -U$USERNAME%$PASSWORD', 'over ncacn_ip_tcp ')
478     elif t == "rpc.samr.passwords.validate":
479         plansmbtorture4testsuite(t, "nt4_dc", 'ncacn_ip_tcp:$SERVER_IP[seal] -U$USERNAME%$PASSWORD', 'over ncacn_ip_tcp ')
480         plansmbtorture4testsuite(t, "ad_dc", 'ncacn_ip_tcp:$SERVER_IP[seal] -U$USERNAME%$PASSWORD', 'over ncacn_ip_tcp ')
481     elif t == "smb2.durable-open" or t == "smb2.durable-v2-open" or t == "smb2.replay":
482         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/durable -U$USERNAME%$PASSWORD')
483         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER_IP/durable -U$USERNAME%$PASSWORD')
484     elif t == "base.rw1":
485         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
486         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/valid-users-tmp -U$USERNAME%$PASSWORD')
487         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/write-list-tmp -U$USERNAME%$PASSWORD')
488         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
489     elif t == "idmap.rfc2307":
490         plantestsuite(t, "ad_member_rfc2307",
491                       [os.path.join(samba3srcdir,
492                                     "../nsswitch/tests/test_idmap_rfc2307.sh"),
493                        '$DOMAIN',
494                        'Administrator', '2000000',
495                        'Guest', '2000001',
496                        '"Domain Users"', '2000002',
497                        'DnsAdmins', '2000003',
498                        '2000005', '35',
499                        'ou=idmap,dc=samba,dc=example,dc=com',
500                        '$DC_SERVER', '$DC_USERNAME', '$DC_PASSWORD'])
501     elif t == "idmap.alloc":
502         plantestsuite(t, "ad_member_rfc2307", [os.path.join(samba3srcdir, "../nsswitch/tests/test_idmap_nss.sh"), '$DOMAIN'])
503     elif t == "idmap.rid":
504         plantestsuite(t, "ad_member_idmap_rid", [os.path.join(samba3srcdir, "../nsswitch/tests/test_idmap_rid.sh"), '$DOMAIN', '2000000'])
505     elif t == "idmap.ad":
506         plantestsuite(t, "ad_member_idmap_ad", [os.path.join(samba3srcdir, "../nsswitch/tests/test_idmap_ad.sh"), '$DOMAIN', '$DC_SERVER', '$DC_PASSWORD'])
507     elif t == "raw.acls":
508         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
509         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/nfs4acl_simple_40 -U$USERNAME%$PASSWORD', description='nfs4acl_xattr-simple-40')
510         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/nfs4acl_special_40 -U$USERNAME%$PASSWORD', description='nfs4acl_xattr-special-40')
511         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/nfs4acl_simple_41 -U$USERNAME%$PASSWORD', description='nfs4acl_xattr-simple-41')
512         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/nfs4acl_xdr_40 -U$USERNAME%$PASSWORD', description='nfs4acl_xattr-xdr-40')
513         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/nfs4acl_xdr_41 -U$USERNAME%$PASSWORD', description='nfs4acl_xattr-xdr-41')
514         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER_IP/tmpcase -U$USERNAME%$PASSWORD')
515     elif t == "smb2.ioctl":
516         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/fs_specific -U$USERNAME%$PASSWORD', 'fs_specific')
517         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
518         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
519     elif t == "smb2.lock":
520         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/aio -U$USERNAME%$PASSWORD', 'aio')
521         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
522     elif t == "raw.lock" or t == "base.lock":
523         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
524     elif t == "raw.read":
525         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
526         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/aio -U$USERNAME%$PASSWORD', 'aio')
527         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
528     elif t == "raw.search":
529         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
530 # test the dirsort module.
531         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmpsort -U$USERNAME%$PASSWORD')
532         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
533     elif t == "vfs.fruit":
534         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share --option=torture:share2=vfs_wo_fruit', 'metadata_netatalk')
535         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit_metadata_stream -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share --option=torture:share2=vfs_wo_fruit', 'metadata_stream')
536         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit_stream_depot -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share --option=torture:share2=vfs_wo_fruit_stream_depot', 'streams_depot')
537     elif t == "vfs.fruit_netatalk":
538         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit_xattr -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share')
539     elif t == "vfs.fruit_timemachine":
540         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit_timemachine -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share')
541     elif t == "vfs.fruit_file_id":
542         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit -U$USERNAME%$PASSWORD')
543     elif t == "rpc.schannel_anon_setpw":
544         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$%', description="anonymous password set")
545         plansmbtorture4testsuite(t, "nt4_dc_schannel", '//$SERVER_IP/tmp -U$%', description="anonymous password set (schannel enforced server-side)")
546         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$%', description="anonymous password set")
547     elif t == "local.nss":
548         for env in ["nt4_dc:local", "ad_member:local", "nt4_member:local", "ad_dc:local"]:
549             plansmbtorture4testsuite(t, env, '//$SERVER/tmp -U$USERNAME%$PASSWORD')
550     elif t == "smb2.change_notify_disabled":
551         plansmbtorture4testsuite(t, "simpleserver", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
552     elif t == "smb2.notify" or t == "raw.notify" or t == "smb2.oplock" or t == "raw.oplock":
553         # These tests are a little slower so don't duplicate them with ad_dc
554         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --signing=required')
555     elif t == "smb2.dosmode":
556         plansmbtorture4testsuite(t, "simpleserver", '//$SERVER/dosmode -U$USERNAME%$PASSWORD')
557     elif t == "smb2.kernel-oplocks":
558         if have_linux_kernel_oplocks:
559             plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER/kernel_oplocks -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share')
560     elif t == "smb2.notify-inotify":
561         if have_inotify:
562             plansmbtorture4testsuite(t, "fileserver", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
563     elif t == "vfs.acl_xattr":
564         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
565     elif t == "smb2.compound_find":
566         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER/compound_find -U$USERNAME%$PASSWORD')
567         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
568         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
569     elif t == "rpc.samr.users.privileges":
570         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=torture:nt4_dc=true')
571         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
572     elif t == "smb2.compound":
573         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
574         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/aio -U$USERNAME%$PASSWORD', 'aio')
575         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
576     elif t == "rpc.samba3.netlogon" or t == "rpc.samba3.sessionkey":
577         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=torture:wksname=samba3rpctest')
578         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD --option=torture:wksname=samba3rpctest')
579     elif t == "libsmbclient":
580         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%%$PASSWORD '
581                                     '--option=torture:smburl=smb://$USERNAME:$PASSWORD@$SERVER/tmp '
582                                     '--option=torture:replace_smbconf=%s' % os.path.join(srcdir(), "testdata/samba3/smb_new.conf"))
583         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%%$PASSWORD '
584                                     '--option=torture:smburl=smb://$USERNAME:$PASSWORD@$SERVER/tmp '
585                                     '--option=torture:replace_smbconf=%s' % os.path.join(srcdir(), "testdata/samba3/smb_new.conf"))
586     elif t == "smb2.streams":
587         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
588         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
589         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/streams_xattr -U$USERNAME%$PASSWORD', 'streams_xattr')
590     else:
591         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
592         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
593
594
595 test = 'rpc.lsa.lookupsids'
596 auth_options = ["", "ntlm", "spnego", "spnego,ntlm", "spnego,smb1", "spnego,smb2"]
597 signseal_options = ["", ",connect", ",packet", ",sign", ",seal"]
598 endianness_options = ["", ",bigendian"]
599 for s in signseal_options:
600     for e in endianness_options:
601         for a in auth_options:
602             binding_string = "ncacn_np:$SERVER[%s%s%s]" % (a, s, e)
603             options = binding_string + " -U$USERNAME%$PASSWORD"
604             plansmbtorture4testsuite(test, "nt4_dc", options, 'over ncacn_np with [%s%s%s] ' % (a, s, e))
605             plantestsuite("samba3.blackbox.rpcclient over ncacn_np with [%s%s%s] " % (a, s, e), "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/test_rpcclient.sh"),
606                                                                                                                  "none", options, configuration])
607
608     # We should try more combinations in future, but this is all
609     # the pre-calculated credentials cache supports at the moment
610     #
611     # As the ktest env requires SMB3_00 we need to use "smb2" until
612     # dcerpc client code in smbtorture support autonegotiation
613     # of any smb dialect.
614     e = ""
615     a = "smb2"
616     binding_string = "ncacn_np:$SERVER[%s%s%s]" % (a, s, e)
617     options = binding_string + " -k yes --krb5-ccache=$PREFIX/ktest/krb5_ccache-2"
618     plansmbtorture4testsuite(test, "ktest", options, 'krb5 with old ccache ncacn_np with [%s%s%s] ' % (a, s, e))
619
620     options = binding_string + " -k yes --krb5-ccache=$PREFIX/ktest/krb5_ccache-3"
621     plansmbtorture4testsuite(test, "ktest", options, 'krb5 ncacn_np with [%s%s%s] ' % (a, s, e))
622
623     auth_options2 = ["krb5", "spnego,krb5"]
624     for a in auth_options2:
625         binding_string = "ncacn_np:$SERVER[%s%s%s]" % (a, s, e)
626
627         plantestsuite("samba3.blackbox.rpcclient krb5 ncacn_np with [%s%s%s] " % (a, s, e), "ktest:local", [os.path.join(samba3srcdir, "script/tests/test_rpcclient.sh"),
628                                                                                                             "$PREFIX/ktest/krb5_ccache-3", binding_string, "-k", configuration])
629
630 plantestsuite("samba3.blackbox.rpcclient_samlogon", "ad_member:local", [os.path.join(samba3srcdir, "script/tests/test_rpcclient_samlogon.sh"),
631                                                                         "$DC_USERNAME", "$DC_PASSWORD", "ncacn_np:$DC_SERVER", configuration])
632 plantestsuite("samba3.blackbox.sharesec", "simpleserver:local",
633               [os.path.join(samba3srcdir, "script/tests/test_sharesec.sh"),
634                configuration, os.path.join(bindir(), "sharesec"), "tmp"])
635
636 plantestsuite("samba3.blackbox.net_tdb", "simpleserver:local",
637               [os.path.join(samba3srcdir, "script/tests/test_net_tdb.sh"),
638                 smbclient3, '$SERVER', 'tmp', '$USERNAME', '$PASSWORD',
639                 configuration, '$LOCAL_PATH', '$LOCK_DIR'])
640
641 plantestsuite("samba3.blackbox.smbd_error", "simpleserver:local",
642               [os.path.join(samba3srcdir, "script/tests/test_smbd_error.sh")])
643
644 plantestsuite("samba3.blackbox.net_cache_samlogon", "ad_member:local",
645               [os.path.join(samba3srcdir, "script/tests/test_net_cache_samlogon.sh"),
646                 '$SERVER', 'tmp', '$DC_USERNAME', '$DC_PASSWORD'])
647
648 plantestsuite("samba3.blackbox.net_dom_join_fail_dc", "nt4_dc",
649               [os.path.join(samba3srcdir, "script/tests/test_net_dom_join_fail_dc.sh"),
650                "$USERNAME", "$PASSWORD", "$SERVER", "$PREFIX/net_dom_join_fail_dc",
651                configuration])
652 plantestsuite("samba3.blackbox.net_rpc_join", "nt4_dc",
653               [os.path.join(samba3srcdir, "script/tests/test_net_rpc_join.sh"),
654                "$USERNAME", "$PASSWORD", "$SERVER", "$PREFIX/net_rpc_join",
655                configuration])
656 plantestsuite("samba3.blackbox.net_rpc_oldjoin", "nt4_dc:local",
657               [os.path.join(samba3srcdir, "script/tests/test_net_rpc_oldjoin.sh"),
658                "$SERVER", "$PREFIX/net_rpc_oldjoin",
659                "$SMB_CONF_PATH"])
660
661 plantestsuite("samba3.blackbox.rpcclient_srvsvc", "simpleserver",
662               [os.path.join(samba3srcdir, "script/tests/test_rpcclientsrvsvc.sh"),
663                "$USERNAME", "$PASSWORD", "$SERVER",
664                os.path.join(bindir(), "rpcclient"), "tmp"])
665
666 plantestsuite("samba3.blackbox.rpcclient.pw-nt-hash", "simpleserver",
667               [os.path.join(samba3srcdir, "script/tests/test_rpcclient_pw_nt_hash.sh"),
668                "$USERNAME", "$PASSWORD", "$SERVER",
669                os.path.join(bindir(), "rpcclient")])
670
671 plantestsuite("samba3.blackbox.smbclient.encryption_off", "simpleserver",
672               [os.path.join(samba3srcdir, "script/tests/test_smbclient_encryption_off.sh"),
673                "$USERNAME", "$PASSWORD", "$SERVER",
674                smbclient3])
675
676 plantestsuite("samba3.blackbox.rpcclient_netsessenum", "ad_member",
677               [os.path.join(samba3srcdir,
678                             "script/tests/test_rpcclient_netsessenum.sh"),
679                "$DOMAIN", "$DC_USERNAME", "$DC_PASSWORD", "$SERVER",
680                os.path.join(bindir(), "rpcclient"), smbtorture3, "tmp"])
681
682 # The ktest environment uses:
683 # server min protocol = SMB3_00
684 # client max protocol = SMB3
685 options_list = ["", "-e"]
686 for options in options_list:
687     plantestsuite("samba3.blackbox.smbclient_krb5 old ccache %s" % options, "ktest:local",
688                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_krb5.sh"),
689                    "$PREFIX/ktest/krb5_ccache-2",
690                    smbclient3, "$SERVER", options, configuration])
691
692     plantestsuite("samba3.blackbox.smbclient_krb5 new ccache %s" % options, "ktest:local",
693                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_krb5.sh"),
694                    "$PREFIX/ktest/krb5_ccache-3",
695                    smbclient3, "$SERVER", options, configuration])
696
697     plantestsuite("samba3.blackbox.smbclient_large_file %s krb5" % options, "ktest:local",
698                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_large_file.sh"),
699                    "$PREFIX/ktest/krb5_ccache-3",
700                    smbclient3, "$SERVER", "$PREFIX", options, "-k " + configuration])
701
702 options_list = ["-mNT1", "-mNT1 -e", "-mSMB3", "-mSMB3 -e"]
703 for options in options_list:
704     plantestsuite("samba3.blackbox.smbclient_large_file %s NTLM" % options, "nt4_dc:local",
705                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_large_file.sh"),
706                    "none",
707                    smbclient3, "$SERVER", "$PREFIX", options, "-U$USERNAME%$PASSWORD " + configuration])
708
709 for alias in ["foo", "bar"]:
710     plantestsuite("samba3.blackbox.smbclient_netbios_aliases [%s]" % alias, "ad_member:local",
711                   [os.path.join(samba3srcdir, "script/tests/test_smbclient_netbios_aliases.sh"),
712                    smbclient3, alias, "$DC_USERNAME", "$DC_PASSWORD", "$PREFIX", options, configuration])
713
714 for e in endianness_options:
715     for a in auth_options:
716         for s in signseal_options:
717             binding_string = "ncacn_ip_tcp:$SERVER_IP[%s%s%s]" % (a, s, e)
718             options = binding_string + " -U$USERNAME%$PASSWORD"
719             plansmbtorture4testsuite(test, "nt4_dc", options, 'over ncacn_ip_tcp with [%s%s%s] ' % (a, s, e))
720
721 plansmbtorture4testsuite('rpc.epmapper', 'nt4_dc:local', 'ncalrpc: -U$USERNAME%$PASSWORD', 'over ncalrpc')
722 plansmbtorture4testsuite('rpc.fsrvp', 'nt4_dc:local', 'ncacn_np:$SERVER_IP[/pipe/FssagentRpc] -U$USERNAME%$PASSWORD', 'over ncacn_np')