s3:smb2_lock: return RANGE_NOT_LOCKED instead of CANCELLED for logoff and tdis
[Samba.git] / selftest / client.py
blob81a98895ec17af9e8b5cbc48e295d4d51ac84fb1
1 #!/usr/bin/python -u
2 # Bootstrap Samba and run a number of tests against it.
3 # Copyright (C) 2012 Jelmer Vernooij <jelmer@samba.org>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 import os
19 import shutil
21 def write_clientconf(conffile, clientdir, vars):
22 if not os.path.isdir(clientdir):
23 os.mkdir(clientdir, 0777)
25 for n in ["private", "lockdir", "statedir", "cachedir"]:
26 p = os.path.join(clientdir, n)
27 if os.path.isdir(p):
28 shutil.rmtree(p)
29 os.mkdir(p, 0777)
31 # this is ugly, but the ncalrpcdir needs exactly 0755
32 # otherwise tests fail.
33 mask = os.umask(0022)
35 for n in ["ncalrpcdir", "ncalrpcdir/np"]:
36 p = os.path.join(clientdir, n)
37 if os.path.isdir(p):
38 shutil.rmtree(p)
39 os.mkdir(p, 0777)
40 os.umask(mask)
42 settings = {
43 "netbios name": "client",
44 "private dir": os.path.join(clientdir, "private"),
45 "lock dir": os.path.join(clientdir, "lockdir"),
46 "state directory": os.path.join(clientdir, "statedir"),
47 "cache directory": os.path.join(clientdir, "cachedir"),
48 "ncalrpc dir": os.path.join(clientdir, "ncalrpcdir"),
49 "name resolve order": "file bcast",
50 "panic action": os.path.join(os.path.dirname(__file__), "gdb_backtrace \%d"),
51 "max xmit": "32K",
52 "notify:inotify": "false",
53 "ldb:nosync": "true",
54 "system:anonymous": "true",
55 "client lanman auth": "Yes",
56 "log level": "1",
57 "torture:basedir": clientdir,
58 # We don't want to pass our self-tests if the PAC code is wrong
59 "gensec:require_pac": "true",
60 "resolv:host file": os.path.join(prefix_abs, "dns_host_file"),
61 # We don't want to run 'speed' tests for very long
62 "torture:timelimit": "1",
65 if "DOMAIN" in vars:
66 settings["workgroup"] = vars["DOMAIN"]
67 if "REALM" in vars:
68 settings["realm"] = vars["REALM"]
69 if opts.socket_wrapper:
70 settings["interfaces"] = interfaces
72 f = open(conffile, 'w')
73 try:
74 f.write("[global]\n")
75 for item in settings.iteritems():
76 f.write("\t%s = %s\n" % item)
77 finally:
78 f.close()