python: samba.tests.core: Port and enable core tests in Python 3
[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
43 planpythontestsuite("none", "samba.tests.source")
44 if have_man_pages_support:
45     planpythontestsuite("none", "samba.tests.docs")
46
47 try:
48     import testscenarios
49 except ImportError:
50     skiptestsuite("subunit", "testscenarios not available")
51 else:
52     planpythontestsuite("none", "subunit.tests.test_suite")
53 planpythontestsuite("none", "samba.tests.blackbox.ndrdump")
54 planpythontestsuite("none", "api", name="ldb.python", extra_path=['lib/ldb/tests/python'])
55 planpythontestsuite("none", "samba.tests.credentials", py3_compatible=True)
56 planpythontestsuite("none", "samba.tests.registry")
57 planpythontestsuite("none", "samba.tests.auth", py3_compatible=True)
58 planpythontestsuite("none", "samba.tests.get_opt")
59 planpythontestsuite("none", "samba.tests.security")
60 planpythontestsuite("none", "samba.tests.dcerpc.misc", py3_compatible=True)
61 planpythontestsuite("none", "samba.tests.dcerpc.integer")
62 planpythontestsuite("none", "samba.tests.param", py3_compatible=True)
63 planpythontestsuite("none", "samba.tests.upgrade")
64 planpythontestsuite("none", "samba.tests.core", py3_compatible=True)
65 planpythontestsuite("none", "samba.tests.provision")
66 planpythontestsuite("none", "samba.tests.samba3")
67 planpythontestsuite("none", "samba.tests.strings")
68 planpythontestsuite("none", "samba.tests.netcmd")
69 planpythontestsuite("none", "samba.tests.dcerpc.rpc_talloc")
70 planpythontestsuite("none", "samba.tests.dcerpc.array")
71 planpythontestsuite("none", "samba.tests.dcerpc.string")
72 planpythontestsuite("none", "samba.tests.hostconfig")
73 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.messaging")
74 planpythontestsuite("none", "samba.tests.samba3sam")
75 planpythontestsuite(
76     "none", "wafsamba.tests.test_suite",
77     extra_path=[os.path.join(samba4srcdir, "..", "buildtools"),
78                 os.path.join(samba4srcdir, "..", "third_party", "waf", "wafadmin")])
79 plantestsuite(
80     "samba4.blackbox.demote-saveddb", "none",
81     ["PYTHON=%s" % python, os.path.join(bbdir, "demote-saveddb.sh"),
82      '$PREFIX_ABS/demote', configuration])
83 plantestsuite(
84     "samba4.blackbox.dbcheck.alpha13", "none",
85     ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
86      '$PREFIX_ABS/provision', 'alpha13', configuration])
87 plantestsuite(
88     "samba4.blackbox.dbcheck.release-4-0-0", "none",
89     ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
90      '$PREFIX_ABS/provision', 'release-4-0-0', configuration])
91 plantestsuite(
92     "samba4.blackbox.dbcheck.release-4-1-0rc3", "none",
93     ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
94      '$PREFIX_ABS/provision', 'release-4-1-0rc3', configuration])
95 plantestsuite(
96     "samba4.blackbox.dbcheck.release-4-1-6-partial-object", "none",
97     ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
98      '$PREFIX_ABS/provision', 'release-4-1-6-partial-object', configuration])
99 plantestsuite(
100     "samba4.blackbox.dbcheck.release-4-5-0-pre1", "none",
101     ["PYTHON=%s" % python,
102      os.path.join(bbdir, "dbcheck-oldrelease.sh"),
103      '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
104 plantestsuite(
105     "samba4.blackbox.upgradeprovision.alpha13", "none",
106     ["PYTHON=%s" % python,
107      os.path.join(bbdir, "upgradeprovision-oldrelease.sh"),
108      '$PREFIX_ABS/provision', 'alpha13', configuration])
109 plantestsuite(
110     "samba4.blackbox.upgradeprovision.release-4-0-0", "none",
111     ["PYTHON=%s" % python,
112      os.path.join(bbdir, "upgradeprovision-oldrelease.sh"),
113      '$PREFIX_ABS/provision', 'release-4-0-0', configuration])
114 plantestsuite(
115     "samba4.blackbox.tombstones-expunge.release-4-5-0-pre1", "none",
116     ["PYTHON=%s" % python,
117      os.path.join(bbdir, "tombstones-expunge.sh"),
118      '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
119 plantestsuite(
120     "samba4.blackbox.dbcheck-links.release-4-5-0-pre1", "none",
121     ["PYTHON=%s" % python,
122      os.path.join(bbdir, "dbcheck-links.sh"),
123      '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
124 planpythontestsuite("none", "samba.tests.upgradeprovision")
125 planpythontestsuite("none", "samba.tests.xattr")
126 planpythontestsuite("none", "samba.tests.ntacls")
127 planpythontestsuite("none", "samba.tests.policy")
128 planpythontestsuite("none", "samba.tests.kcc.graph")
129 planpythontestsuite("none", "samba.tests.kcc.graph_utils")
130 planpythontestsuite("none", "samba.tests.kcc.kcc_utils")
131 planpythontestsuite("none", "samba.tests.kcc.ldif_import_export")
132 plantestsuite("wafsamba.duplicate_symbols", "none", [os.path.join(srcdir(), "buildtools/wafsamba/test_duplicate_symbol.sh")])
133 plantestsuite(
134     "script.traffic_summary", "none",
135     [os.path.join(srcdir(), "script/tests/test_traffic_summary.sh"),
136      configuration])
137 planpythontestsuite("none", "samba.tests.glue", py3_compatible=True)
138
139 if with_cmocka:
140     plantestsuite("samba.unittests.krb5samba", "none",
141                   [os.path.join(bindir(), "default/testsuite/unittests/test_krb5samba")])