samdb: Fix an uninitialized variable read
[Samba.git] / selftest / tests.py
blob46fc8a802bb6fcaf21324d2c31d0a0018760df38
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.get("LIBPAM_WRAPPER_SO_PATH")
49 pam_set_items_so_path = config_hash.get("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.cred_opt")
69 planpythontestsuite("none", "samba.tests.security")
70 planpythontestsuite("none", "samba.tests.dcerpc.misc")
71 planpythontestsuite("none", "samba.tests.dcerpc.integer")
72 planpythontestsuite("none", "samba.tests.param")
73 planpythontestsuite("none", "samba.tests.upgrade")
74 planpythontestsuite("none", "samba.tests.core")
75 planpythontestsuite("none", "samba.tests.common")
76 planpythontestsuite("none", "samba.tests.provision")
77 planpythontestsuite("none", "samba.tests.password_quality")
78 planpythontestsuite("none", "samba.tests.strings")
79 planpythontestsuite("none", "samba.tests.netcmd")
80 planpythontestsuite("none", "samba.tests.dcerpc.rpc_talloc")
81 planpythontestsuite("none", "samba.tests.dcerpc.array")
82 planpythontestsuite("none", "samba.tests.dcerpc.string_tests")
83 planpythontestsuite("none", "samba.tests.hostconfig")
84 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.messaging")
85 planpythontestsuite("none", "samba.tests.s3param")
86 planpythontestsuite("none", "samba.tests.s3passdb")
87 planpythontestsuite("none", "samba.tests.s3registry")
88 planpythontestsuite("none", "samba.tests.s3windb")
89 planpythontestsuite("none", "samba.tests.s3idmapdb")
90 planpythontestsuite("none", "samba.tests.samba3sam")
91 planpythontestsuite(
92 "none", "wafsamba.tests.test_suite",
93 extra_path=[os.path.join(samba4srcdir, "..", "buildtools"),
94 os.path.join(samba4srcdir, "..", "third_party", "waf")])
95 planpythontestsuite("fileserver", "samba.tests.smbd_fuzztest")
96 planpythontestsuite("nt4_dc_smb1", "samba.tests.dcerpc.binding")
97 planpythontestsuite('ad_dc:local', "samba.tests.dcerpc.samr_change_password")
98 planpythontestsuite('ad_dc_fips:local',
99 "samba.tests.dcerpc.samr_change_password",
100 environ={'GNUTLS_FORCE_FIPS_MODE': '1',
101 'OPENSSL_FORCE_FIPS_MODE': '1'})
104 def cmdline(script, *args):
106 Prefix PYTHON env var and append --configurefile option to abs script path.
108 script.sh arg1 arg2
110 PYTHON=python /path/to/bbdir/script.sh arg1 arg2 \
111 --configurefile $SMB_CONF_FILE
113 return [
114 "PYTHON=%s" % python,
115 os.path.join(bbdir, script),
116 ] + list(args) + [configuration]
119 plantestsuite(
120 "samba4.blackbox.demote-saveddb", "none",
121 cmdline('demote-saveddb.sh', '$PREFIX_ABS/demote'))
123 plantestsuite(
124 "samba4.blackbox.dbcheck.alpha13", "none",
125 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
126 'alpha13'))
128 # same test as above but skip member link checks
129 plantestsuite(
130 "samba4.blackbox.dbcheck.alpha13.quick", "none",
131 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
132 'alpha13', '--quick-membership-checks'))
134 plantestsuite(
135 "samba4.blackbox.dbcheck.release-4-0-0", "none",
136 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
137 'release-4-0-0'))
139 # same test as above but skip member link checks
140 plantestsuite(
141 "samba4.blackbox.dbcheck.release-4-0-0.quick", "none",
142 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
143 'release-4-0-0', '--quick-membership-checks'))
145 plantestsuite(
146 "samba4.blackbox.dbcheck.release-4-1-0rc3", "none",
147 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
148 'release-4-1-0rc3'))
150 # same test as above but skip member link checks
151 plantestsuite(
152 "samba4.blackbox.dbcheck.release-4-1-0rc3.quick", "none",
153 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
154 'release-4-1-0rc3', '--quick-membership-checks'))
156 plantestsuite(
157 "samba4.blackbox.dbcheck.release-4-1-6-partial-object", "none",
158 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
159 'release-4-1-6-partial-object'))
161 # same test as above but skip member link checks
162 plantestsuite(
163 "samba4.blackbox.dbcheck.release-4-1-6-partial-object.quick", "none",
164 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
165 'release-4-1-6-partial-object', '--quick-membership-checks'))
167 plantestsuite(
168 "samba4.blackbox.dbcheck.release-4-5-0-pre1", "none",
169 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
170 'release-4-5-0-pre1'))
172 # same test as above but skip member link checks
173 plantestsuite(
174 "samba4.blackbox.dbcheck.release-4-5-0-pre1.quick", "none",
175 cmdline('dbcheck-oldrelease.sh', '$PREFIX_ABS/provision',
176 'release-4-5-0-pre1', '--quick-membership-checks'))
178 plantestsuite(
179 "samba4.blackbox.upgradeprovision.alpha13", "none",
180 cmdline('upgradeprovision-oldrelease.sh', '$PREFIX_ABS/provision',
181 'alpha13'))
183 plantestsuite(
184 "samba4.blackbox.upgradeprovision.release-4-0-0", "none",
185 cmdline('upgradeprovision-oldrelease.sh', '$PREFIX_ABS/provision',
186 'release-4-0-0'))
188 plantestsuite(
189 "samba4.blackbox.tombstones-expunge.release-4-5-0-pre1", "none",
190 cmdline('tombstones-expunge.sh', '$PREFIX_ABS/provision',
191 'release-4-5-0-pre1'))
193 plantestsuite(
194 "samba4.blackbox.dbcheck-links.release-4-5-0-pre1", "none",
195 cmdline('dbcheck-links.sh', '$PREFIX_ABS/provision',
196 'release-4-5-0-pre1'))
198 plantestsuite(
199 "samba4.blackbox.runtime-links.release-4-5-0-pre1", "none",
200 cmdline('runtime-links.sh', '$PREFIX_ABS/provision',
201 'release-4-5-0-pre1'))
203 plantestsuite(
204 "samba4.blackbox.schemaupgrade", "none",
205 cmdline('schemaupgrade.sh', '$PREFIX_ABS/provision'))
207 plantestsuite(
208 "samba4.blackbox.functionalprep", "none",
209 cmdline('functionalprep.sh', '$PREFIX_ABS/provision'))
211 planpythontestsuite("none", "samba.tests.upgradeprovision")
212 planpythontestsuite("none", "samba.tests.xattr")
213 planpythontestsuite("none", "samba.tests.ntacls")
214 planpythontestsuite("none", "samba.tests.policy")
215 planpythontestsuite("none", "samba.tests.kcc.graph")
216 planpythontestsuite("none", "samba.tests.kcc.graph_utils")
217 planpythontestsuite("none", "samba.tests.kcc.ldif_import_export")
218 planpythontestsuite("none", "samba.tests.graph")
219 plantestsuite("wafsamba.duplicate_symbols", "none", [os.path.join(srcdir(), "buildtools/wafsamba/test_duplicate_symbol.sh")])
220 planpythontestsuite("none", "samba.tests.glue")
221 planpythontestsuite("none", "samba.tests.tdb_util")
222 planpythontestsuite("none", "samba.tests.samdb")
223 planpythontestsuite("none", "samba.tests.samdb_api")
224 planpythontestsuite("none", "samba.tests.ndr")
226 if with_pam:
227 env = "ad_member"
228 options = [
230 "description": "krb5",
231 "pam_options": "krb5_auth krb5_ccache_type=FILE",
234 "description": "default",
235 "pam_options": "",
238 for o in options:
239 description = o["description"]
240 pam_options = "'%s'" % o["pam_options"]
242 plantestsuite("samba.tests.pam_winbind(local+%s)" % description, env,
243 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
244 valgrindify(python), pam_wrapper_so_path,
245 "$SERVER", "$USERNAME", "$PASSWORD",
246 pam_options])
247 plantestsuite("samba.tests.pam_winbind(domain1+%s)" % description, env,
248 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
249 valgrindify(python), pam_wrapper_so_path,
250 "$DOMAIN", "$DC_USERNAME", "$DC_PASSWORD",
251 pam_options])
252 plantestsuite("samba.tests.pam_winbind(domain2+%s)" % description, env,
253 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
254 valgrindify(python), pam_wrapper_so_path,
255 "$REALM", "$DC_USERNAME", "$DC_PASSWORD",
256 pam_options])
257 plantestsuite("samba.tests.pam_winbind(domain3+%s)" % description, env,
258 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
259 valgrindify(python), pam_wrapper_so_path,
260 "''", "${DC_USERNAME}@${DOMAIN}", "$DC_PASSWORD",
261 pam_options])
262 plantestsuite("samba.tests.pam_winbind(domain4+%s)" % description, env,
263 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
264 valgrindify(python), pam_wrapper_so_path,
265 "''", "${DC_USERNAME}@${REALM}", "$DC_PASSWORD",
266 pam_options])
267 plantestsuite("samba.tests.pam_winbind(domain5+%s)" % description, env,
268 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
269 valgrindify(python), pam_wrapper_so_path,
270 "$REALM", "${DC_USERNAME}@${DOMAIN}", "$DC_PASSWORD",
271 pam_options])
272 plantestsuite("samba.tests.pam_winbind(domain6+%s)" % description, env,
273 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
274 valgrindify(python), pam_wrapper_so_path,
275 "$DOMAIN", "${DC_USERNAME}@${REALM}", "$DC_PASSWORD",
276 pam_options])
277 plantestsuite("samba.tests.pam_winbind(trust_f_both1+%s)" % description, env,
278 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
279 valgrindify(python), pam_wrapper_so_path,
280 "$TRUST_F_BOTH_DOMAIN",
281 "$TRUST_F_BOTH_USERNAME",
282 "$TRUST_F_BOTH_PASSWORD",
283 pam_options])
284 plantestsuite("samba.tests.pam_winbind(trust_f_both2+%s)" % description, env,
285 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
286 valgrindify(python), pam_wrapper_so_path,
287 "$TRUST_F_BOTH_REALM",
288 "$TRUST_F_BOTH_USERNAME",
289 "$TRUST_F_BOTH_PASSWORD",
290 pam_options])
291 plantestsuite("samba.tests.pam_winbind(trust_f_both3+%s)" % description, env,
292 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
293 valgrindify(python), pam_wrapper_so_path,
294 "''",
295 "${TRUST_F_BOTH_USERNAME}@${TRUST_F_BOTH_DOMAIN}",
296 "$TRUST_F_BOTH_PASSWORD",
297 pam_options])
298 plantestsuite("samba.tests.pam_winbind(trust_f_both4+%s)" % description, env,
299 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
300 valgrindify(python), pam_wrapper_so_path,
301 "''",
302 "${TRUST_F_BOTH_USERNAME}@${TRUST_F_BOTH_REALM}",
303 "$TRUST_F_BOTH_PASSWORD",
304 pam_options])
305 plantestsuite("samba.tests.pam_winbind(trust_f_both5+%s)" % description, env,
306 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
307 valgrindify(python), pam_wrapper_so_path,
308 "${TRUST_F_BOTH_REALM}",
309 "${TRUST_F_BOTH_USERNAME}@${TRUST_F_BOTH_DOMAIN}",
310 "$TRUST_F_BOTH_PASSWORD",
311 pam_options])
312 plantestsuite("samba.tests.pam_winbind(trust_f_both6+%s)" % description, env,
313 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
314 valgrindify(python), pam_wrapper_so_path,
315 "${TRUST_F_BOTH_DOMAIN}",
316 "${TRUST_F_BOTH_USERNAME}@${TRUST_F_BOTH_REALM}",
317 "$TRUST_F_BOTH_PASSWORD",
318 pam_options])
319 plantestsuite("samba.tests.pam_winbind(trust_e_both1+%s)" % description, env,
320 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
321 valgrindify(python), pam_wrapper_so_path,
322 "$TRUST_E_BOTH_DOMAIN",
323 "$TRUST_E_BOTH_USERNAME",
324 "$TRUST_E_BOTH_PASSWORD",
325 pam_options])
326 plantestsuite("samba.tests.pam_winbind(trust_e_both2+%s)" % description, env,
327 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
328 valgrindify(python), pam_wrapper_so_path,
329 "$TRUST_E_BOTH_REALM",
330 "$TRUST_E_BOTH_USERNAME",
331 "$TRUST_E_BOTH_PASSWORD",
332 pam_options])
333 plantestsuite("samba.tests.pam_winbind(trust_e_both3+%s)" % description, env,
334 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
335 valgrindify(python), pam_wrapper_so_path,
336 "''",
337 "${TRUST_E_BOTH_USERNAME}@${TRUST_E_BOTH_DOMAIN}",
338 "$TRUST_E_BOTH_PASSWORD",
339 pam_options])
340 plantestsuite("samba.tests.pam_winbind(trust_e_both4+%s)" % description, env,
341 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
342 valgrindify(python), pam_wrapper_so_path,
343 "''",
344 "${TRUST_E_BOTH_USERNAME}@${TRUST_E_BOTH_REALM}",
345 "$TRUST_E_BOTH_PASSWORD",
346 pam_options])
347 plantestsuite("samba.tests.pam_winbind(trust_e_both5+%s)" % description, env,
348 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
349 valgrindify(python), pam_wrapper_so_path,
350 "${TRUST_E_BOTH_REALM}",
351 "${TRUST_E_BOTH_USERNAME}@${TRUST_E_BOTH_DOMAIN}",
352 "$TRUST_E_BOTH_PASSWORD",
353 pam_options])
354 plantestsuite("samba.tests.pam_winbind(trust_e_both6+%s)" % description, env,
355 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
356 valgrindify(python), pam_wrapper_so_path,
357 "${TRUST_E_BOTH_DOMAIN}",
358 "${TRUST_E_BOTH_USERNAME}@${TRUST_E_BOTH_REALM}",
359 "$TRUST_E_BOTH_PASSWORD",
360 pam_options])
362 for authtok_options in ["", "use_authtok", "try_authtok"]:
363 _pam_options = "'%s %s'" % (o["pam_options"], authtok_options)
364 _description = "%s %s" % (description, authtok_options)
365 plantestsuite("samba.tests.pam_winbind_chauthtok(domain+%s)" % _description, env,
366 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind_chauthtok.sh"),
367 valgrindify(python), pam_wrapper_so_path, pam_set_items_so_path,
368 "$DOMAIN", "TestPamOptionsUser", "oldp@ssword0", "newp@ssword0",
369 _pam_options, 'yes',
370 "$DC_SERVER", "$DC_USERNAME", "$DC_PASSWORD"])
372 plantestsuite("samba.tests.pam_winbind_warn_pwd_expire(domain+%s)" % description, env,
373 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind_warn_pwd_expire.sh"),
374 valgrindify(python), pam_wrapper_so_path,
375 "$DOMAIN", "alice", "Secret007",
376 pam_options])
379 plantestsuite("samba.unittests.krb5samba", "none",
380 [os.path.join(bindir(), "default/testsuite/unittests/test_krb5samba")])
381 plantestsuite("samba.unittests.sambafs_srv_pipe", "none",
382 [os.path.join(bindir(), "default/testsuite/unittests/test_sambafs_srv_pipe")])
383 plantestsuite("samba.unittests.lib_util_modules", "none",
384 [os.path.join(bindir(), "default/testsuite/unittests/test_lib_util_modules")])
385 plantestsuite("samba.unittests.background_send",
386 "none",
387 [os.path.join(
388 bindir(),
389 "default/testsuite/unittests/test_background_send"),
390 "$SMB_CONF_PATH"])
392 plantestsuite("samba.unittests.smb1cli_session", "none",
393 [os.path.join(bindir(), "default/libcli/smb/test_smb1cli_session")])
394 plantestsuite("samba.unittests.smb_util_translate", "none",
395 [os.path.join(bindir(), "default/libcli/smb/test_util_translate")])
397 plantestsuite("samba.unittests.talloc_keep_secret", "none",
398 [os.path.join(bindir(), "default/lib/util/test_talloc_keep_secret")])
400 plantestsuite("samba.unittests.tldap", "none",
401 [os.path.join(bindir(), "default/source3/test_tldap")])
402 plantestsuite("samba.unittests.rfc1738", "none",
403 [os.path.join(bindir(), "default/lib/util/test_rfc1738")])
404 plantestsuite("samba.unittests.kerberos", "none",
405 [os.path.join(bindir(), "test_kerberos")])
406 plantestsuite("samba.unittests.ms_fnmatch", "none",
407 [os.path.join(bindir(), "default/lib/util/test_ms_fnmatch")])
408 plantestsuite("samba.unittests.byteorder", "none",
409 [os.path.join(bindir(), "default/lib/util/test_byteorder")])
410 plantestsuite("samba.unittests.bytearray", "none",
411 [os.path.join(bindir(), "default/lib/util/test_bytearray")])
412 plantestsuite("samba.unittests.byteorder_verify", "none",
413 [os.path.join(bindir(), "default/lib/util/test_byteorder_verify")])
414 plantestsuite("samba.unittests.util_paths", "none",
415 [os.path.join(bindir(), "default/lib/util/test_util_paths")])
416 plantestsuite("samba.unittests.util", "none",
417 [os.path.join(bindir(), "default/lib/util/test_util")])
418 plantestsuite("samba.unittests.memcache", "none",
419 [os.path.join(bindir(), "default/lib/util/test_memcache")])
420 plantestsuite("samba.unittests.sys_rw", "none",
421 [os.path.join(bindir(), "default/lib/util/test_sys_rw")])
422 plantestsuite("samba.unittests.ntlm_check", "none",
423 [os.path.join(bindir(), "default/libcli/auth/test_ntlm_check")])
424 plantestsuite("samba.unittests.gnutls", "none",
425 [os.path.join(bindir(), "default/libcli/auth/test_gnutls")])
426 plantestsuite("samba.unittests.rc4_passwd_buffer", "none",
427 [os.path.join(bindir(), "default/libcli/auth/test_rc4_passwd_buffer")])
428 plantestsuite("samba.unittests.schannel", "none",
429 [os.path.join(bindir(), "default/libcli/auth/test_schannel")])
430 plantestsuite("samba.unittests.test_registry_regfio", "none",
431 [os.path.join(bindir(), "default/source3/test_registry_regfio")])
432 plantestsuite("samba.unittests.test_oLschema2ldif", "none",
433 [os.path.join(bindir(), "default/source4/utils/oLschema2ldif/test_oLschema2ldif")])
434 if with_elasticsearch_backend:
435 plantestsuite("samba.unittests.mdsparser_es", "none",
436 [os.path.join(bindir(), "default/source3/test_mdsparser_es")] + [configuration])
437 plantestsuite("samba.unittests.credentials", "none",
438 [os.path.join(bindir(), "default/auth/credentials/test_creds")])