summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xwintest/test-s3.py49
-rwxr-xr-xwintest/test-s4-howto.py52
-rw-r--r--wintest/wintest.py47
3 files changed, 60 insertions, 88 deletions
diff --git a/wintest/test-s3.py b/wintest/test-s3.py
index 9241ecb52a..6bb196b970 100755
--- a/wintest/test-s3.py
+++ b/wintest/test-s3.py
@@ -26,7 +26,7 @@ def build_s3(t):
t.run_cmd('rm -rf ${PREFIX}')
t.run_cmd('make install')
-def start_s3(t, interfaces=None):
+def start_s3(t):
t.info('Starting Samba3')
t.chdir("${PREFIX}")
t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False)
@@ -36,6 +36,7 @@ def start_s3(t, interfaces=None):
t.run_cmd(['sbin/smbd', "-D"])
t.port_wait("localhost", 139)
+
def test_wbinfo(t):
t.info('Testing wbinfo')
t.chdir('${PREFIX}')
@@ -115,7 +116,7 @@ def join_as_member(t, vm):
realm = ${WIN_REALM}
workgroup = ${WIN_DOMAIN}
security = ADS
- interfaces = ${INTERFACES}
+ interfaces = ${INTERFACE}
winbind separator = /
idmap uid = 1000000-2000000
idmap gid = 1000000-2000000
@@ -136,7 +137,7 @@ def test_join_as_member(t, vm):
t.setwinvars(vm)
t.info('Testing join as member')
t.chdir('${PREFIX}')
- t.cmd_contains('bin/net ads user add root -Uadministrator%${WIN_PASS}')
+ t.run_cmd('bin/net ads user add root -Uadministrator%${WIN_PASS}')
test_wbinfo(t)
test_smbclient(t)
@@ -146,57 +147,21 @@ def test_s3(t):
check_prerequesites(t)
- # we don't need fsync safety in these tests
- t.putenv('TDB_NO_FSYNC', '1')
-
if not t.skip("build"):
build_s3(t)
if t.have_var('W2K8R2A_VM') and not t.skip("join_w2k8r2"):
join_as_member(t, "W2K8R2A")
create_shares(t)
- start_s3(t, interfaces='${INTERFACES}')
+ start_s3(t)
test_join_as_member(t, "W2K8R2A")
t.info("S3 test: All OK")
-if __name__ == '__main__':
- parser = optparse.OptionParser("test-howto.py")
- parser.add_option("--conf", type='string', default='', help='config file')
- parser.add_option("--skip", type='string', default='', help='list of steps to skip (comma separated)')
- parser.add_option("--list", action='store_true', default=False, help='list the available steps')
- parser.add_option("--rebase", action='store_true', default=False, help='do a git pull --rebase')
- parser.add_option("--clean", action='store_true', default=False, help='clean the tree')
- parser.add_option("--prefix", type='string', default=None, help='override install prefix')
- parser.add_option("--sourcetree", type='string', default=None, help='override sourcetree location')
-
- opts, args = parser.parse_args()
-
- if not opts.conf:
- print("Please specify a config file with --conf")
- sys.exit(1)
+if __name__ == '__main__':
t = wintest.wintest()
- t.load_config(opts.conf)
- t.set_skip(opts.skip)
-
- if opts.list:
- t.list_steps_mode()
-
- if opts.prefix:
- t.setvar('PREFIX', opts.prefix)
-
- if opts.sourcetree:
- t.setvar('SOURCETREE', opts.sourcetree)
-
- if opts.rebase:
- t.info('rebasing')
- t.chdir('${SOURCETREE}')
- t.run_cmd('git pull --rebase')
- if opts.clean:
- t.info('rebasing')
- t.chdir('${SOURCETREE}/source3')
- t.run_cmd('make clean')
+ t.setup("test-s3.py", "source3")
test_s3(t)
diff --git a/wintest/test-s4-howto.py b/wintest/test-s4-howto.py
index 840901b379..5aa2e79d13 100755
--- a/wintest/test-s4-howto.py
+++ b/wintest/test-s4-howto.py
@@ -3,7 +3,6 @@
'''automated testing of the steps of the Samba4 HOWTO'''
import sys, os
-import optparse
import wintest, pexpect, time
def check_prerequesites(t):
@@ -134,6 +133,7 @@ def rndc_cmd(t, cmd, checkfail=True):
'''run a rndc command'''
t.run_cmd("${RNDC} -c ${PREFIX}/etc/rndc.conf %s" % cmd, checkfail=checkfail)
+
def configure_bind(t):
t.chdir('${PREFIX}')
@@ -159,8 +159,7 @@ options {
memstatistics-file "${PREFIX}/var/named/data/named_mem_stats.txt";
allow-query { any; };
recursion yes;
- tkey-gssapi-credential "DNS/${HOSTNAME}.${LCREALM}";
- tkey-domain "${REALM}";
+ tkey-gssapi-keytab "${PREFIX}/private/dns.keytab";
max-cache-ttl 10;
max-ncache-ttl 10;
@@ -228,8 +227,6 @@ def stop_bind(t):
def start_bind(t):
'''restart the test environment version of bind'''
t.info("Restarting bind9")
- t.putenv('KEYTAB_FILE', '${PREFIX}/private/dns.keytab')
- t.putenv('KRB5_KTNAME', '${PREFIX}/private/dns.keytab')
t.chdir('${PREFIX}')
set_nameserver(t, t.getvar('INTERFACE_IP'))
@@ -738,6 +735,7 @@ RebootOnCompletion=No
t.port_wait("${WIN_IP}", 139, wait_for_fail=True)
t.port_wait("${WIN_IP}", 139)
+
def test_howto(t):
'''test the Samba4 howto'''
@@ -853,55 +851,17 @@ def test_cleanup(t):
if __name__ == '__main__':
- parser = optparse.OptionParser("test-howto.py")
- parser.add_option("--conf", type='string', default='', help='config file')
- parser.add_option("--skip", type='string', default='', help='list of steps to skip (comma separated)')
- parser.add_option("--vms", type='string', default=None, help='list of VMs to use (comma separated)')
- parser.add_option("--list", action='store_true', default=False, help='list the available steps')
- parser.add_option("--rebase", action='store_true', default=False, help='do a git pull --rebase')
- parser.add_option("--clean", action='store_true', default=False, help='clean the tree')
- parser.add_option("--prefix", type='string', default=None, help='override install prefix')
- parser.add_option("--sourcetree", type='string', default=None, help='override sourcetree location')
- parser.add_option("--nocleanup", action='store_true', default=False, help='disable cleanup code')
-
- opts, args = parser.parse_args()
-
- if not opts.conf:
- print("Please specify a config file with --conf")
- sys.exit(1)
-
t = wintest.wintest()
- t.load_config(opts.conf)
-
- t.set_skip(opts.skip)
- t.set_vms(opts.vms)
-
- if opts.list:
- t.list_steps_mode()
-
- if opts.prefix:
- t.setvar('PREFIX', opts.prefix)
-
- if opts.sourcetree:
- t.setvar('SOURCETREE', opts.sourcetree)
-
- if opts.rebase:
- t.info('rebasing')
- t.chdir('${SOURCETREE}')
- t.run_cmd('git pull --rebase')
- if opts.clean:
- t.info('rebasing')
- t.chdir('${SOURCETREE}/source4')
- t.run_cmd('rm -rf bin')
+ t.setup("test-s4-howto.py", "source4")
try:
test_howto(t)
except:
- if not opts.nocleanup:
+ if not t.opts.nocleanup:
test_cleanup(t)
raise
- if not opts.nocleanup:
+ if not t.opts.nocleanup:
test_cleanup(t)
t.info("S4 howto test: All OK")
diff --git a/wintest/wintest.py b/wintest/wintest.py
index b8e6ea2dd1..ec2624bde5 100644
--- a/wintest/wintest.py
+++ b/wintest/wintest.py
@@ -3,6 +3,7 @@
'''automated testing library for testing Samba against windows'''
import pexpect, subprocess
+import optparse
import sys, os, time, re
class wintest():
@@ -13,6 +14,7 @@ class wintest():
self.list_mode = False
self.vms = None
os.putenv('PYTHONUNBUFFERED', '1')
+ self.parser = optparse.OptionParser("wintest")
def setvar(self, varname, value):
'''set a substitution variable'''
@@ -553,3 +555,48 @@ class wintest():
if v[-3:] == "_VM":
ret.append(self.vars[v])
return ret
+
+ def setup(self, testname, subdir):
+ '''setup for main tests, parsing command line'''
+ self.parser.add_option("--conf", type='string', default='', help='config file')
+ self.parser.add_option("--skip", type='string', default='', help='list of steps to skip (comma separated)')
+ self.parser.add_option("--vms", type='string', default=None, help='list of VMs to use (comma separated)')
+ self.parser.add_option("--list", action='store_true', default=False, help='list the available steps')
+ self.parser.add_option("--rebase", action='store_true', default=False, help='do a git pull --rebase')
+ self.parser.add_option("--clean", action='store_true', default=False, help='clean the tree')
+ self.parser.add_option("--prefix", type='string', default=None, help='override install prefix')
+ self.parser.add_option("--sourcetree", type='string', default=None, help='override sourcetree location')
+ self.parser.add_option("--nocleanup", action='store_true', default=False, help='disable cleanup code')
+
+ self.opts, self.args = self.parser.parse_args()
+
+ if not self.opts.conf:
+ print("Please specify a config file with --conf")
+ sys.exit(1)
+
+ # we don't need fsync safety in these tests
+ self.putenv('TDB_NO_FSYNC', '1')
+
+ self.load_config(self.opts.conf)
+
+ self.set_skip(self.opts.skip)
+ self.set_vms(self.opts.vms)
+
+ if self.opts.list:
+ self.list_steps_mode()
+
+ if self.opts.prefix:
+ self.setvar('PREFIX', self.opts.prefix)
+
+ if self.opts.sourcetree:
+ self.setvar('SOURCETREE', self.opts.sourcetree)
+
+ if self.opts.rebase:
+ self.info('rebasing')
+ self.chdir('${SOURCETREE}')
+ self.run_cmd('git pull --rebase')
+
+ if self.opts.clean:
+ self.info('cleaning')
+ self.chdir('${SOURCETREE}/' + subdir)
+ self.run_cmd('make clean')