ia64/xen-unstable

changeset 8068:9981fa5ba62b

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@xensource.com>
author emellor@leeni.uk.xensource.com
date Sat Nov 26 01:08:26 2005 +0000 (2005-11-26)
parents f710753a4026
children 3c21a174e8fc
files tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py
line diff
     1.1 --- a/tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py	Sat Nov 26 00:38:45 2005 +0000
     1.2 +++ b/tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py	Sat Nov 26 01:08:26 2005 +0000
     1.3 @@ -30,7 +30,7 @@ if s != 0:
     1.4  s, o = traceCommand("xm block-list %s" % domain.getName())
     1.5  if s != 0:
     1.6      FAIL("block-list failed")
     1.7 -if not o.find("769"):
     1.8 +if o.find("769") == -1:
     1.9      FAIL("block-list didn't show the block device I just attached!")
    1.10  
    1.11  s, o = traceCommand("xm block-attach %s phy:/dev/ram1 hda2 w" % domain.getName())
    1.12 @@ -40,25 +40,31 @@ if s != 0:
    1.13  s, o = traceCommand("xm block-list %s" % domain.getName())
    1.14  if s != 0:
    1.15      FAIL("block-list failed")
    1.16 -if not o.find("770"):
    1.17 +if o.find("770") == -1:
    1.18      FAIL("block-list didn't show the other block device I just attached!")
    1.19  
    1.20  s, o = traceCommand("xm block-detach %s 769" % domain.getName())
    1.21  if s != 0:
    1.22 -    FAIL("block-destroy of hda1 failed")
    1.23 +    FAIL("block-detach of hda1 failed")
    1.24  
    1.25 +time.sleep(1)
    1.26  s, o = traceCommand("xm block-list %s" % domain.getName())
    1.27  if s != 0:
    1.28      FAIL("block-list failed after detaching a device")
    1.29 -if o.find("769"):
    1.30 +if o.find("769") != -1:
    1.31      FAIL("hda1 still shown in block-list after detach!")
    1.32 -if not o.find("770"):
    1.33 +if o.find("770") == -1:
    1.34      FAIL("hda2 not shown after detach of hda1!")
    1.35  
    1.36  s, o = traceCommand("xm block-detach %s 770" % domain.getName())
    1.37  if s != 0:
    1.38 +    FAIL("block-detach of hda2 failed")
    1.39 +
    1.40 +time.sleep(1)
    1.41 +s, o = traceCommand("xm block-list %s" % domain.getName())
    1.42 +if s != 0:
    1.43      FAIL("block-list failed after detaching another device")
    1.44 -if o.find("770"):
    1.45 +if o.find("770") != -1:
    1.46      FAIL("hda2 still shown in block-list after detach!")
    1.47  if o:
    1.48      FAIL("block-list still shows something after all devices detached!")