s4:librpc: add python winspool bindings
[Samba.git] / selftest / tests.py
blob3de981f7e1324656c000411195cbd71025ca0d68
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 pam_wrapper_so_path = config_hash["LIBPAM_WRAPPER_SO_PATH"]
48 pam_set_items_so_path = config_hash["PAM_SET_ITEMS_SO_PATH"]
50 planpythontestsuite("none", "samba.tests.source", py3_compatible=True)
51 if have_man_pages_support:
52 planpythontestsuite("none", "samba.tests.docs", py3_compatible=True)
54 try:
55 import testscenarios
56 except ImportError:
57 skiptestsuite("subunit", "testscenarios not available")
58 else:
59 planpythontestsuite("none", "subunit.tests.test_suite")
60 planpythontestsuite("none", "samba.tests.blackbox.ndrdump", py3_compatible=True)
61 planpythontestsuite("none", "samba.tests.blackbox.check_output", py3_compatible=True)
62 planpythontestsuite("none", "api", name="ldb.python", extra_path=['lib/ldb/tests/python'])
63 planpythontestsuite("none", "samba.tests.credentials", py3_compatible=True)
64 planpythontestsuite("none", "samba.tests.registry", py3_compatible=True)
65 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.auth", py3_compatible=True)
66 planpythontestsuite("none", "samba.tests.get_opt", py3_compatible=True)
67 planpythontestsuite("none", "samba.tests.security", py3_compatible=True)
68 planpythontestsuite("none", "samba.tests.dcerpc.misc", py3_compatible=True)
69 planpythontestsuite("none", "samba.tests.dcerpc.integer")
70 planpythontestsuite("none", "samba.tests.param", py3_compatible=True)
71 planpythontestsuite("none", "samba.tests.upgrade", py3_compatible=True)
72 planpythontestsuite("none", "samba.tests.core", py3_compatible=True)
73 planpythontestsuite("none", "samba.tests.common", py3_compatible=True)
74 planpythontestsuite("none", "samba.tests.provision", py3_compatible=True)
75 planpythontestsuite("none", "samba.tests.password_quality", py3_compatible=True)
76 planpythontestsuite("none", "samba.tests.strings")
77 planpythontestsuite("none", "samba.tests.netcmd")
78 planpythontestsuite("none", "samba.tests.dcerpc.rpc_talloc", py3_compatible=True)
79 planpythontestsuite("none", "samba.tests.dcerpc.array", py3_compatible=True)
80 planpythontestsuite("none", "samba.tests.dcerpc.string", py3_compatible=True)
81 planpythontestsuite("none", "samba.tests.hostconfig", py3_compatible=True)
82 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.messaging",
83 py3_compatible=True)
84 planpythontestsuite("none", "samba.tests.s3param", py3_compatible=True)
85 planpythontestsuite("none", "samba.tests.s3passdb", py3_compatible=True)
86 planpythontestsuite("none", "samba.tests.s3registry", py3_compatible=True)
87 planpythontestsuite("none", "samba.tests.s3windb", py3_compatible=True)
88 planpythontestsuite("none", "samba.tests.s3idmapdb", py3_compatible=True)
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 plantestsuite(
95 "samba4.blackbox.demote-saveddb", "none",
96 ["PYTHON=%s" % python, os.path.join(bbdir, "demote-saveddb.sh"),
97 '$PREFIX_ABS/demote', configuration])
98 plantestsuite(
99 "samba4.blackbox.dbcheck.alpha13", "none",
100 ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
101 '$PREFIX_ABS/provision', 'alpha13', configuration])
102 plantestsuite(
103 "samba4.blackbox.dbcheck.release-4-0-0", "none",
104 ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
105 '$PREFIX_ABS/provision', 'release-4-0-0', configuration])
106 plantestsuite(
107 "samba4.blackbox.dbcheck.release-4-1-0rc3", "none",
108 ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
109 '$PREFIX_ABS/provision', 'release-4-1-0rc3', configuration])
110 plantestsuite(
111 "samba4.blackbox.dbcheck.release-4-1-6-partial-object", "none",
112 ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
113 '$PREFIX_ABS/provision', 'release-4-1-6-partial-object', configuration])
114 plantestsuite(
115 "samba4.blackbox.dbcheck.release-4-5-0-pre1", "none",
116 ["PYTHON=%s" % python,
117 os.path.join(bbdir, "dbcheck-oldrelease.sh"),
118 '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
119 plantestsuite(
120 "samba4.blackbox.upgradeprovision.alpha13", "none",
121 ["PYTHON=%s" % python,
122 os.path.join(bbdir, "upgradeprovision-oldrelease.sh"),
123 '$PREFIX_ABS/provision', 'alpha13', configuration])
124 plantestsuite(
125 "samba4.blackbox.upgradeprovision.release-4-0-0", "none",
126 ["PYTHON=%s" % python,
127 os.path.join(bbdir, "upgradeprovision-oldrelease.sh"),
128 '$PREFIX_ABS/provision', 'release-4-0-0', configuration])
129 plantestsuite(
130 "samba4.blackbox.tombstones-expunge.release-4-5-0-pre1", "none",
131 ["PYTHON=%s" % python,
132 os.path.join(bbdir, "tombstones-expunge.sh"),
133 '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
134 plantestsuite(
135 "samba4.blackbox.dbcheck-links.release-4-5-0-pre1", "none",
136 ["PYTHON=%s" % python,
137 os.path.join(bbdir, "dbcheck-links.sh"),
138 '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
139 plantestsuite(
140 "samba4.blackbox.runtime-links.release-4-5-0-pre1", "none",
141 ["PYTHON=%s" % python,
142 os.path.join(bbdir, "runtime-links.sh"),
143 '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
144 plantestsuite(
145 "samba4.blackbox.schemaupgrade", "none",
146 ["PYTHON=%s" % python,
147 os.path.join(bbdir, "schemaupgrade.sh"),
148 '$PREFIX_ABS/provision', configuration])
149 plantestsuite(
150 "samba4.blackbox.functionalprep", "none",
151 ["PYTHON=%s" % python,
152 os.path.join(bbdir, "functionalprep.sh"),
153 '$PREFIX_ABS/provision', configuration])
154 planpythontestsuite("none", "samba.tests.upgradeprovision", py3_compatible=True)
155 planpythontestsuite("none", "samba.tests.xattr", py3_compatible=True)
156 planpythontestsuite("none", "samba.tests.ntacls", py3_compatible=True)
157 planpythontestsuite("none", "samba.tests.policy", py3_compatible=True)
158 planpythontestsuite("none", "samba.tests.kcc.graph", py3_compatible=True)
159 planpythontestsuite("none", "samba.tests.kcc.graph_utils", py3_compatible=True)
160 planpythontestsuite("none", "samba.tests.kcc.ldif_import_export")
161 planpythontestsuite("none", "samba.tests.graph", py3_compatible=True)
162 plantestsuite("wafsamba.duplicate_symbols", "none", [os.path.join(srcdir(), "buildtools/wafsamba/test_duplicate_symbol.sh")])
163 planpythontestsuite("none", "samba.tests.glue", py3_compatible=True)
164 planpythontestsuite("none", "samba.tests.tdb_util", py3_compatible=True)
165 planpythontestsuite("none", "samba.tests.samdb_api", py3_compatible=True)
167 if with_pam:
168 plantestsuite("samba.tests.pam_winbind(local)", "ad_member",
169 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
170 valgrindify(python), pam_wrapper_so_path,
171 "$SERVER", "$USERNAME", "$PASSWORD"])
172 plantestsuite("samba.tests.pam_winbind(domain)", "ad_member",
173 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
174 valgrindify(python), pam_wrapper_so_path,
175 "$DOMAIN", "$DC_USERNAME", "$DC_PASSWORD"])
177 for pam_options in ["''", "use_authtok", "try_authtok"]:
178 plantestsuite("samba.tests.pam_winbind_chauthtok with options %s" % pam_options, "ad_member",
179 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind_chauthtok.sh"),
180 valgrindify(python), pam_wrapper_so_path, pam_set_items_so_path,
181 "$DOMAIN", "TestPamOptionsUser", "oldp@ssword0", "newp@ssword0",
182 pam_options, 'yes',
183 "$DC_SERVER", "$DC_USERNAME", "$DC_PASSWORD"])
185 plantestsuite("samba.tests.pam_winbind_warn_pwd_expire(domain)", "ad_member",
186 [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind_warn_pwd_expire.sh"),
187 valgrindify(python), pam_wrapper_so_path,
188 "$DOMAIN", "alice", "Secret007"])
191 plantestsuite("samba.unittests.krb5samba", "none",
192 [os.path.join(bindir(), "default/testsuite/unittests/test_krb5samba")])
193 plantestsuite("samba.unittests.sambafs_srv_pipe", "none",
194 [os.path.join(bindir(), "default/testsuite/unittests/test_sambafs_srv_pipe")])
195 plantestsuite("samba.unittests.lib_util_modules", "none",
196 [os.path.join(bindir(), "default/testsuite/unittests/test_lib_util_modules")])
198 plantestsuite("samba.unittests.smb1cli_session", "none",
199 [os.path.join(bindir(), "default/libcli/smb/test_smb1cli_session")])
201 plantestsuite("samba.unittests.tldap", "none",
202 [os.path.join(bindir(), "default/source3/test_tldap")])
203 plantestsuite("samba.unittests.rfc1738", "none",
204 [os.path.join(bindir(), "default/lib/util/test_rfc1738")])
205 plantestsuite("samba.unittests.kerberos", "none",
206 [os.path.join(bindir(), "test_kerberos")])
207 plantestsuite("samba.unittests.ms_fnmatch", "none",
208 [os.path.join(bindir(), "default/lib/util/test_ms_fnmatch")])
209 plantestsuite("samba.unittests.ntlm_check", "none",
210 [os.path.join(bindir(), "default/libcli/auth/test_ntlm_check")])