tests.py 9.83 KB
Newer Older
1 2
#!/usr/bin/python
# This script generates a list of testsuites that should be run as part of
3
# the Samba test suite.
4 5 6 7 8

# The output of this script is parsed by selftest.pl, which then decides
# which of the tests to actually run. It will, for example, skip all tests
# 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 11
# just those that are known to pass, and list those that should be skipped
# or are known to fail in selftest/skip or selftest/knownfail. This makes it
12 13
# very easy to see what functionality is still missing in Samba and makes
# it possible to run the testsuite against other servers, such as
14 15 16 17 18 19 20 21 22
# Windows that have a different set of features.

# The syntax for a testsuite is "-- TEST --" on a single line, followed
# by the name of the test, the environment it needs and the command to run, all
# three separated by newlines. All other lines in the output are considered
# comments.

from selftesthelpers import *

23 24 25
try:
    config_h = os.environ["CONFIG_H"]
except KeyError:
26
    samba4bindir = bindir()
27 28
    config_h = os.path.join(samba4bindir, "default/include/config.h")

29 30
# check available features
config_hash = dict()
31 32
f = open(config_h, 'r')
try:
33 34 35 36
    lines = f.readlines()
    config_hash = dict((x[0], ' '.join(x[1:]))
            for x in map(lambda line: line.strip().split(' ')[1:],
                         filter(lambda line: (line[0:7] == '#define') and (len(line.split(' ')) > 2), lines)))
37 38 39
finally:
    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"]
43

44
planpythontestsuite("none", "samba.tests.source", py3_compatible=True)
45
if have_man_pages_support:
46
    planpythontestsuite("none", "samba.tests.docs", py3_compatible=True)
47

48 49 50 51 52 53
try:
    import testscenarios
except ImportError:
    skiptestsuite("subunit", "testscenarios not available")
else:
    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("ad_dc_ntvfs:local", "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 71
planpythontestsuite("none", "samba.tests.strings")
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 77
planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.messaging",
                    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 85 86
planpythontestsuite(
    "none", "wafsamba.tests.test_suite",
    extra_path=[os.path.join(samba4srcdir, "..", "buildtools"),
87
                os.path.join(samba4srcdir, "..", "third_party", "waf", "wafadmin")])
88 89 90 91
plantestsuite(
    "samba4.blackbox.demote-saveddb", "none",
    ["PYTHON=%s" % python, os.path.join(bbdir, "demote-saveddb.sh"),
     '$PREFIX_ABS/demote', configuration])
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
plantestsuite(
    "samba4.blackbox.dbcheck.alpha13", "none",
    ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
     '$PREFIX_ABS/provision', 'alpha13', configuration])
plantestsuite(
    "samba4.blackbox.dbcheck.release-4-0-0", "none",
    ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
     '$PREFIX_ABS/provision', 'release-4-0-0', configuration])
plantestsuite(
    "samba4.blackbox.dbcheck.release-4-1-0rc3", "none",
    ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
     '$PREFIX_ABS/provision', 'release-4-1-0rc3', configuration])
plantestsuite(
    "samba4.blackbox.dbcheck.release-4-1-6-partial-object", "none",
    ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
     '$PREFIX_ABS/provision', 'release-4-1-6-partial-object', configuration])
108 109 110 111 112
plantestsuite(
    "samba4.blackbox.dbcheck.release-4-5-0-pre1", "none",
    ["PYTHON=%s" % python,
     os.path.join(bbdir, "dbcheck-oldrelease.sh"),
     '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
113 114 115 116 117 118 119 120 121 122
plantestsuite(
    "samba4.blackbox.upgradeprovision.alpha13", "none",
    ["PYTHON=%s" % python,
     os.path.join(bbdir, "upgradeprovision-oldrelease.sh"),
     '$PREFIX_ABS/provision', 'alpha13', configuration])
plantestsuite(
    "samba4.blackbox.upgradeprovision.release-4-0-0", "none",
    ["PYTHON=%s" % python,
     os.path.join(bbdir, "upgradeprovision-oldrelease.sh"),
     '$PREFIX_ABS/provision', 'release-4-0-0', configuration])
123 124 125 126 127
plantestsuite(
    "samba4.blackbox.tombstones-expunge.release-4-5-0-pre1", "none",
    ["PYTHON=%s" % python,
     os.path.join(bbdir, "tombstones-expunge.sh"),
     '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
128 129 130 131 132
plantestsuite(
    "samba4.blackbox.dbcheck-links.release-4-5-0-pre1", "none",
    ["PYTHON=%s" % python,
     os.path.join(bbdir, "dbcheck-links.sh"),
     '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
133 134 135 136 137
plantestsuite(
    "samba4.blackbox.runtime-links.release-4-5-0-pre1", "none",
    ["PYTHON=%s" % python,
     os.path.join(bbdir, "runtime-links.sh"),
     '$PREFIX_ABS/provision', 'release-4-5-0-pre1', configuration])
138 139 140 141 142
plantestsuite(
    "samba4.blackbox.schemaupgrade", "none",
    ["PYTHON=%s" % python,
     os.path.join(bbdir, "schemaupgrade.sh"),
     '$PREFIX_ABS/provision', configuration])
143 144 145 146 147
plantestsuite(
    "samba4.blackbox.functionalprep", "none",
    ["PYTHON=%s" % python,
     os.path.join(bbdir, "functionalprep.sh"),
     '$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 152
planpythontestsuite("none", "samba.tests.policy", py3_compatible=True)
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)
160

161
if with_pam:
162 163 164 165 166
    plantestsuite("samba.tests.pam_winbind(local)", "ad_member",
                  [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
                   valgrindify(python), pam_wrapper_so_path,
                   "$SERVER", "$USERNAME", "$PASSWORD"])
    plantestsuite("samba.tests.pam_winbind(domain)", "ad_member",
167
                  [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind.sh"),
168 169
                   valgrindify(python), pam_wrapper_so_path,
                   "$DOMAIN", "$DC_USERNAME", "$DC_PASSWORD"])
170 171 172 173
    plantestsuite("samba.tests.pam_winbind_warn_pwd_expire(domain)", "ad_member",
                  [os.path.join(srcdir(), "python/samba/tests/test_pam_winbind_warn_pwd_expire.sh"),
                   valgrindify(python), pam_wrapper_so_path,
                   "$DOMAIN", "alice", "Secret007"])
174

175

176 177 178 179 180 181
plantestsuite("samba.unittests.krb5samba", "none",
              [os.path.join(bindir(), "default/testsuite/unittests/test_krb5samba")])
plantestsuite("samba.unittests.sambafs_srv_pipe", "none",
              [os.path.join(bindir(), "default/testsuite/unittests/test_sambafs_srv_pipe")])
plantestsuite("samba.unittests.lib_util_modules", "none",
              [os.path.join(bindir(), "default/testsuite/unittests/test_lib_util_modules")])
182

183 184 185 186 187
plantestsuite("samba.unittests.smb1cli_session", "none",
              [os.path.join(bindir(), "default/libcli/smb/test_smb1cli_session")])

plantestsuite("samba.unittests.tldap", "none",
              [os.path.join(bindir(), "default/source3/test_tldap")])
188 189
plantestsuite("samba.unittests.rfc1738", "none",
              [os.path.join(bindir(), "default/lib/util/test_rfc1738")])
190 191
plantestsuite("samba.unittests.kerberos", "none",
              [os.path.join(bindir(), "test_kerberos")])
192 193
plantestsuite("samba.unittests.ms_fnmatch", "none",
              [os.path.join(bindir(), "default/lib/util/test_ms_fnmatch")])
194 195
plantestsuite("samba.unittests.ntlm_check", "none",
              [os.path.join(bindir(), "default/libcli/auth/test_ntlm_check")])