ia64/xen-unstable

changeset 8171:36f09499bd8c

Add test for the last unresolved bit of bug #416. Check that
"xm list --long" reflects removed devices.
author dan@localhost.localdomain
date Thu Dec 01 11:15:31 2005 +0000 (2005-12-01)
parents c55ac1858bbc
children 43582de050c6
files tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py tools/xm-test/tests/block-destroy/Makefile.am
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py	Thu Dec 01 11:15:31 2005 +0000
     1.3 @@ -0,0 +1,58 @@
     1.4 +#!/usr/bin/python
     1.5 +
     1.6 +# Copyright (C) International Business Machines Corp., 2005
     1.7 +# Author: Dan Smith <danms@us.ibm.com>
     1.8 +
     1.9 +from XmTestLib import *
    1.10 +
    1.11 +import time
    1.12 +import re
    1.13 +
    1.14 +def checkBlockList(domain):
    1.15 +    s, o = traceCommand("xm block-list %s" % domain.getName())
    1.16 +    if s != 0:
    1.17 +        FAIL("block-list failed")
    1.18 +    if re.search("769", o):
    1.19 +        return True
    1.20 +    else:
    1.21 +        return False
    1.22 +
    1.23 +def checkXmLongList(domain):
    1.24 +    s, o = traceCommand("xm list --long %s" % domain.getName())
    1.25 +    if s != 0:
    1.26 +        FAIL("xm list --long <dom> failed")
    1.27 +    if re.search("hda1", o):
    1.28 +        return True
    1.29 +    else:
    1.30 +        return False
    1.31 +
    1.32 +domain = XmTestDomain()
    1.33 +
    1.34 +try:
    1.35 +    domain.start()
    1.36 +except DomainError,e:
    1.37 +    FAIL(str(e))
    1.38 +
    1.39 +s, o = traceCommand("xm block-attach %s phy:/dev/ram0 hda1 w" % domain.getName())
    1.40 +if s != 0:
    1.41 +    FAIL("block-attach failed")
    1.42 +
    1.43 +if not checkBlockList(domain):
    1.44 +    FAIL("block-list does not show that hda1 was attached")
    1.45 +
    1.46 +if not checkXmLongList(domain):
    1.47 +    FAIL("xm long list does not show that hda1 was attached")
    1.48 +
    1.49 +s, o = traceCommand("xm block-detach %s hda1" % domain.getName())
    1.50 +if s != 0:
    1.51 +    FAIL("block-detach failed")
    1.52 +
    1.53 +time.sleep(2)
    1.54 +
    1.55 +if checkBlockList(domain):
    1.56 +    FAIL("block-list does not show that hda1 was removed")
    1.57 +
    1.58 +if checkXmLongList(domain):
    1.59 +    FAIL("xm long list does not show that hda1 was removed")
    1.60 +
    1.61 +
     2.1 --- a/tools/xm-test/tests/block-destroy/Makefile.am	Thu Dec 01 11:27:27 2005 +0100
     2.2 +++ b/tools/xm-test/tests/block-destroy/Makefile.am	Thu Dec 01 11:15:31 2005 +0000
     2.3 @@ -5,7 +5,8 @@ TESTS =	01_block-destroy_btblock_pos.tes
     2.4  	02_block-destroy_rtblock_pos.test	\
     2.5  	03_block-destroy_nonexist_neg.test	\
     2.6  	04_block-destroy_nonattached_neg.test 	\
     2.7 -	05_block-destroy_byname_pos.test
     2.8 +	05_block-destroy_byname_pos.test 	\
     2.9 +	06_block-destroy_check_list_pos.test
    2.10  
    2.11  XFAIL_TESTS = 
    2.12