tests/krb5: Fix PA-PAC-OPTIONS checking
[Samba.git] / selftest / tests.py
blob5b1ebcf4270465dc20c16bdb08b1bc5b71355254
1 #!/usr/bin/python
2 # This script generates a list of testsuites that should be run as part of
3 # the Samba test suite.
5 # The output of this script is parsed by selftest.pl, which then decides
6 # which of the tests to actually run. It will, for example, skip all tests
7 # listed in selftest/skip or only run a subset during "make quicktest".
9 # The idea is that this script outputs all of the tests of Samba, 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 and makes
13 # it possible to run the testsuite against other servers, such as
14 # Windows that have a different set of features.
16 # The syntax for a testsuite is "-- TEST --" on a single line, followed
17 # by the name of the test, the environment it needs and the command to run, all
18 # three separated by newlines. All other lines in the output are considered
19 # comments.
21 import os
22 from selftesthelpers import bindir, srcdir, python
23 from selftesthelpers import planpythontestsuite, samba4srcdir
24 from selftesthelpers import plantestsuite, bbdir
25 from selftesthelpers import configuration, valgrindify
26 from selftesthelpers import skiptestsuite
28 try:
29 config_h = os.environ["CONFIG_H"]
30 except KeyError:
31 samba4bindir = bindir()
32 config_h = os.path.join(samba4bindir, "default/include/config.h")
34 # check available features
35 config_hash = dict()
36 f = open(config_h, 'r')
37 try:
38 lines = f.readlines()
39 config_hash = dict((x[0], ' '.join(x[1:]))
40 for x in map(lambda line: line.strip().split(' ')[1:],
41 list(filter(lambda line: (line[0:7] == '#define') and (len(line.split(' ')) > 2), lines))))
42 finally:
43 f.close()
45 have_man_pages_support = ("XSLTPROC_MANPAGES" in config_hash)
46 with_pam = ("WITH_PAM" in config_hash)
47 with_elasticsearch_backend = ("HAVE_SPOTLIGHT_BACKEND_ES" in config_hash)
48 pam_wrapper_so_path = config_hash["LIBPAM_WRAPPER_SO_PATH"]
49 pam_set_items_so_path = config_hash["PAM_SET_ITEMS_SO_PATH"]
51 planpythontestsuite("none", "samba.tests.source")
52 if have_man_pages_support:
53 planpythontestsuite("none", "samba.tests.docs")
55 try:
56 import testscenarios
57 except ImportError:
58 skiptestsuite("subunit", "testscenarios not available")
59 else:
60 planpythontestsuite("none", "subunit.tests.test_suite")
61 planpythontestsuite("none", "samba.tests.blackbox.ndrdump")
62 planpythontestsuite("none", "samba.tests.blackbox.check_output")
63 planpythontestsuite("none", "api", name="ldb.python", extra_path=['lib/ldb/tests/python'])
64 planpythontestsuite("none", "samba.tests.credentials")
65 planpythontestsuite("none", "samba.tests.registry")
66 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.auth")
67 planpythontestsuite("none", "samba.tests.get_opt")
68 planpythontestsuite("none", "samba.tests.security")
69 planpythontestsuite("none", "samba.tests.dcerpc.misc")
70 planpythontestsuite("none", "samba.tests.dcerpc.integer")
71 planpythontestsuite("none", "samba.tests.param")
72 planpythontestsuite("none", "samba.tests.upgrade")
73 planpythontestsuite("none", "samba.tests.core")
74 planpythontestsuite("none", "samba.tests.common")
75 planpythontestsuite("none", "samba.tests.provision")
76 planpythontestsuite("none", "samba.tests.password_quality")
77 planpythontestsuite("none", "samba.tests.strings")
78 planpythontestsuite("none", "samba.tests.netcmd")
79 planpythontestsuite("none", "samba.tests.dcerpc.rpc_talloc")
80 planpythontestsuite("none", "samba.tests.dcerpc.array")
81 planpythontestsuite("none", "samba.tests.dcerpc.string_tests")
82 planpythontestsuite("none", "samba.tests.hostconfig")
83 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.messaging")
84 planpythontestsuite("none", "samba.tests.s3param")
85 planpythontestsuite("none", "samba.tests.s3passdb")
86 planpythontestsuite("none", "samba.tests.s3registry")
87 planpythontestsuite("none", "samba.tests.s3windb")
88 planpythontestsuite("none", "samba.tests.s3idmapdb")
89 planpythontestsuite("none", "samba.tests.samba3sam")
90 planpythontestsuite(
91 "none", "wafsamba.tests.test_suite",
92 extra_path=[os.path.join(samba4srcdir, "..", "buildtools"),
93 os.path.join(samba4srcdir, "..", "third_party", "waf")])
94 planpythontestsuite("fileserver", "samba.tests.smbd_fuzztest")
97 def cmdline(script, *args):
98 """
99 Prefix PYTHON env var and append --configurefile option to abs script path.
101 script.sh arg1 arg2
103 PYTHON=python /path/to/bbdir/script.sh arg1 arg2 \
104 --configurefile $SMB_CONF_FILE
106 return [
107 "PYTHON=%s" % python,
108 os.path.join(bbdir, script),
109 ] + list(args) + [configuration]
112 plantestsuite(
113 "samba4.blackbox.demote-saveddb", "none",
114 cmdline('demote-saveddb.sh', '$PREFIX_ABS/demote'))
116 plantestsuite(
117 "samba4.blackbox.dbcheck.alpha13", "none",
118 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
119 'alpha13'))
121 # same test as above but skip member link checks
122 plantestsuite(
123 "samba4.blackbox.dbcheck.alpha13.quick", "none",
124 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
125 'alpha13', '--quick-membership-checks'))
127 plantestsuite(
128 "samba4.blackbox.dbcheck.release-4-0-0", "none",
129 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
130 'release-4-0-0'))
132 # same test as above but skip member link checks
133 plantestsuite(
134 "samba4.blackbox.dbcheck.release-4-0-0.quick", "none",
135 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
136 'release-4-0-0', '--quick-membership-checks'))
138 plantestsuite(
139 "samba4.blackbox.dbcheck.release-4-1-0rc3", "none",
140 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
141 'release-4-1-0rc3'))
143 # same test as above but skip member link checks
144 plantestsuite(
145 "samba4.blackbox.dbcheck.release-4-1-0rc3.quick", "none",
146 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
147 'release-4-1-0rc3', '--quick-membership-checks'))
149 plantestsuite(
150 "samba4.blackbox.dbcheck.release-4-1-6-partial-object", "none",
151 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
152 'release-4-1-6-partial-object'))
154 # same test as above but skip member link checks
155 plantestsuite(
156 "samba4.blackbox.dbcheck.release-4-1-6-partial-object.quick", "none",
157 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
158 'release-4-1-6-partial-object', '--quick-membership-checks'))
160 plantestsuite(
161 "samba4.blackbox.dbcheck.release-4-5-0-pre1", "none",
162 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
163 'release-4-5-0-pre1'))
165 # same test as above but skip member link checks
166 plantestsuite(
167 "samba4.blackbox.dbcheck.release-4-5-0-pre1.quick", "none",
168 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
169 'release-4-5-0-pre1', '--quick-membership-checks'))
171 plantestsuite(
172 "samba4.blackbox.upgradeprovision.alpha13", "none",
173 cmdline('upgradeprovision-oldrelease.sh', '$PREFIX_ABS/provision',
174 'alpha13'))
176 plantestsuite(
177 "samba4.blackbox.upgradeprovision.release-4-0-0", "none",
178 cmdline('upgradeprovision-oldrelease.sh', '$PREFIX_ABS/provision',
179 'release-4-0-0'))
181 plantestsuite(
182 "samba4.blackbox.tombstones-expunge.release-4-5-0-pre1", "none",
183 cmdline('tombstones-expunge.sh', '$PREFIX_ABS/provision',
184 'release-4-5-0-pre1'))
186 plantestsuite(
187 "samba4.blackbox.dbcheck-links.release-4-5-0-pre1", "none",
188 cmdline('dbcheck-links.sh', '$PREFIX_ABS/provision',
189 'release-4-5-0-pre1'))
191 plantestsuite(
192 "samba4.blackbox.runtime-links.release-4-5-0-pre1", "none",
193 cmdline('runtime-links.sh', '$PREFIX_ABS/provision',
194 'release-4-5-0-pre1'))
196 plantestsuite(
197 "samba4.blackbox.schemaupgrade", "none",
198 cmdline('schemaupgrade.sh', '$PREFIX_ABS/provision'))
200 plantestsuite(
201 "samba4.blackbox.functionalprep", "none",
202 cmdline('functionalprep.sh', '$PREFIX_ABS/provision'))
204 planpythontestsuite("none", "samba.tests.upgradeprovision")
205 planpythontestsuite("none", "samba.tests.xattr")
206 planpythontestsuite("none", "samba.tests.ntacls")
207 planpythontestsuite("none", "samba.tests.policy")
208 planpythontestsuite("none", "samba.tests.kcc.graph")
209 planpythontestsuite("none", "samba.tests.kcc.graph_utils")
210 planpythontestsuite("none", "samba.tests.kcc.ldif_import_export")
211 planpythontestsuite("none", "samba.tests.graph")
212 plantestsuite("wafsamba.duplicate_symbols", "none", [os.path.join(srcdir(), "buildtools/wafsamba/test_duplicate_symbol.sh")])
213 planpythontestsuite("none", "samba.tests.glue")
214 planpythontestsuite("none", "samba.tests.tdb_util")
215 planpythontestsuite("none", "samba.tests.samdb")
216 planpythontestsuite("none", "samba.tests.samdb_api")
218 if with_pam:
219 env = "ad_member"
220 options = [
222 "description": "krb5",
223 "pam_options": "krb5_auth krb5_ccache_type=FILE",
226 "description": "default",
227 "pam_options": "",
230 for o in options:
231 description = o["description"]
232 pam_options = "'%s'" % o["pam_options"]
234 plantestsuite("samba.tests.pam_winbind(local+%s)" % description, env,
235 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
236 valgrindify(python), pam_wrapper_so_path,
237 "$SERVER", "$USERNAME", "$PASSWORD",
238 pam_options])
239 plantestsuite("samba.tests.pam_winbind(domain1+%s)" % description, env,
240 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
241 valgrindify(python), pam_wrapper_so_path,
242 "$DOMAIN", "$DC_USERNAME", "$DC_PASSWORD",
243 pam_options])
244 plantestsuite("samba.tests.pam_winbind(domain2+%s)" % description, env,
245 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
246 valgrindify(python), pam_wrapper_so_path,
247 "$REALM", "$DC_USERNAME", "$DC_PASSWORD",
248 pam_options])
249 plantestsuite("samba.tests.pam_winbind(domain3+%s)" % description, env,
250 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
251 valgrindify(python), pam_wrapper_so_path,
252 "''", "${DC_USERNAME}@${DOMAIN}", "$DC_PASSWORD",
253 pam_options])
254 plantestsuite("samba.tests.pam_winbind(domain4+%s)" % description, env,
255 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
256 valgrindify(python), pam_wrapper_so_path,
257 "''", "${DC_USERNAME}@${REALM}", "$DC_PASSWORD",
258 pam_options])
259 plantestsuite("samba.tests.pam_winbind(domain5+%s)" % description, env,
260 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
261 valgrindify(python), pam_wrapper_so_path,
262 "$REALM", "${DC_USERNAME}@${DOMAIN}", "$DC_PASSWORD",
263 pam_options])
264 plantestsuite("samba.tests.pam_winbind(domain6+%s)" % description, env,
265 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
266 valgrindify(python), pam_wrapper_so_path,
267 "$DOMAIN", "${DC_USERNAME}@${REALM}", "$DC_PASSWORD",
268 pam_options])
269 plantestsuite("samba.tests.pam_winbind(trust_f_both1+%s)" % description, env,
270 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
271 valgrindify(python), pam_wrapper_so_path,
272 "$TRUST_F_BOTH_DOMAIN",
273 "$TRUST_F_BOTH_USERNAME",
274 "$TRUST_F_BOTH_PASSWORD",
275 pam_options])
276 plantestsuite("samba.tests.pam_winbind(trust_f_both2+%s)" % description, env,
277 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
278 valgrindify(python), pam_wrapper_so_path,
279 "$TRUST_F_BOTH_REALM",
280 "$TRUST_F_BOTH_USERNAME",
281 "$TRUST_F_BOTH_PASSWORD",
282 pam_options])
283 plantestsuite("samba.tests.pam_winbind(trust_f_both3+%s)" % description, env,
284 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
285 valgrindify(python), pam_wrapper_so_path,
286 "''",
287 "${TRUST_F_BOTH_USERNAME}@${TRUST_F_BOTH_DOMAIN}",
288 "$TRUST_F_BOTH_PASSWORD",
289 pam_options])
290 plantestsuite("samba.tests.pam_winbind(trust_f_both4+%s)" % description, env,
291 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
292 valgrindify(python), pam_wrapper_so_path,
293 "''",
294 "${TRUST_F_BOTH_USERNAME}@${TRUST_F_BOTH_REALM}",
295 "$TRUST_F_BOTH_PASSWORD",
296 pam_options])
297 plantestsuite("samba.tests.pam_winbind(trust_f_both5+%s)" % description, env,
298 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
299 valgrindify(python), pam_wrapper_so_path,
300 "${TRUST_F_BOTH_REALM}",
301 "${TRUST_F_BOTH_USERNAME}@${TRUST_F_BOTH_DOMAIN}",
302 "$TRUST_F_BOTH_PASSWORD",
303 pam_options])
304 plantestsuite("samba.tests.pam_winbind(trust_f_both6+%s)" % description, env,
305 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
306 valgrindify(python), pam_wrapper_so_path,
307 "${TRUST_F_BOTH_DOMAIN}",
308 "${TRUST_F_BOTH_USERNAME}@${TRUST_F_BOTH_REALM}",
309 "$TRUST_F_BOTH_PASSWORD",
310 pam_options])
311 plantestsuite("samba.tests.pam_winbind(trust_e_both1+%s)" % description, env,
312 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
313 valgrindify(python), pam_wrapper_so_path,
314 "$TRUST_E_BOTH_DOMAIN",
315 "$TRUST_E_BOTH_USERNAME",
316 "$TRUST_E_BOTH_PASSWORD",
317 pam_options])
318 plantestsuite("samba.tests.pam_winbind(trust_e_both2+%s)" % description, env,
319 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
320 valgrindify(python), pam_wrapper_so_path,
321 "$TRUST_E_BOTH_REALM",
322 "$TRUST_E_BOTH_USERNAME",
323 "$TRUST_E_BOTH_PASSWORD",
324 pam_options])
325 plantestsuite("samba.tests.pam_winbind(trust_e_both3+%s)" % description, env,
326 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
327 valgrindify(python), pam_wrapper_so_path,
328 "''",
329 "${TRUST_E_BOTH_USERNAME}@${TRUST_E_BOTH_DOMAIN}",
330 "$TRUST_E_BOTH_PASSWORD",
331 pam_options])
332 plantestsuite("samba.tests.pam_winbind(trust_e_both4+%s)" % description, env,
333 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
334 valgrindify(python), pam_wrapper_so_path,
335 "''",
336 "${TRUST_E_BOTH_USERNAME}@${TRUST_E_BOTH_REALM}",
337 "$TRUST_E_BOTH_PASSWORD",
338 pam_options])
339 plantestsuite("samba.tests.pam_winbind(trust_e_both5+%s)" % description, env,
340 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
341 valgrindify(python), pam_wrapper_so_path,
342 "${TRUST_E_BOTH_REALM}",
343 "${TRUST_E_BOTH_USERNAME}@${TRUST_E_BOTH_DOMAIN}",
344 "$TRUST_E_BOTH_PASSWORD",
345 pam_options])
346 plantestsuite("samba.tests.pam_winbind(trust_e_both6+%s)" % description, env,
347 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
348 valgrindify(python), pam_wrapper_so_path,
349 "${TRUST_E_BOTH_DOMAIN}",
350 "${TRUST_E_BOTH_USERNAME}@${TRUST_E_BOTH_REALM}",
351 "$TRUST_E_BOTH_PASSWORD",
352 pam_options])
354 for authtok_options in ["", "use_authtok", "try_authtok"]:
355 _pam_options = "'%s %s'" % (o["pam_options"], authtok_options)
356 _description = "%s %s" % (description, authtok_options)
357 plantestsuite("samba.tests.pam_winbind_chauthtok(domain+%s)" % _description, env,
358 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind_chauthtok.sh"),
359 valgrindify(python), pam_wrapper_so_path, pam_set_items_so_path,
360 "$DOMAIN", "TestPamOptionsUser", "oldp@ssword0", "newp@ssword0",
361 _pam_options, 'yes',
362 "$DC_SERVER", "$DC_USERNAME", "$DC_PASSWORD"])
364 plantestsuite("samba.tests.pam_winbind_warn_pwd_expire(domain+%s)" % description, env,
365 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind_warn_pwd_expire.sh"),
366 valgrindify(python), pam_wrapper_so_path,
367 "$DOMAIN", "alice", "Secret007",
368 pam_options])
371 plantestsuite("samba.unittests.krb5samba", "none",
372 [os.path.join(bindir(), "default/testsuite/unittests/test_krb5samba")])
373 plantestsuite("samba.unittests.sambafs_srv_pipe", "none",
374 [os.path.join(bindir(), "default/testsuite/unittests/test_sambafs_srv_pipe")])
375 plantestsuite("samba.unittests.lib_util_modules", "none",
376 [os.path.join(bindir(), "default/testsuite/unittests/test_lib_util_modules")])
378 plantestsuite("samba.unittests.smb1cli_session", "none",
379 [os.path.join(bindir(), "default/libcli/smb/test_smb1cli_session")])
381 plantestsuite("samba.unittests.talloc_keep_secret", "none",
382 [os.path.join(bindir(), "default/lib/util/test_talloc_keep_secret")])
384 plantestsuite("samba.unittests.tldap", "none",
385 [os.path.join(bindir(), "default/source3/test_tldap")])
386 plantestsuite("samba.unittests.rfc1738", "none",
387 [os.path.join(bindir(), "default/lib/util/test_rfc1738")])
388 plantestsuite("samba.unittests.kerberos", "none",
389 [os.path.join(bindir(), "test_kerberos")])
390 plantestsuite("samba.unittests.ms_fnmatch", "none",
391 [os.path.join(bindir(), "default/lib/util/test_ms_fnmatch")])
392 plantestsuite("samba.unittests.byteorder", "none",
393 [os.path.join(bindir(), "default/lib/util/test_byteorder")])
394 plantestsuite("samba.unittests.bytearray", "none",
395 [os.path.join(bindir(), "default/lib/util/test_bytearray")])
396 plantestsuite("samba.unittests.byteorder_verify", "none",
397 [os.path.join(bindir(), "default/lib/util/test_byteorder_verify")])
398 plantestsuite("samba.unittests.util_paths", "none",
399 [os.path.join(bindir(), "default/lib/util/test_util_paths")])
400 plantestsuite("samba.unittests.util", "none",
401 [os.path.join(bindir(), "default/lib/util/test_util")])
402 plantestsuite("samba.unittests.memcache", "none",
403 [os.path.join(bindir(), "default/lib/util/test_memcache")])
404 plantestsuite("samba.unittests.ntlm_check", "none",
405 [os.path.join(bindir(), "default/libcli/auth/test_ntlm_check")])
406 plantestsuite("samba.unittests.gnutls", "none",
407 [os.path.join(bindir(), "default/libcli/auth/test_gnutls")])
408 plantestsuite("samba.unittests.rc4_passwd_buffer", "none",
409 [os.path.join(bindir(), "default/libcli/auth/test_rc4_passwd_buffer")])
410 plantestsuite("samba.unittests.schannel", "none",
411 [os.path.join(bindir(), "default/libcli/auth/test_schannel")])
412 plantestsuite("samba.unittests.test_registry_regfio", "none",
413 [os.path.join(bindir(), "default/source3/test_registry_regfio")])
414 plantestsuite("samba.unittests.test_oLschema2ldif", "none",
415 [os.path.join(bindir(), "default/source4/utils/oLschema2ldif/test_oLschema2ldif")])
416 if with_elasticsearch_backend:
417 plantestsuite("samba.unittests.mdsparser_es", "none",
418 [os.path.join(bindir(), "default/source3/test_mdsparser_es")] + [configuration])