s3: Run pthreadpooltest in make test
[Samba.git] / source3 / selftest / tests.py
blob2e5eee1394acdc8ac1166668f33abf479791c9e1
1 #!/usr/bin/python
2 # This script generates a list of testsuites that should be run as part of
3 # the Samba 3 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 3, 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/samba4-knownfail. This makes it
12 # very easy to see what functionality is still missing in Samba 3 and makes
13 # it possible to run the testsuite against other servers, such as Samba 4 or
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, sys
22 sys.path.insert(0, os.path.normpath(os.path.join(os.path.dirname(__file__), "../../selftest")))
23 from selftesthelpers import *
24 import subprocess
26 smb4torture = binpath("smbtorture4")
27 samba3srcdir = srcdir() + "/source3"
28 configuration = "--configfile=$SMB_CONF_PATH"
29 scriptdir=os.path.join(samba3srcdir, "../script/tests")
31 torture_options = [configuration, "--maximum-runtime=$SELFTEST_MAXTIME",
32 "--target=samba3", "--basedir=$SELFTEST_TMPDIR",
33 '--option="torture:winbindd_netbios_name=$SERVER"',
34 '--option="torture:winbindd_netbios_domain=$DOMAIN"',
35 '--option=torture:sharedelay=100000']
37 if not os.getenv("SELFTEST_VERBOSE"):
38 torture_options.append("--option=torture:progress=no")
39 torture_options.append("--format=subunit")
40 if os.getenv("SELFTEST_QUICK"):
41 torture_options.append("--option=torture:quick=yes")
42 smb4torture += " " + " ".join(torture_options)
44 def plansmbtorturetestsuite(name, env, options, description=''):
45 modname = "samba3.posix_s3.%s %s" % (name, description)
46 cmdline = "%s $LISTOPT %s %s" % (valgrindify(smb4torture), options, name)
47 plantestsuite_loadlist(modname, env, cmdline)
49 plantestsuite("samba3.blackbox.success", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_success.sh")])
50 plantestsuite("samba3.blackbox.failure", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_failure.sh")])
52 plantestsuite("samba3.local_s3", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_local_s3.sh")])
54 tests=[ "FDPASS", "LOCK1", "LOCK2", "LOCK3", "LOCK4", "LOCK5", "LOCK6", "LOCK7", "LOCK9",
55 "UNLINK", "BROWSE", "ATTR", "TRANS2", "TORTURE",
56 "OPLOCK1", "OPLOCK2", "OPLOCK3", "OPLOCK4", "STREAMERROR",
57 "DIR", "DIR1", "DIR-CREATETIME", "TCON", "TCONDEV", "RW1", "RW2", "RW3", "RW-SIGNING",
58 "OPEN", "XCOPY", "RENAME", "DELETE", "DELETE-LN", "PROPERTIES", "W2K",
59 "TCON2", "IOCTL", "CHKPATH", "FDSESS", "LOCAL-SUBSTITUTE", "CHAIN1",
60 "GETADDRINFO", "POSIX", "UID-REGRESSION-TEST", "SHORTNAME-TEST",
61 "LOCAL-BASE64", "LOCAL-GENCACHE", "POSIX-APPEND",
62 "CASE-INSENSITIVE-CREATE",
63 "LOCAL-string_to_sid", "LOCAL-CONVERT-STRING" ]
65 for t in tests:
66 plantestsuite("samba3.smbtorture_s3.plain(s3dc).%s" % t, "s3dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmp', '$USERNAME', '$PASSWORD', binpath('smbtorture3'), "", "-l $LOCAL_PATH"])
67 plantestsuite("samba3.smbtorture_s3.crypt(s3dc).%s" % t, "s3dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmp', '$USERNAME', '$PASSWORD', binpath('smbtorture3'), "-e", "-l $LOCAL_PATH"])
69 tests=["--ping", "--separator",
70 "--own-domain",
71 "--all-domains",
72 "--trusted-domains",
73 "--domain-info=BUILTIN",
74 "--domain-info=$DOMAIN",
75 "--online-status",
76 "--online-status --domain=BUILTIN",
77 "--online-status --domain=$DOMAIN",
78 "--check-secret --domain=$DOMAIN",
79 "--change-secret --domain=$DOMAIN",
80 "--check-secret --domain=$DOMAIN",
81 "--online-status --domain=$DOMAIN",
82 #Didn't pass yet# "--domain-users",
83 "--domain-groups",
84 "--name-to-sid=$USERNAME",
85 "--name-to-sid=$DOMAIN\\\\$USERNAME",
86 #Didn't pass yet# "--user-info=$USERNAME",
87 "--user-groups=$DOMAIN\\\\$USERNAME",
88 "--allocate-uid",
89 "--allocate-gid"]
91 for t in tests:
92 plantestsuite("samba3.wbinfo_s3.(s3dc:local).%s" % t, "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_wbinfo_s3.sh"), t])
93 plantestsuite("samba3.wbinfo_s3.(member:local).%s" % t, "member:local", [os.path.join(samba3srcdir, "script/tests/test_wbinfo_s3.sh"), t])
95 plantestsuite(
96 "samba3.wbinfo_sids2xids.(member:local)", "member:local",
97 [os.path.join(samba3srcdir, "script/tests/test_wbinfo_sids2xids.sh")])
99 plantestsuite("samba3.ntlm_auth.(s3dc:local)", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_ntlm_auth_s3.sh"), valgrindify(python), samba3srcdir, binpath('ntlm_auth3'), configuration])
101 for env in ["s3dc", "member"]:
102 plantestsuite("samba3.blackbox.smbclient_auth.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', binpath('smbclient3'), configuration])
104 for env in ["secserver"]:
105 plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) domain creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN\\\\$DC_USERNAME', '$DC_PASSWORD', binpath('smbclient3'), configuration + " --option=clientntlmv2auth=no"])
107 for env in ["member"]:
108 plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$SERVER\\\\$USERNAME', '$PASSWORD', binpath('smbclient3'), configuration])
110 for env in ["secshare", "secserver"]:
111 plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) local creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', binpath('smbclient3'), configuration + " --option=clientntlmv2auth=no --option=clientlanmanauth=yes"])
113 # plain
114 for env in ["s3dc"]:
115 plantestsuite("samba3.blackbox.smbclient_s3.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', binpath('smbclient3'), configuration])
117 for env in ["member"]:
118 plantestsuite("samba3.blackbox.smbclient_s3.plain (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$SERVER\\\\$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', binpath('smbclient3'), configuration])
120 for env in ["s3dc"]:
121 plantestsuite("samba3.blackbox.smbclient_s3.sign (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', binpath('smbclient3'), configuration, "--signing=required"])
123 for env in ["member"]:
124 plantestsuite("samba3.blackbox.smbclient_s3.sign (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$SERVER\\\\$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', binpath('smbclient3'), configuration, "--signing=required"])
126 # encrypted
127 for env in ["s3dc"]:
128 plantestsuite("samba3.blackbox.smbclient_s3.crypt (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', binpath('smbclient3'), configuration, "-e"])
130 #TODO encrypted against member, with member creds, and with DC creds
131 plantestsuite("samba3.blackbox.net.misc", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_net_misc.sh"),
132 scriptdir, "$SMB_CONF_PATH", configuration])
133 plantestsuite("samba3.blackbox.net.local.registry", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_net_registry.sh"),
134 scriptdir, "$SMB_CONF_PATH", configuration])
135 plantestsuite("samba3.blackbox.net.rpc.registry", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_net_registry.sh"),
136 scriptdir, "$SMB_CONF_PATH", configuration, 'rpc'])
138 plantestsuite("samba3.blackbox.net.local.registry.roundtrip", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_net_registry_roundtrip.sh"),
139 scriptdir, "$SMB_CONF_PATH", configuration])
140 plantestsuite("samba3.blackbox.testparm", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_testparm_s3.sh"),
141 "$LOCAL_PATH"])
143 plantestsuite(
144 "samba3.pthreadpool", "s3dc",
145 [os.path.join(samba3srcdir, "script/tests/test_pthreadpool.sh")])
147 #smbtorture4 tests
149 base = ["base.attr", "base.charset", "base.chkpath", "base.defer_open", "base.delaywrite", "base.delete",
150 "base.deny1", "base.deny2", "base.deny3", "base.denydos", "base.dir1", "base.dir2",
151 "base.disconnect", "base.fdpass", "base.lock",
152 "base.mangle", "base.negnowait", "base.ntdeny1",
153 "base.ntdeny2", "base.open", "base.openattr", "base.properties", "base.rename", "base.rw1",
154 "base.secleak", "base.tcon", "base.tcondev", "base.trans2", "base.unlink", "base.vuid",
155 "base.xcopy", "base.samba3error"]
157 raw = ["raw.acls", "raw.chkpath", "raw.close", "raw.composite", "raw.context", "raw.eas",
158 "raw.ioctl", "raw.lock", "raw.mkdir", "raw.mux", "raw.notify", "raw.open", "raw.oplock"
159 "raw.qfileinfo", "raw.qfsinfo", "raw.read", "raw.rename", "raw.search", "raw.seek",
160 "raw.sfileinfo.base", "raw.sfileinfo.bug", "raw.streams", "raw.unlink", "raw.write",
161 "raw.samba3hide", "raw.samba3badpath", "raw.sfileinfo.rename",
162 "raw.samba3caseinsensitive", "raw.samba3posixtimedlock",
163 "raw.samba3rootdirfid", "raw.sfileinfo.end-of-file"]
165 smb2 = ["smb2.lock", "smb2.read", "smb2.compound", "smb2.connect", "smb2.scan", "smb2.scanfind",
166 "smb2.bench-oplock"]
168 rpc = ["rpc.authcontext", "rpc.samba3.bind", "rpc.samba3.srvsvc", "rpc.samba3.sharesec",
169 "rpc.samba3.spoolss", "rpc.samba3.wkssvc", "rpc.samba3.winreg",
170 "rpc.samba3.getaliasmembership-0",
171 "rpc.samba3.netlogon", "rpc.samba3.sessionkey", "rpc.samba3.getusername",
172 "rpc.svcctl", "rpc.ntsvcs", "rpc.winreg", "rpc.eventlog",
173 "rpc.spoolss.printserver", "rpc.spoolss.win", "rpc.spoolss.notify", "rpc.spoolss.printer",
174 "rpc.spoolss.driver",
175 "rpc.lsa-getuser", "rpc.lsa.lookupsids", "rpc.lsa.lookupnames",
176 "rpc.lsa.privileges",
177 "rpc.samr", "rpc.samr.users", "rpc.samr.users.privileges", "rpc.samr.passwords",
178 "rpc.samr.passwords.pwdlastset", "rpc.samr.large-dc", "rpc.samr.machine.auth",
179 "rpc.netlogon.admin",
180 "rpc.schannel", "rpc.schannel2", "rpc.bench-schannel1", "rpc.join", "rpc.bind", "rpc.epmapper"]
182 local = ["local.nss-wrapper", "local.ndr"]
184 winbind = ["winbind.struct", "winbind.wbclient"]
186 rap = ["rap.basic", "rap.rpc", "rap.printing", "rap.sam"]
188 unix = ["unix.info2", "unix.whoami"]
190 nbt = ["nbt.dgram" ]
192 tests= base + raw + smb2 + rpc + unix + local + winbind + rap + nbt
194 sub = subprocess.Popen("%s --version 2> /dev/null" % smb4torture, stdout=subprocess.PIPE, stdin=subprocess.PIPE, shell=True)
195 sub.communicate("")
197 if sub.returncode == 0:
198 for t in tests:
199 if t == "base.delaywrite":
200 plansmbtorturetestsuite(t, "s3dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --maximum-runtime=900')
201 if t == "rap.sam":
202 plansmbtorturetestsuite(t, "s3dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=doscharset=ISO-8859-1')
203 elif t == "unix.whoami":
204 plansmbtorturetestsuite(t, "s3dc", '//$SERVER_IP/tmpguest -U$USERNAME%$PASSWORD')
205 elif t == "raw.samba3posixtimedlock":
206 plansmbtorturetestsuite(t, "s3dc", '//$SERVER_IP/tmpguest -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/s3dc/share')
207 else:
208 plansmbtorturetestsuite(t, "s3dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
210 if t == "raw.chkpath":
211 plansmbtorturetestsuite(t, "s3dc", '//$SERVER_IP/tmpcase -U$USERNAME%$PASSWORD')
213 test = 'rpc.lsa.lookupsids'
214 auth_options = ["", "ntlm", "spnego" ]
215 signseal_options = ["", ",connect", ",sign", ",seal"]
216 smb_options = ["", ",smb2"]
217 endianness_options = ["", ",bigendian"]
218 for z in smb_options:
219 for s in signseal_options:
220 for e in endianness_options:
221 for a in auth_options:
222 binding_string = "ncacn_np:$SERVER[%s%s%s%s]" % (a, s, z, e)
223 options = binding_string + " -U$USERNAME%$PASSWORD"
224 plansmbtorturetestsuite(test, "s3dc", options, 'over ncacn_np with [%s%s%s%s] ' % (a, s, z, e))
226 # We should try more combinations in future, but this is all
227 # the pre-calculated credentials cache supports at the moment
228 e = ""
229 a = ""
230 binding_string = "ncacn_np:$SERVER[%s%s%s%s]" % (a, s, z, e)
231 options = binding_string + " -k yes --krb5-ccache=$PREFIX/ktest/krb5_ccache-2"
232 plansmbtorturetestsuite(test, "ktest", options, 'over kerberos with old ccache ncacn_np with [%s%s%s%s] ' % (a, s, z, e))
234 options = binding_string + " -k yes --krb5-ccache=$PREFIX/ktest/krb5_ccache-3"
235 plansmbtorturetestsuite(test, "ktest", options, 'over kerberos ncacn_np with [%s%s%s%s] ' % (a, s, z, e))
239 for e in endianness_options:
240 for a in auth_options:
241 for s in signseal_options:
242 binding_string = "ncacn_ip_tcp:$SERVER_IP[%s%s%s]" % (a, s, e)
243 options = binding_string + " -U$USERNAME%$PASSWORD"
244 plansmbtorturetestsuite(test, "s3dc", options, 'over ncacn_ip_tcp with [%s%s%s] ' % (a, s, e))