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