summaryrefslogtreecommitdiff
path: root/source4/scripting/devel
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-11-18 23:56:22 +1100
committerAndrew Tridgell <tridge@samba.org>2010-11-18 23:56:11 +0100
commit58c43f74b9bc2d660f58ccfe912bd3fff7cf672e (patch)
tree6fc5f285a5dff1446191e2c3eb71d391a64a3ee8 /source4/scripting/devel
parent5b3981acb1e0e0ef6832c1147b1ec5b3659c1aa9 (diff)
downloadsamba-58c43f74b9bc2d660f58ccfe912bd3fff7cf672e.tar.gz
samba-58c43f74b9bc2d660f58ccfe912bd3fff7cf672e.tar.bz2
samba-58c43f74b9bc2d660f58ccfe912bd3fff7cf672e.zip
s4-wintest: reliability and usability improvements
- allow for missing VMs - improved VM names - added join of w2k3 to Samba domain - cope with w2k3 dcpromo output - wait for port 139 not 23, to avoid windows telnet server bug Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Thu Nov 18 23:56:11 CET 2010 on sn-devel-104
Diffstat (limited to 'source4/scripting/devel')
-rwxr-xr-xsource4/scripting/devel/wintest/test-howto.py181
-rw-r--r--source4/scripting/devel/wintest/tridge.conf63
-rw-r--r--source4/scripting/devel/wintest/wintest.py38
3 files changed, 166 insertions, 116 deletions
diff --git a/source4/scripting/devel/wintest/test-howto.py b/source4/scripting/devel/wintest/test-howto.py
index 1f70c56cd4..402519fad6 100755
--- a/source4/scripting/devel/wintest/test-howto.py
+++ b/source4/scripting/devel/wintest/test-howto.py
@@ -26,13 +26,16 @@ def build_s4(t):
t.run_cmd('rm -rf ${PREFIX}')
t.run_cmd('make -j install')
-def provision_s4(t):
+def provision_s4(t, func_level="2008", interfaces=None):
'''provision s4 as a DC'''
t.info('Provisioning s4')
t.chdir('${PREFIX}')
t.run_cmd("rm -rf etc private")
t.run_cmd("find var -type f | xargs rm -f")
- t.run_cmd('sbin/provision --realm=${LCREALM} --domain=${DOMAIN} --adminpass=${PASSWORD1} --server-role="domain controller" --function-level=2008 -d${DEBUGLEVEL}')
+ options=' --function-level=%s -d${DEBUGLEVEL}' % func_level
+ if interfaces:
+ options += ' --option=interfaces=%s' % interfaces
+ t.run_cmd('sbin/provision --realm=${LCREALM} --domain=${DOMAIN} --adminpass=${PASSWORD1} --server-role="domain controller"' + options)
t.run_cmd('bin/samba-tool newuser testallowed ${PASSWORD1}')
t.run_cmd('bin/samba-tool newuser testdenied ${PASSWORD1}')
t.run_cmd('bin/samba-tool group addmembers "Allowed RODC Password Replication Group" testallowed')
@@ -44,7 +47,7 @@ def start_s4(t, interfaces=None):
t.run_cmd(['sbin/samba',
'--option', 'panic action=gnome-terminal -e "gdb --pid %PID%"',
'--option', 'interfaces=%s' % interfaces])
- t.port_wait("localhost", 445)
+ t.port_wait("localhost", 139)
def test_smbclient(t):
t.info('Testing smbclient')
@@ -120,26 +123,24 @@ def run_winjoin(t, vm):
t.vm_poweroff("${WIN_VM}", checkfail=False)
t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}")
t.ping_wait("${WIN_HOSTNAME}")
- t.port_wait("${WIN_HOSTNAME}", 23)
child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_USER}", "${WIN_PASS}", set_time=True)
child.sendline("netdom join ${WIN_HOSTNAME} /Domain:${LCREALM} /PasswordD:${PASSWORD1} /UserD:administrator")
child.expect("The command completed successfully")
child.sendline("shutdown /r -t 0")
- t.port_wait("${WIN_HOSTNAME}", 23, wait_for_fail=True)
- t.port_wait("${WIN_HOSTNAME}", 23)
+ t.port_wait("${WIN_HOSTNAME}", 139, wait_for_fail=True)
+ t.port_wait("${WIN_HOSTNAME}", 139)
def test_winjoin(t, vm):
t.setwinvars(vm)
t.info("Checking the windows join is OK")
t.chdir('${PREFIX}')
- t.port_wait("${WIN_HOSTNAME}", 445)
+ t.port_wait("${WIN_HOSTNAME}", 139)
t.retry_cmd('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
t.cmd_contains("host -t A ${WIN_HOSTNAME}.${LCREALM}.", ['has address'])
t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -k no -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -k yes -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
- t.port_wait("${WIN_HOSTNAME}", 23)
child = t.open_telnet("${WIN_HOSTNAME}", "${DOMAIN}\\administrator", "${PASSWORD1}")
child.sendline("net use t: \\\\${HOSTNAME}.${LCREALM}\\test")
child.expect("The command completed successfully")
@@ -154,11 +155,12 @@ def run_dcpromo(t, vm):
t.vm_poweroff("${WIN_VM}", checkfail=False)
t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}")
t.ping_wait("${WIN_HOSTNAME}")
- t.port_wait("${WIN_HOSTNAME}", 23)
child = t.open_telnet("${WIN_HOSTNAME}", "administrator", "${WIN_PASS}")
child.sendline("copy /Y con answers.txt")
child.sendline('''
-[DCInstall]
+[DCINSTALL]
+RebootOnSuccess=Yes
+RebootOnCompletion=Yes
ReplicaOrNewDomain=Replica
ReplicaDomainDNSName=${LCREALM}
SiteName=Default-First-Site-Name
@@ -172,28 +174,27 @@ DatabasePath="C:\Windows\NTDS"
LogPath="C:\Windows\NTDS"
SYSVOLPath="C:\Windows\SYSVOL"
SafeModeAdminPassword=${PASSWORD1}
-RebootOnCompletion=No

''')
child.expect("copied.")
+ child.expect("C:")
+ child.expect("C:")
child.sendline("dcpromo /answer:answers.txt")
- i = child.expect(["You must restart this computer", "failed"], timeout=120)
- if i != 0:
+ i = child.expect(["You must restart this computer", "failed", "C:"], timeout=120)
+ if i == 1:
raise Exception("dcpromo failed")
- child.sendline("shutdown -r -t 0")
- t.port_wait("${WIN_HOSTNAME}", 23, wait_for_fail=True)
- t.port_wait("${WIN_HOSTNAME}", 23)
+ t.port_wait("${WIN_HOSTNAME}", 139, wait_for_fail=True)
+ t.port_wait("${WIN_HOSTNAME}", 139)
def test_dcpromo(t, vm):
t.setwinvars(vm)
t.info("Checking the dcpromo join is OK")
t.chdir('${PREFIX}')
- t.port_wait("${WIN_HOSTNAME}", 445)
+ t.port_wait("${WIN_HOSTNAME}", 139)
t.retry_cmd('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
t.cmd_contains("host -t A ${WIN_HOSTNAME}.${LCREALM}.", ['has address'])
t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
- t.port_wait("${WIN_HOSTNAME}", 23)
t.cmd_contains("bin/samba-tool drs kcc ${HOSTNAME} -Uadministrator@${LCREALM}%${PASSWORD1}", ['Consistency check', 'successful'])
t.cmd_contains("bin/samba-tool drs kcc ${WIN_HOSTNAME} -Uadministrator@${LCREALM}%${PASSWORD1}", ['Consistency check', 'successful'])
@@ -206,28 +207,38 @@ def test_dcpromo(t, vm):
t.cmd_contains("bin/samba-tool drs showrepl ${HOSTNAME} -k yes",
[ "INBOUND NEIGHBORS",
"${BASEDN}",
- "Last attempt", "was successful",
- "CN=Schema,CN=Configuration,${BASEDN}",
- "Last attempt", "was successful",
+ "Last attempt .* was successful",
+ "CN=Configuration,${BASEDN}",
+ "Last attempt .* was successful",
+ "CN=Configuration,${BASEDN}", # cope with either order
+ "Last attempt .* was successful",
"OUTBOUND NEIGHBORS",
"${BASEDN}",
"Last success",
"CN=Configuration,${BASEDN}",
+ "Last success",
+ "CN=Configuration,${BASEDN}",
"Last success"],
- ordered=True)
+ ordered=True,
+ regex=True)
t.cmd_contains("bin/samba-tool drs showrepl ${WIN_HOSTNAME} -k yes",
[ "INBOUND NEIGHBORS",
"${BASEDN}",
- "Last attempt", "was successful",
- "CN=Schema,CN=Configuration,${BASEDN}",
- "Last attempt", "was successful",
+ "Last attempt .* was successful",
+ "CN=Configuration,${BASEDN}",
+ "Last attempt .* was successful",
+ "CN=Configuration,${BASEDN}",
+ "Last attempt .* was successful",
"OUTBOUND NEIGHBORS",
"${BASEDN}",
"Last success",
- "CN=Schema,CN=Configuration,${BASEDN}",
+ "CN=Configuration,${BASEDN}",
+ "Last success",
+ "CN=Configuration,${BASEDN}",
"Last success" ],
- ordered=True)
+ ordered=True,
+ regex=True)
child = t.open_telnet("${WIN_HOSTNAME}", "${DOMAIN}\\administrator", "${PASSWORD1}", set_time=True)
child.sendline("net use t: \\\\${HOSTNAME}.${LCREALM}\\test")
@@ -279,7 +290,6 @@ def run_dcpromo_rodc(t, vm):
t.vm_poweroff("${WIN_VM}", checkfail=False)
t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}")
t.ping_wait("${WIN_HOSTNAME}")
- t.port_wait("${WIN_HOSTNAME}", 23)
child = t.open_telnet("${WIN_HOSTNAME}", "administrator", "${WIN_PASS}")
child.sendline("copy /Y con answers.txt")
child.sendline('''
@@ -313,8 +323,8 @@ RebootOnCompletion=No
if i != 0:
raise Exception("dcpromo failed")
child.sendline("shutdown -r -t 0")
- t.port_wait("${WIN_HOSTNAME}", 23, wait_for_fail=True)
- t.port_wait("${WIN_HOSTNAME}", 23)
+ t.port_wait("${WIN_HOSTNAME}", 139, wait_for_fail=True)
+ t.port_wait("${WIN_HOSTNAME}", 139)
@@ -322,11 +332,10 @@ def test_dcpromo_rodc(t, vm):
t.setwinvars(vm)
t.info("Checking the w2k8 RODC join is OK")
t.chdir('${PREFIX}')
- t.port_wait("${WIN_HOSTNAME}", 445)
+ t.port_wait("${WIN_HOSTNAME}", 139)
t.retry_cmd('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
t.cmd_contains("host -t A ${WIN_HOSTNAME}.${LCREALM}.", ['has address'])
t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
- t.port_wait("${WIN_HOSTNAME}", 23)
child = t.open_telnet("${WIN_HOSTNAME}", "${DOMAIN}\\administrator", "${PASSWORD1}", set_time=True)
child.sendline("net use t: \\\\${HOSTNAME}.${LCREALM}\\test")
child.expect("The command completed successfully")
@@ -337,7 +346,7 @@ def test_dcpromo_rodc(t, vm):
child.expect("was successful")
child.expect("CN=Configuration,${BASEDN}")
child.expect("was successful")
- child.expect("CN=Schema,CN=Configuration,${BASEDN}")
+ child.expect("CN=Configuration,${BASEDN}")
child.expect("was successful")
t.info("Checking if new users are available on windows")
@@ -370,7 +379,6 @@ def test_join_as_dc(t, vm):
t.chdir('${PREFIX}')
t.retry_cmd('bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}', ["C$", "IPC$", "Sharename"])
t.cmd_contains("host -t A ${HOSTNAME}.${WIN_REALM}.", ['has address'])
- t.port_wait("${WIN_HOSTNAME}", 23)
child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True)
t.info("Forcing kcc runs, and replication")
@@ -391,7 +399,7 @@ def test_join_as_dc(t, vm):
child.expect("was successful")
child.expect("CN=Configuration,${WIN_BASEDN}")
child.expect("was successful")
- child.expect("CN=Schema,CN=Configuration,${WIN_BASEDN}")
+ child.expect("CN=Configuration,${WIN_BASEDN}")
child.expect("was successful")
t.info("Checking if new users propogate to windows")
@@ -402,8 +410,8 @@ def test_join_as_dc(t, vm):
t.info("Checking if new users on windows propogate to samba")
child.sendline("net user test3 ${PASSWORD3} /add")
child.expect("The command completed successfully")
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k no", ['Sharename', 'IPC'])
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'IPC'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k no", ['Sharename', 'IPC'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k yes", ['Sharename', 'IPC'])
t.info("Checking propogation of user deletion")
t.run_cmd('bin/samba-tool user delete test2 -Uadministrator@${WIN_REALM}%${WIN_PASS}')
@@ -411,9 +419,9 @@ def test_join_as_dc(t, vm):
child.expect("The command completed successfully")
t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k no", ['LOGON_FAILURE'])
t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE'])
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k yes", ['LOGON_FAILURE'])
t.vm_poweroff("${WIN_VM}")
@@ -438,10 +446,10 @@ def test_join_as_rodc(t, vm):
t.chdir('${PREFIX}')
t.retry_cmd('bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}', ["C$", "IPC$", "Sharename"])
t.cmd_contains("host -t A ${HOSTNAME}.${WIN_REALM}.", ['has address'])
- t.port_wait("${WIN_HOSTNAME}", 23)
child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True)
t.info("Forcing kcc runs, and replication")
+ t.run_cmd('bin/samba-tool drs kcc ${HOSTNAME} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
t.kinit("administrator@${WIN_REALM}", "${WIN_PASS}")
@@ -453,33 +461,36 @@ def test_join_as_rodc(t, vm):
t.info("Checking if showrepl is happy")
child.sendline("repadmin /showrepl")
- child.expect("${WIN_BASEDN}")
- child.expect("was successful")
- child.expect("CN=Configuration,${WIN_BASEDN}")
- child.expect("was successful")
- child.expect("CN=Schema,CN=Configuration,${WIN_BASEDN}")
- child.expect("was successful")
+ child.expect("DSA invocationID")
+
+ t.cmd_contains("bin/samba-tool drs showrepl ${WIN_HOSTNAME}.${WIN_REALM} -k yes",
+ [ "INBOUND NEIGHBORS",
+ "OUTBOUND NEIGHBORS",
+ "${WIN_BASEDN}",
+ "Last attempt .* was successful",
+ "CN=Configuration,${WIN_BASEDN}",
+ "Last attempt .* was successful",
+ "CN=Configuration,${WIN_BASEDN}",
+ "Last attempt .* was successful" ],
+ ordered=True,
+ regex=True)
t.info("Checking if new users on windows propogate to samba")
child.sendline("net user test3 ${PASSWORD3} /add")
child.expect("The command completed successfully")
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k no", ['Sharename', 'IPC'])
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'IPC'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k no", ['Sharename', 'IPC'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k yes", ['Sharename', 'IPC'])
+ # should this work?
t.info("Checking if new users propogate to windows")
- t.run_cmd('bin/samba-tool newuser test2 ${PASSWORD2}')
- t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])
- t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
+ t.cmd_contains('bin/samba-tool newuser test2 ${PASSWORD2}', ['No RID Set DN'])
t.info("Checking propogation of user deletion")
- t.run_cmd('bin/samba-tool user delete test2 -Uadministrator@${WIN_REALM}%${WIN_PASS}')
child.sendline("net user test3 /del")
child.expect("The command completed successfully")
- t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])
- t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE'])
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k no", ['LOGON_FAILURE'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k yes", ['LOGON_FAILURE'])
t.vm_poweroff("${WIN_VM}")
@@ -488,8 +499,12 @@ def test_howto(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_s4(t)
+
if not t.skip("provision"):
provision_s4(t)
@@ -509,49 +524,63 @@ def test_howto(t):
if not t.skip("dyndns"):
test_dyndns(t)
- if not t.skip("windows7"):
+ if t.have_var('WINDOWS7_VM') and not t.skip("windows7"):
run_winjoin(t, "WINDOWS7")
test_winjoin(t, "WINDOWS7")
- if not t.skip("winxp"):
+ if t.have_var('WINXP_VM') and not t.skip("winxp"):
run_winjoin(t, "WINXP")
test_winjoin(t, "WINXP")
- if not t.skip("dcpromo_rodc"):
+ if t.have_var('W2K8R2C_VM') and not t.skip("dcpromo_rodc"):
t.info("Testing w2k8r2 RODC dcpromo")
- run_dcpromo_rodc(t, "WINDOWS_DC2")
- test_dcpromo_rodc(t, "WINDOWS_DC2")
+ run_dcpromo_rodc(t, "W2K8R2C")
+ test_dcpromo_rodc(t, "W2K8R2C")
- if not t.skip("dcpromo_w2k8r2"):
+ if t.have_var('W2K8R2B_VM') and not t.skip("dcpromo_w2k8r2"):
t.info("Testing w2k8r2 dcpromo")
- run_dcpromo(t, "WINDOWS_DC1")
- test_dcpromo(t, "WINDOWS_DC1")
+ run_dcpromo(t, "W2K8R2B")
+ test_dcpromo(t, "W2K8R2B")
- if not t.skip("dcpromo_w2k8"):
+ if t.have_var('W2K8B_VM') and not t.skip("dcpromo_w2k8"):
t.info("Testing w2k8 dcpromo")
- run_dcpromo(t, "WINDOWS_DC5")
- test_dcpromo(t, "WINDOWS_DC5")
+ run_dcpromo(t, "W2K8B")
+ test_dcpromo(t, "W2K8B")
+
+ if t.have_var('W2K3B_VM') and not t.skip("dcpromo_w2k3"):
+ t.info("Testing w2k3 dcpromo")
+ t.info("Changing to 2003 functional level")
+ provision_s4(t, func_level='2003', interfaces='${INTERFACES}')
+ create_shares(t)
+ start_s4(t, interfaces='${INTERFACES}')
+ test_smbclient(t)
+ restart_bind(t)
+ test_dns(t)
+ test_kerberos(t)
+ test_dyndns(t)
+ run_dcpromo(t, "W2K3B")
+ test_dcpromo(t, "W2K3B")
- if not t.skip("join_w2k8r2"):
- join_as_dc(t, "WINDOWS_DC3")
+ if t.have_var('W2K8R2A_VM') and not t.skip("join_w2k8r2"):
+ join_as_dc(t, "W2K8R2A")
create_shares(t)
start_s4(t, interfaces='${INTERFACES}')
test_dyndns(t)
- test_join_as_dc(t, "WINDOWS_DC3")
+ test_join_as_dc(t, "W2K8R2A")
- if not t.skip("join_rodc"):
- join_as_rodc(t, "WINDOWS_DC3")
+ if t.have_var('W2K8R2A_VM') and not t.skip("join_rodc"):
+ join_as_rodc(t, "W2K8R2A")
create_shares(t)
start_s4(t, interfaces='${INTERFACES}')
test_dyndns(t)
- test_join_as_rodc(t, "WINDOWS_DC3")
+ test_join_as_rodc(t, "W2K8R2A")
- if not t.skip("join_w2k3"):
- join_as_dc(t, "WINDOWS_DC4")
+ if t.have_var('W2K3A_VM') and not t.skip("join_w2k3"):
+ join_as_dc(t, "W2K3A")
create_shares(t)
start_s4(t, interfaces='${INTERFACES}')
test_dyndns(t)
- test_join_as_dc(t, "WINDOWS_DC4")
+ test_join_as_dc(t, "W2K3A")
t.info("Howto test: All OK")
diff --git a/source4/scripting/devel/wintest/tridge.conf b/source4/scripting/devel/wintest/tridge.conf
index 17045f66af..12885264f2 100644
--- a/source4/scripting/devel/wintest/tridge.conf
+++ b/source4/scripting/devel/wintest/tridge.conf
@@ -43,39 +43,44 @@ WINXP_SNAPSHOT : howto-test
WINXP_USER : tridge
WINXP_PASS : penguin
+# Samba will join this w2k8r2 VM as a DC and then as a RODC
+W2K8R2A_HOSTNAME : w2k8
+W2K8R2A_VM : w2k8r2
+W2K8R2A_BASEDN : DC=v2,DC=tridgell,DC=net
+W2K8R2A_REALM : v2.tridgell.net
+W2K8R2A_DOMAIN : v2
+W2K8R2A_PASS : p@ssw0rd5
+W2K8R2A_SNAPSHOT : howto-test
+
# this w2k8r2 VM will become a DC in the samba domain
-WINDOWS_DC1_HOSTNAME : w2k8r2b
-WINDOWS_DC1_VM : w2k8r2b
-WINDOWS_DC1_PASS : p@ssw0rd
-WINDOWS_DC1_SNAPSHOT : howto-test2
+W2K8R2B_HOSTNAME : w2k8r2b
+W2K8R2B_VM : w2k8r2b
+W2K8R2B_PASS : p@ssw0rd
+W2K8R2B_SNAPSHOT : howto-test2
# this w2k8r2 VM will become a RODC in the samba domain
-WINDOWS_DC2_HOSTNAME : w2k8r2c
-WINDOWS_DC2_VM : w2k8r2c
-WINDOWS_DC2_PASS : p@ssw0rd
-WINDOWS_DC2_SNAPSHOT : howto-test2
+W2K8R2C_HOSTNAME : w2k8r2c
+W2K8R2C_VM : w2k8r2c
+W2K8R2C_PASS : p@ssw0rd
+W2K8R2C_SNAPSHOT : howto-test2
-# Samba will join this VM as a DC
-WINDOWS_DC3_HOSTNAME : w2k8
-WINDOWS_DC3_VM : w2k8r2
-WINDOWS_DC3_BASEDN : DC=v2,DC=tridgell,DC=net
-WINDOWS_DC3_REALM : v2.tridgell.net
-WINDOWS_DC3_DOMAIN : v2
-WINDOWS_DC3_PASS : p@ssw0rd5
-WINDOWS_DC3_SNAPSHOT : howto-test
+# Samba will join this w2k3 VM as a DC
+W2K3A_HOSTNAME : w2k3
+W2K3A_VM : w2003
+W2K3A_BASEDN : DC=vsofs3,DC=com
+W2K3A_REALM : vsofs3.com
+W2K3A_DOMAIN : vsofs3
+W2K3A_PASS : penguin
+W2K3A_SNAPSHOT : howto-test
-# Samba will join this w2k3 box as a DC
-WINDOWS_DC4_HOSTNAME : w2k3
-WINDOWS_DC4_VM : w2003
-WINDOWS_DC4_BASEDN : DC=vsofs3,DC=com
-WINDOWS_DC4_REALM : vsofs3.com
-WINDOWS_DC4_DOMAIN : vsofs3
-WINDOWS_DC4_PASS : penguin
-WINDOWS_DC4_SNAPSHOT : howto-test
+# this w2k3 VM will become a DC in the samba domain
+W2K3B_HOSTNAME : w2k3b
+W2K3B_VM : w2k3b
+W2K3B_PASS : penguin
+W2K3B_SNAPSHOT : howto-test
# this w2k8 VM will become a DC in the samba domain
-WINDOWS_DC5_HOSTNAME : w2k8c
-WINDOWS_DC5_VM : w2k8
-WINDOWS_DC5_PASS : p@ssw0rd
-WINDOWS_DC5_SNAPSHOT : howto-test
-
+W2K8B_HOSTNAME : w2k8c
+W2K8B_VM : w2k8
+W2K8B_PASS : p@ssw0rd
+W2K8B_SNAPSHOT : howto-test
diff --git a/source4/scripting/devel/wintest/wintest.py b/source4/scripting/devel/wintest/wintest.py
index 573684ce1b..f871462fba 100644
--- a/source4/scripting/devel/wintest/wintest.py
+++ b/source4/scripting/devel/wintest/wintest.py
@@ -3,7 +3,7 @@
'''automated testing library for testing Samba against windows'''
import pexpect, subprocess
-import sys, os, time
+import sys, os, time, re
class wintest():
'''testing of Samba against windows VMs'''
@@ -83,6 +83,11 @@ class wintest():
text = text.replace("${%s}" % var_name, self.vars[var_name])
return text
+ def have_var(self, varname):
+ '''see if a variable has been set'''
+ return varname in self.vars
+
+
def putenv(self, key, value):
'''putenv with substitution'''
os.putenv(key, self.substitute(value))
@@ -115,27 +120,38 @@ class wintest():
cmd = self.substitute(cmd)
return self.run_cmd(cmd, output=True)
- def cmd_contains(self, cmd, contains, nomatch=False, ordered=False):
+ def cmd_contains(self, cmd, contains, nomatch=False, ordered=False, regex=False):
'''check that command output contains the listed strings'''
out = self.cmd_output(cmd)
self.info(out)
for c in self.substitute(contains):
- ofs = out.find(c)
+ if regex:
+ m = re.search(c, out)
+ if m is None:
+ start = -1
+ end = -1
+ else:
+ start = m.start()
+ end = m.end()
+ else:
+ start = out.find(c)
+ end = start + len(c)
if nomatch:
- if ofs != -1:
+ if start != -1:
raise RuntimeError("Expected to not see %s in %s" % (c, cmd))
else:
- if ofs == -1:
+ if start == -1:
raise RuntimeError("Expected to see %s in %s" % (c, cmd))
- if ordered and ofs != -1:
- ofs += len(c)
- out = out[ofs:]
+ if ordered and start != -1:
+ out = out[end:]
- def retry_cmd(self, cmd, contains, retries=30, delay=2, wait_for_fail=False):
+ def retry_cmd(self, cmd, contains, retries=30, delay=2, wait_for_fail=False,
+ ordered=False, regex=False):
'''retry a command a number of times'''
while retries > 0:
try:
- self.cmd_contains(cmd, contains, nomatch=wait_for_fail)
+ self.cmd_contains(cmd, contains, nomatch=wait_for_fail,
+ ordered=ordered, regex=regex)
return
except:
time.sleep(delay)
@@ -214,7 +230,7 @@ class wintest():
child.expect("C:")
- def open_telnet(self, hostname, username, password, retries=30, delay=3, set_time=False):
+ def open_telnet(self, hostname, username, password, retries=60, delay=5, set_time=False):
'''open a telnet connection to a windows server, return the pexpect child'''
while retries > 0:
child = self.pexpect_spawn("telnet " + hostname + " -l '" + username + "'")