ctdb-common: Add command line processing abstraction
[Samba.git] / selftest / tests.py
blob185ad37fd4ae35dea4ec967387e139019e58d3e6
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 from selftesthelpers import *
23 try:
24 config_h = os.environ["CONFIG_H"]
25 except KeyError:
26 samba4bindir = bindir()
27 config_h = os.path.join(samba4bindir, "default/include/config.h")
29 # check available features
30 config_hash = dict()
31 f = open(config_h, 'r')
32 try:
33 lines = f.readlines()
34 config_hash = dict((x[0], ' '.join(x[1:]))
35 for x in map(lambda line: line.strip().split(' ')[1:],
36 filter(lambda line: (line[0:7] == '#define') and (len(line.split(' ')) > 2), lines)))
37 finally:
38 f.close()
40 have_man_pages_support = ("XSLTPROC_MANPAGES" in config_hash)
41 with_pam = ("WITH_PAM" in config_hash)
42 pam_wrapper_so_path=config_hash["LIBPAM_WRAPPER_SO_PATH"]
44 planpythontestsuite("none", "samba.tests.source", py3_compatible=True)
45 if have_man_pages_support:
46 planpythontestsuite("none", "samba.tests.docs", py3_compatible=True)
48 try:
49 import testscenarios
50 except ImportError:
51 skiptestsuite("subunit", "testscenarios not available")
52 else:
53 planpythontestsuite("none", "subunit.tests.test_suite")
54 planpythontestsuite("none", "samba.tests.blackbox.ndrdump", py3_compatible=True)
55 planpythontestsuite("none", "samba.tests.blackbox.check_output", py3_compatible=True)
56 planpythontestsuite("none", "api", name="ldb.python", extra_path=['lib/ldb/tests/python'])
57 planpythontestsuite("none", "samba.tests.credentials", py3_compatible=True)
58 planpythontestsuite("none", "samba.tests.registry", py3_compatible=True)
59 planpythontestsuite("none", "samba.tests.auth", py3_compatible=True)
60 planpythontestsuite("none", "samba.tests.get_opt", py3_compatible=True)
61 planpythontestsuite("none", "samba.tests.security", py3_compatible=True)
62 planpythontestsuite("none", "samba.tests.dcerpc.misc", py3_compatible=True)
63 planpythontestsuite("none", "samba.tests.dcerpc.integer")
64 planpythontestsuite("none", "samba.tests.param", py3_compatible=True)
65 planpythontestsuite("none", "samba.tests.upgrade", py3_compatible=True)
66 planpythontestsuite("none", "samba.tests.core", py3_compatible=True)
67 planpythontestsuite("none", "samba.tests.common", py3_compatible=True)
68 planpythontestsuite("none", "samba.tests.provision", py3_compatible=True)
69 planpythontestsuite("none", "samba.tests.password_quality", py3_compatible=True)
70 planpythontestsuite("none", "samba.tests.strings")
71 planpythontestsuite("none", "samba.tests.netcmd")
72 planpythontestsuite("none", "samba.tests.dcerpc.rpc_talloc", py3_compatible=True)
73 planpythontestsuite("none", "samba.tests.dcerpc.array", py3_compatible=True)
74 planpythontestsuite("none", "samba.tests.dcerpc.string", py3_compatible=True)
75 planpythontestsuite("none", "samba.tests.hostconfig", py3_compatible=True)
76 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.messaging",
77 py3_compatible=True)
78 planpythontestsuite("none", "samba.tests.s3param", py3_compatible=True)
79 planpythontestsuite("none", "samba.tests.s3passdb", py3_compatible=True)
80 planpythontestsuite("none", "samba.tests.s3registry", py3_compatible=True)
81 planpythontestsuite("none", "samba.tests.s3windb", py3_compatible=True)
82 planpythontestsuite("none", "samba.tests.s3idmapdb", py3_compatible=True)
83 planpythontestsuite("none", "samba.tests.samba3sam")
84 planpythontestsuite(
85 "none", "wafsamba.tests.test_suite",
86 extra_path=[os.path.join(samba4srcdir, "..", "buildtools"),
87 os.path.join(samba4srcdir, "..", "third_party", "waf", "wafadmin")])
88 plantestsuite(
89 "samba4.blackbox.demote-saveddb", "none",
90 ["PYTHON=%s" % python, os.path.join(bbdir, "demote-saveddb.sh"),
91 '$PREFIX_ABS/demote', configuration])
92 plantestsuite(
93 "samba4.blackbox.dbcheck.alpha13", "none",
94 ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
95 '$PREFIX_ABS/provision', 'alpha13', configuration])
96 plantestsuite(
97 "samba4.blackbox.dbcheck.release-4-0-0", "none",
98 ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
99 '$PREFIX_ABS/provision', 'release-4-0-0', configuration])
100 plantestsuite(
101 "samba4.blackbox.dbcheck.release-4-1-0rc3", "none",
102 ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
103 '$PREFIX_ABS/provision', 'release-4-1-0rc3', configuration])
104 plantestsuite(
105 "samba4.blackbox.dbcheck.release-4-1-6-partial-object", "none",
106 ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
107 '$PREFIX_ABS/provision', 'release-4-1-6-partial-object', configuration])
108 plantestsuite(
109 "samba4.blackbox.dbcheck.release-4-5-0-pre1", "none",
110 ["PYTHON=%s" % python,
111 os.path.join(bbdir, "dbcheck-oldrelease.sh"),
112 '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
113 plantestsuite(
114 "samba4.blackbox.upgradeprovision.alpha13", "none",
115 ["PYTHON=%s" % python,
116 os.path.join(bbdir, "upgradeprovision-oldrelease.sh"),
117 '$PREFIX_ABS/provision', 'alpha13', configuration])
118 plantestsuite(
119 "samba4.blackbox.upgradeprovision.release-4-0-0", "none",
120 ["PYTHON=%s" % python,
121 os.path.join(bbdir, "upgradeprovision-oldrelease.sh"),
122 '$PREFIX_ABS/provision', 'release-4-0-0', configuration])
123 plantestsuite(
124 "samba4.blackbox.tombstones-expunge.release-4-5-0-pre1", "none",
125 ["PYTHON=%s" % python,
126 os.path.join(bbdir, "tombstones-expunge.sh"),
127 '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
128 plantestsuite(
129 "samba4.blackbox.dbcheck-links.release-4-5-0-pre1", "none",
130 ["PYTHON=%s" % python,
131 os.path.join(bbdir, "dbcheck-links.sh"),
132 '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
133 plantestsuite(
134 "samba4.blackbox.runtime-links.release-4-5-0-pre1", "none",
135 ["PYTHON=%s" % python,
136 os.path.join(bbdir, "runtime-links.sh"),
137 '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
138 plantestsuite(
139 "samba4.blackbox.schemaupgrade", "none",
140 ["PYTHON=%s" % python,
141 os.path.join(bbdir, "schemaupgrade.sh"),
142 '$PREFIX_ABS/provision', configuration])
143 plantestsuite(
144 "samba4.blackbox.functionalprep", "none",
145 ["PYTHON=%s" % python,
146 os.path.join(bbdir, "functionalprep.sh"),
147 '$PREFIX_ABS/provision', configuration])
148 planpythontestsuite("none", "samba.tests.upgradeprovision", py3_compatible=True)
149 planpythontestsuite("none", "samba.tests.xattr", py3_compatible=True)
150 planpythontestsuite("none", "samba.tests.ntacls", py3_compatible=True)
151 planpythontestsuite("none", "samba.tests.policy", py3_compatible=True)
152 planpythontestsuite("none", "samba.tests.kcc.graph", py3_compatible=True)
153 planpythontestsuite("none", "samba.tests.kcc.graph_utils", py3_compatible=True)
154 planpythontestsuite("none", "samba.tests.kcc.ldif_import_export")
155 planpythontestsuite("none", "samba.tests.graph", py3_compatible=True)
156 plantestsuite("wafsamba.duplicate_symbols", "none", [os.path.join(srcdir(), "buildtools/wafsamba/test_duplicate_symbol.sh")])
157 planpythontestsuite("none", "samba.tests.glue", py3_compatible=True)
158 planpythontestsuite("none", "samba.tests.tdb_util", py3_compatible=True)
159 planpythontestsuite("none", "samba.tests.samdb_api", py3_compatible=True)
161 if with_pam:
162 plantestsuite("samba.tests.pam_winbind(local)", "ad_member",
163 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
164 valgrindify(python), pam_wrapper_so_path,
165 "$SERVER", "$USERNAME", "$PASSWORD"])
166 plantestsuite("samba.tests.pam_winbind(domain)", "ad_member",
167 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
168 valgrindify(python), pam_wrapper_so_path,
169 "$DOMAIN", "$DC_USERNAME", "$DC_PASSWORD"])
170 plantestsuite("samba.tests.pam_winbind_warn_pwd_expire(domain)", "ad_member",
171 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind_warn_pwd_expire.sh"),
172 valgrindify(python), pam_wrapper_so_path,
173 "$DOMAIN", "alice", "Secret007"])
176 plantestsuite("samba.unittests.krb5samba", "none",
177 [os.path.join(bindir(), "default/testsuite/unittests/test_krb5samba")])
178 plantestsuite("samba.unittests.sambafs_srv_pipe", "none",
179 [os.path.join(bindir(), "default/testsuite/unittests/test_sambafs_srv_pipe")])
180 plantestsuite("samba.unittests.lib_util_modules", "none",
181 [os.path.join(bindir(), "default/testsuite/unittests/test_lib_util_modules")])
183 plantestsuite("samba.unittests.smb1cli_session", "none",
184 [os.path.join(bindir(), "default/libcli/smb/test_smb1cli_session")])
186 plantestsuite("samba.unittests.tldap", "none",
187 [os.path.join(bindir(), "default/source3/test_tldap")])
188 plantestsuite("samba.unittests.rfc1738", "none",
189 [os.path.join(bindir(), "default/lib/util/test_rfc1738")])
190 plantestsuite("samba.unittests.ms_fnmatch", "none",
191 [os.path.join(bindir(), "default/lib/util/test_ms_fnmatch")])