tests/replica_sync_rodc: Test conflict handling on an RODC
[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_cmocka = ("HAVE_CMOCKA" in config_hash)
42 with_pam = ("WITH_PAM" in config_hash)
43 pam_wrapper_so_path=config_hash["LIBPAM_WRAPPER_SO_PATH"]
44
45 planpythontestsuite("none", "samba.tests.source")
46 if have_man_pages_support:
47     planpythontestsuite("none", "samba.tests.docs")
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")
56 planpythontestsuite("none", "samba.tests.blackbox.check_output")
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("none", "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")
67 planpythontestsuite("none", "samba.tests.core", py3_compatible=True)
68 planpythontestsuite("none", "samba.tests.common")
69 planpythontestsuite("none", "samba.tests.provision")
70 planpythontestsuite("none", "samba.tests.password_quality")
71 planpythontestsuite("none", "samba.tests.samba3")
72 planpythontestsuite("none", "samba.tests.strings")
73 planpythontestsuite("none", "samba.tests.netcmd")
74 planpythontestsuite("none", "samba.tests.dcerpc.rpc_talloc")
75 planpythontestsuite("none", "samba.tests.dcerpc.array")
76 planpythontestsuite("none", "samba.tests.dcerpc.string")
77 planpythontestsuite("none", "samba.tests.hostconfig")
78 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.messaging",
79                     py3_compatible=True)
80 planpythontestsuite("none", "samba.tests.samba3sam")
81 planpythontestsuite(
82     "none", "wafsamba.tests.test_suite",
83     extra_path=[os.path.join(samba4srcdir, "..", "buildtools"),
84                 os.path.join(samba4srcdir, "..", "third_party", "waf", "wafadmin")])
85 plantestsuite(
86     "samba4.blackbox.demote-saveddb", "none",
87     ["PYTHON=%s" % python, os.path.join(bbdir, "demote-saveddb.sh"),
88      '$PREFIX_ABS/demote', configuration])
89 plantestsuite(
90     "samba4.blackbox.dbcheck.alpha13", "none",
91     ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
92      '$PREFIX_ABS/provision', 'alpha13', configuration])
93 plantestsuite(
94     "samba4.blackbox.dbcheck.release-4-0-0", "none",
95     ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
96      '$PREFIX_ABS/provision', 'release-4-0-0', configuration])
97 plantestsuite(
98     "samba4.blackbox.dbcheck.release-4-1-0rc3", "none",
99     ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
100      '$PREFIX_ABS/provision', 'release-4-1-0rc3', configuration])
101 plantestsuite(
102     "samba4.blackbox.dbcheck.release-4-1-6-partial-object", "none",
103     ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
104      '$PREFIX_ABS/provision', 'release-4-1-6-partial-object', configuration])
105 plantestsuite(
106     "samba4.blackbox.dbcheck.release-4-5-0-pre1", "none",
107     ["PYTHON=%s" % python,
108      os.path.join(bbdir, "dbcheck-oldrelease.sh"),
109      '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
110 plantestsuite(
111     "samba4.blackbox.upgradeprovision.alpha13", "none",
112     ["PYTHON=%s" % python,
113      os.path.join(bbdir, "upgradeprovision-oldrelease.sh"),
114      '$PREFIX_ABS/provision', 'alpha13', configuration])
115 plantestsuite(
116     "samba4.blackbox.upgradeprovision.release-4-0-0", "none",
117     ["PYTHON=%s" % python,
118      os.path.join(bbdir, "upgradeprovision-oldrelease.sh"),
119      '$PREFIX_ABS/provision', 'release-4-0-0', configuration])
120 plantestsuite(
121     "samba4.blackbox.tombstones-expunge.release-4-5-0-pre1", "none",
122     ["PYTHON=%s" % python,
123      os.path.join(bbdir, "tombstones-expunge.sh"),
124      '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
125 plantestsuite(
126     "samba4.blackbox.dbcheck-links.release-4-5-0-pre1", "none",
127     ["PYTHON=%s" % python,
128      os.path.join(bbdir, "dbcheck-links.sh"),
129      '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
130 plantestsuite(
131     "samba4.blackbox.runtime-links.release-4-5-0-pre1", "none",
132     ["PYTHON=%s" % python,
133      os.path.join(bbdir, "runtime-links.sh"),
134      '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
135 plantestsuite(
136     "samba4.blackbox.schemaupgrade", "none",
137     ["PYTHON=%s" % python,
138      os.path.join(bbdir, "schemaupgrade.sh"),
139      '$PREFIX_ABS/provision', configuration])
140 plantestsuite(
141     "samba4.blackbox.functionalprep", "none",
142     ["PYTHON=%s" % python,
143      os.path.join(bbdir, "functionalprep.sh"),
144      '$PREFIX_ABS/provision', configuration])
145 planpythontestsuite("none", "samba.tests.upgradeprovision")
146 planpythontestsuite("none", "samba.tests.xattr", py3_compatible=True)
147 planpythontestsuite("none", "samba.tests.ntacls")
148 planpythontestsuite("none", "samba.tests.policy")
149 planpythontestsuite("none", "samba.tests.kcc.graph")
150 planpythontestsuite("none", "samba.tests.kcc.graph_utils")
151 planpythontestsuite("none", "samba.tests.kcc.kcc_utils")
152 planpythontestsuite("none", "samba.tests.kcc.ldif_import_export")
153 planpythontestsuite("none", "samba.tests.graph")
154 plantestsuite("wafsamba.duplicate_symbols", "none", [os.path.join(srcdir(), "buildtools/wafsamba/test_duplicate_symbol.sh")])
155 planpythontestsuite("none", "samba.tests.glue", py3_compatible=True)
156 planpythontestsuite("none", "samba.tests.tdb_util", py3_compatible=True)
157 planpythontestsuite("none", "samba.tests.samdb_api")
158
159 if with_pam:
160     plantestsuite("samba.tests.pam_winbind(local)", "ad_member",
161                   [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
162                    valgrindify(python), pam_wrapper_so_path,
163                    "$SERVER", "$USERNAME", "$PASSWORD"])
164     plantestsuite("samba.tests.pam_winbind(domain)", "ad_member",
165                   [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
166                    valgrindify(python), pam_wrapper_so_path,
167                    "$DOMAIN", "$DC_USERNAME", "$DC_PASSWORD"])
168     plantestsuite("samba.tests.pam_winbind_warn_pwd_expire(domain)", "ad_member",
169                   [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind_warn_pwd_expire.sh"),
170                    valgrindify(python), pam_wrapper_so_path,
171                    "$DOMAIN", "alice", "Secret007"])
172
173 if with_cmocka:
174     plantestsuite("samba.unittests.krb5samba", "none",
175                   [os.path.join(bindir(), "default/testsuite/unittests/test_krb5samba")])
176     plantestsuite("samba.unittests.sambafs_srv_pipe", "none",
177                   [os.path.join(bindir(), "default/testsuite/unittests/test_sambafs_srv_pipe")])
178     plantestsuite("samba.unittests.lib_util_modules", "none",
179                   [os.path.join(bindir(), "default/testsuite/unittests/test_lib_util_modules")])
180
181     plantestsuite("samba.unittests.smb1cli_session", "none",
182                   [os.path.join(bindir(), "default/libcli/smb/test_smb1cli_session")])