summaryrefslogtreecommitdiff
path: root/wintest
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-11-30 11:55:32 +1100
committerAndrew Tridgell <tridge@samba.org>2010-12-01 16:09:58 +1100
commit7ecf6b245113ada9d1c572b059e61db2b61e23cd (patch)
tree88d19a6bd965eabf66d5af5719c41258b2eca6de /wintest
parentb5bab49dc965bbda2dc5a8a2608b34808d7dfae8 (diff)
downloadsamba-7ecf6b245113ada9d1c572b059e61db2b61e23cd.tar.gz
wintest Add a function to shut down all the managed VMs at the start
This helps ensure that old virtual machines don't interfer with a new test run. Andrew Bartlett
Diffstat (limited to 'wintest')
-rwxr-xr-xwintest/test-s4-howto.py9
-rw-r--r--wintest/wintest.py8
2 files changed, 17 insertions, 0 deletions
diff --git a/wintest/test-s4-howto.py b/wintest/test-s4-howto.py
index 48634da7bb1..800f22eb5de 100755
--- a/wintest/test-s4-howto.py
+++ b/wintest/test-s4-howto.py
@@ -63,6 +63,13 @@ def start_s4(t):
'--option', 'panic action=gnome-terminal -e "gdb --pid %PID%"'])
t.port_wait("${INTERFACE_IP}", 139)
+def stop_vms(t):
+ '''Shut down any existing alive VMs, so they don't collide with what we are doing'''
+ t.info('Shutting down any of our VMs already running')
+ vms = t.get_vms()
+ for v in vms:
+ t.vm_poweroff(v, checkfail=False)
+
def test_smbclient(t):
'''test smbclient'''
t.info('Testing smbclient')
@@ -717,6 +724,8 @@ def test_howto(t):
if not t.skip("starts4"):
start_s4(t)
+ if not t.skip("stop_vms"):
+ stop_vms(t)
if not t.skip("smbclient"):
test_smbclient(t)
if not t.skip("startbind"):
diff --git a/wintest/wintest.py b/wintest/wintest.py
index e295c52f9fc..dce2ac874aa 100644
--- a/wintest/wintest.py
+++ b/wintest/wintest.py
@@ -518,3 +518,11 @@ class wintest():
self.vm_reset("${WIN_VM}")
self.info("retrying reboot (retries=%u)" % retries)
raise RuntimeError(self.substitute("VM ${WIN_VM} failed to reboot"))
+
+ def get_vms(self):
+ '''return a dictionary of all the configured VM names'''
+ ret = []
+ for v in self.vars:
+ if v[-3:] == "_VM":
+ ret.append(self.vars[v])
+ return ret