[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Fix the 06_block-list_checkremove test. The use of string.find was invalid



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 9981fa5ba62b97bb0e08b24a4559f7ef79ba5b9a
# Parent  f710753a40268902774c205bd45a7bd22ee78dfa
Fix the 06_block-list_checkremove test.  The use of string.find was invalid
(should be testing against -1, not merely using if or if not), one block-list
command was missing, and the block-detach command is asynchronous (to give the
domain time to close down the device) so we need a time.sleep(1) call before
trying xm block-list.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r f710753a4026 -r 9981fa5ba62b 
tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py
--- a/tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py   Sat Nov 
26 00:38:45 2005
+++ b/tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py   Sat Nov 
26 01:08:26 2005
@@ -30,7 +30,7 @@
 s, o = traceCommand("xm block-list %s" % domain.getName())
 if s != 0:
     FAIL("block-list failed")
-if not o.find("769"):
+if o.find("769") == -1:
     FAIL("block-list didn't show the block device I just attached!")
 
 s, o = traceCommand("xm block-attach %s phy:/dev/ram1 hda2 w" % 
domain.getName())
@@ -40,25 +40,31 @@
 s, o = traceCommand("xm block-list %s" % domain.getName())
 if s != 0:
     FAIL("block-list failed")
-if not o.find("770"):
+if o.find("770") == -1:
     FAIL("block-list didn't show the other block device I just attached!")
 
 s, o = traceCommand("xm block-detach %s 769" % domain.getName())
 if s != 0:
-    FAIL("block-destroy of hda1 failed")
+    FAIL("block-detach of hda1 failed")
 
+time.sleep(1)
 s, o = traceCommand("xm block-list %s" % domain.getName())
 if s != 0:
     FAIL("block-list failed after detaching a device")
-if o.find("769"):
+if o.find("769") != -1:
     FAIL("hda1 still shown in block-list after detach!")
-if not o.find("770"):
+if o.find("770") == -1:
     FAIL("hda2 not shown after detach of hda1!")
 
 s, o = traceCommand("xm block-detach %s 770" % domain.getName())
 if s != 0:
+    FAIL("block-detach of hda2 failed")
+
+time.sleep(1)
+s, o = traceCommand("xm block-list %s" % domain.getName())
+if s != 0:
     FAIL("block-list failed after detaching another device")
-if o.find("770"):
+if o.find("770") != -1:
     FAIL("hda2 still shown in block-list after detach!")
 if o:
     FAIL("block-list still shows something after all devices detached!")

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.