aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordan@localhost.localdomain <dan@localhost.localdomain>2005-12-01 11:15:31 +0000
committerdan@localhost.localdomain <dan@localhost.localdomain>2005-12-01 11:15:31 +0000
commitfff236db8d613bbb575aed86c42940187eab55ce (patch)
tree36ed2abccbe7d52020af7366edab08f9c707aeff /tools
parentb242b20898bd7966b4121ebef258ed8e42c80072 (diff)
downloadxen-fff236db8d613bbb575aed86c42940187eab55ce.tar.gz
xen-fff236db8d613bbb575aed86c42940187eab55ce.tar.bz2
xen-fff236db8d613bbb575aed86c42940187eab55ce.zip
Add test for the last unresolved bit of bug #416. Check that
"xm list --long" reflects removed devices.
Diffstat (limited to 'tools')
-rw-r--r--tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py58
-rw-r--r--tools/xm-test/tests/block-destroy/Makefile.am3
2 files changed, 60 insertions, 1 deletions
diff --git a/tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py b/tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py
new file mode 100644
index 0000000000..4f0ff64479
--- /dev/null
+++ b/tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py
@@ -0,0 +1,58 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Dan Smith <danms@us.ibm.com>
+
+from XmTestLib import *
+
+import time
+import re
+
+def checkBlockList(domain):
+ s, o = traceCommand("xm block-list %s" % domain.getName())
+ if s != 0:
+ FAIL("block-list failed")
+ if re.search("769", o):
+ return True
+ else:
+ return False
+
+def checkXmLongList(domain):
+ s, o = traceCommand("xm list --long %s" % domain.getName())
+ if s != 0:
+ FAIL("xm list --long <dom> failed")
+ if re.search("hda1", o):
+ return True
+ else:
+ return False
+
+domain = XmTestDomain()
+
+try:
+ domain.start()
+except DomainError,e:
+ FAIL(str(e))
+
+s, o = traceCommand("xm block-attach %s phy:/dev/ram0 hda1 w" % domain.getName())
+if s != 0:
+ FAIL("block-attach failed")
+
+if not checkBlockList(domain):
+ FAIL("block-list does not show that hda1 was attached")
+
+if not checkXmLongList(domain):
+ FAIL("xm long list does not show that hda1 was attached")
+
+s, o = traceCommand("xm block-detach %s hda1" % domain.getName())
+if s != 0:
+ FAIL("block-detach failed")
+
+time.sleep(2)
+
+if checkBlockList(domain):
+ FAIL("block-list does not show that hda1 was removed")
+
+if checkXmLongList(domain):
+ FAIL("xm long list does not show that hda1 was removed")
+
+
diff --git a/tools/xm-test/tests/block-destroy/Makefile.am b/tools/xm-test/tests/block-destroy/Makefile.am
index 065ef468b2..78d594e3ce 100644
--- a/tools/xm-test/tests/block-destroy/Makefile.am
+++ b/tools/xm-test/tests/block-destroy/Makefile.am
@@ -5,7 +5,8 @@ TESTS = 01_block-destroy_btblock_pos.test \
02_block-destroy_rtblock_pos.test \
03_block-destroy_nonexist_neg.test \
04_block-destroy_nonattached_neg.test \
- 05_block-destroy_byname_pos.test
+ 05_block-destroy_byname_pos.test \
+ 06_block-destroy_check_list_pos.test
XFAIL_TESTS =