summaryrefslogtreecommitdiff
path: root/selftest
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-03-05 03:45:57 +0100
committerJelmer Vernooij <jelmer@samba.org>2012-03-05 03:45:57 +0100
commita6a84566466a59fc954268ebd616ef1af4b347b1 (patch)
treea6938525d475bc9decabec5359cac215df2507c1 /selftest
parentf3f6b8eafa07b8d9e815e023adb8825ce89ef8da (diff)
downloadsamba-a6a84566466a59fc954268ebd616ef1af4b347b1.tar.gz
samba-a6a84566466a59fc954268ebd616ef1af4b347b1.tar.bz2
samba-a6a84566466a59fc954268ebd616ef1af4b347b1.zip
selfclient.client: Factor out write_clientconf.
Diffstat (limited to 'selftest')
-rw-r--r--selftest/client.py80
-rwxr-xr-xselftest/selftest.py65
2 files changed, 83 insertions, 62 deletions
diff --git a/selftest/client.py b/selftest/client.py
new file mode 100644
index 0000000000..81a98895ec
--- /dev/null
+++ b/selftest/client.py
@@ -0,0 +1,80 @@
+#!/usr/bin/python -u
+# Bootstrap Samba and run a number of tests against it.
+# Copyright (C) 2012 Jelmer Vernooij <jelmer@samba.org>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import shutil
+
+def write_clientconf(conffile, clientdir, vars):
+ if not os.path.isdir(clientdir):
+ os.mkdir(clientdir, 0777)
+
+ for n in ["private", "lockdir", "statedir", "cachedir"]:
+ p = os.path.join(clientdir, n)
+ if os.path.isdir(p):
+ shutil.rmtree(p)
+ os.mkdir(p, 0777)
+
+ # this is ugly, but the ncalrpcdir needs exactly 0755
+ # otherwise tests fail.
+ mask = os.umask(0022)
+
+ for n in ["ncalrpcdir", "ncalrpcdir/np"]:
+ p = os.path.join(clientdir, n)
+ if os.path.isdir(p):
+ shutil.rmtree(p)
+ os.mkdir(p, 0777)
+ os.umask(mask)
+
+ settings = {
+ "netbios name": "client",
+ "private dir": os.path.join(clientdir, "private"),
+ "lock dir": os.path.join(clientdir, "lockdir"),
+ "state directory": os.path.join(clientdir, "statedir"),
+ "cache directory": os.path.join(clientdir, "cachedir"),
+ "ncalrpc dir": os.path.join(clientdir, "ncalrpcdir"),
+ "name resolve order": "file bcast",
+ "panic action": os.path.join(os.path.dirname(__file__), "gdb_backtrace \%d"),
+ "max xmit": "32K",
+ "notify:inotify": "false",
+ "ldb:nosync": "true",
+ "system:anonymous": "true",
+ "client lanman auth": "Yes",
+ "log level": "1",
+ "torture:basedir": clientdir,
+ # We don't want to pass our self-tests if the PAC code is wrong
+ "gensec:require_pac": "true",
+ "resolv:host file": os.path.join(prefix_abs, "dns_host_file"),
+ # We don't want to run 'speed' tests for very long
+ "torture:timelimit": "1",
+ }
+
+ if "DOMAIN" in vars:
+ settings["workgroup"] = vars["DOMAIN"]
+ if "REALM" in vars:
+ settings["realm"] = vars["REALM"]
+ if opts.socket_wrapper:
+ settings["interfaces"] = interfaces
+
+ f = open(conffile, 'w')
+ try:
+ f.write("[global]\n")
+ for item in settings.iteritems():
+ f.write("\t%s = %s\n" % item)
+ finally:
+ f.close()
+
+
diff --git a/selftest/selftest.py b/selftest/selftest.py
index 5b23be265d..893ff4cfaa 100755
--- a/selftest/selftest.py
+++ b/selftest/selftest.py
@@ -23,7 +23,6 @@ import iso8601
import os
import sys
import signal
-import shutil
import subprocess
import subunit
import traceback
@@ -38,6 +37,7 @@ from selftest import (
subunithelper,
testlist,
)
+from selftest.client import write_clientconf
from selftest.run import (
expand_environment_strings,
expand_command_list,
@@ -323,65 +323,6 @@ clientdir = os.path.join(prefix_abs, "client")
conffile = os.path.join(clientdir, "client.conf")
os.environ["SMB_CONF_PATH"] = conffile
-def write_clientconf(conffile, clientdir, vars):
- if not os.path.isdir(clientdir):
- os.mkdir(clientdir, 0777)
-
- for n in ["private", "lockdir", "statedir", "cachedir"]:
- p = os.path.join(clientdir, n)
- if os.path.isdir(p):
- shutil.rmtree(p)
- os.mkdir(p, 0777)
-
- # this is ugly, but the ncalrpcdir needs exactly 0755
- # otherwise tests fail.
- mask = os.umask(0022)
-
- for n in ["ncalrpcdir", "ncalrpcdir/np"]:
- p = os.path.join(clientdir, n)
- if os.path.isdir(p):
- shutil.rmtree(p)
- os.mkdir(p, 0777)
- os.umask(mask)
-
- settings = {
- "netbios name": "client",
- "private dir": os.path.join(clientdir, "private"),
- "lock dir": os.path.join(clientdir, "lockdir"),
- "state directory": os.path.join(clientdir, "statedir"),
- "cache directory": os.path.join(clientdir, "cachedir"),
- "ncalrpc dir": os.path.join(clientdir, "ncalrpcdir"),
- "name resolve order": "file bcast",
- "panic action": os.path.join(os.path.dirname(__file__), "gdb_backtrace \%d"),
- "max xmit": "32K",
- "notify:inotify": "false",
- "ldb:nosync": "true",
- "system:anonymous": "true",
- "client lanman auth": "Yes",
- "log level": "1",
- "torture:basedir": clientdir,
- # We don't want to pass our self-tests if the PAC code is wrong
- "gensec:require_pac": "true",
- "resolv:host file": os.path.join(prefix_abs, "dns_host_file"),
- # We don't want to run 'speed' tests for very long
- "torture:timelimit": "1",
- }
-
- if "DOMAIN" in vars:
- settings["workgroup"] = vars["DOMAIN"]
- if "REALM" in vars:
- settings["realm"] = vars["REALM"]
- if opts.socket_wrapper:
- settings["interfaces"] = interfaces
-
- f = open(conffile, 'w')
- try:
- f.write("[global]\n")
- for item in settings.iteritems():
- f.write("\t%s = %s\n" % item)
- finally:
- f.close()
-
todo = []
if not opts.testlist:
@@ -415,7 +356,8 @@ for fn in opts.testlist:
if not testlist.should_run_test(tests, testsuite):
continue
name = testsuite[0]
- if includes is not None and testlist.find_in_list(includes, name) is not None:
+ if (includes is not None and
+ testlist.find_in_list(includes, name) is not None):
continue
available.append(testsuite)
finally:
@@ -426,7 +368,6 @@ if opts.load_list:
else:
restricted_mgr = None
-
for testsuite in available:
name = testsuite[0]
skipreason = skip(name)