# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 6b7c54556ac855d4128a4bda6429fdd8d31ae19e
# Parent f6ebf236faee94e4f5d05cf2f3f092edb710aa1d
I am adding one more test case for vTPM migration. The new one does
local network migration without the 'live' parameter 3 times. The test
'04' that does live migration now tests local live migration 3 times.
Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
---
tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py | 61 ++++++++--------
tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py | 100 +++++++++++++++++++++++++++
tools/xm-test/tests/vtpm/Makefile.am | 3
3 files changed, 135 insertions(+), 29 deletions(-)
diff -r f6ebf236faee -r 6b7c54556ac8
tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py
--- a/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py Thu May 11 13:42:20
2006 +0100
+++ b/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py Thu May 11 13:43:09
2006 +0100
@@ -6,6 +6,7 @@
# Positive Test: create domain with virtual TPM attached at build time,
# check list of pcrs; locally migrate the domain and
# check list of pcrs again
+# This test does local live migration.
from XmTestLib import *
from vtpm_utils import *
@@ -50,40 +51,44 @@ domain.closeConsole()
old_domid = domid(domName)
-try:
- status, ouptut = traceCommand("xm migrate -l %s localhost" %
- domName,
- timeout=90)
-except TimeoutError, e:
- saveLog(consoleHistory)
- vtpm_cleanup(domName)
- FAIL(str(e))
+loop = 0
+while loop < 3:
+ try:
+ status, ouptut = traceCommand("xm migrate -l %s localhost" %
+ domName,
+ timeout=90)
+ except TimeoutError, e:
+ saveLog(consoleHistory)
+ vtpm_cleanup(domName)
+ FAIL(str(e))
-if status != 0:
- saveLog(consoleHistory)
- vtpm_cleanup(domName)
- FAIL("xm migrate did not succeed. External device migration activated?")
+ if status != 0:
+ saveLog(consoleHistory)
+ vtpm_cleanup(domName)
+ FAIL("xm migrate did not succeed. External device migration
activated?")
-domName = domain.getName()
-new_domid = domid(domName)
+ domName = domain.getName()
+ new_domid = domid(domName)
-if (old_domid == new_domid):
- vtpm_cleanup(domName)
- FAIL("xm migrate failed, domain id is still %s" % old_domid)
+ if (old_domid == new_domid):
+ vtpm_cleanup(domName)
+ FAIL("xm migrate failed, domain id is still %s (loop=%d)" %
+ (old_domid,loop))
-try:
- console = domain.getConsole()
-except ConsoleError, e:
- vtpm_cleanup(domName)
- FAIL(str(e))
+ try:
+ console = domain.getConsole()
+ except ConsoleError, e:
+ vtpm_cleanup(domName)
+ FAIL(str(e))
-try:
- run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
-except ConsoleError, e:
- saveLog(console.getHistory())
- vtpm_cleanup(domName)
- FAIL(str(e))
+ try:
+ run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
+ except ConsoleError, e:
+ saveLog(console.getHistory())
+ vtpm_cleanup(domName)
+ FAIL(str(e))
+ loop += 1
domain.closeConsole()
diff -r f6ebf236faee -r 6b7c54556ac8 tools/xm-test/tests/vtpm/Makefile.am
--- a/tools/xm-test/tests/vtpm/Makefile.am Thu May 11 13:42:20 2006 +0100
+++ b/tools/xm-test/tests/vtpm/Makefile.am Thu May 11 13:43:09 2006 +0100
@@ -3,7 +3,8 @@ TESTS = 01_vtpm-list_pos.test \
TESTS = 01_vtpm-list_pos.test \
02_vtpm-cat_pcrs.test \
03_vtpm-susp_res.test \
- 04_vtpm-loc_migr.test
+ 04_vtpm-loc_migr.test \
+ 05_vtpm-loc_migr.test
XFAIL_TESTS =
diff -r f6ebf236faee -r 6b7c54556ac8
tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py Thu May 11 13:43:09
2006 +0100
@@ -0,0 +1,100 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2006
+# Author: Stefan Berger <stefanb@xxxxxxxxxx>
+
+# Positive Test: create domain with virtual TPM attached at build time,
+# check list of pcrs; locally migrate the domain and
+# check list of pcrs again
+# This test does local (non-live) migration.
+
+from XmTestLib import *
+from vtpm_utils import *
+import commands
+import os
+import os.path
+
+config = {"vtpm":"instance=1,backend=0"}
+domain = XmTestDomain(extraConfig=config)
+consoleHistory = ""
+
+try:
+ console = domain.start()
+except DomainError, e:
+ if verbose:
+ print e.extra
+ vtpm_cleanup(domain.getName())
+ FAIL("Unable to create domain")
+
+domName = domain.getName()
+
+try:
+ console.sendInput("input")
+except ConsoleError, e:
+ saveLog(console.getHistory())
+ vtpm_cleanup(domName)
+ FAIL(str(e))
+
+try:
+ run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
+except ConsoleError, e:
+ saveLog(console.getHistory())
+ vtpm_cleanup(domName)
+ FAIL(str(e))
+
+if re.search("No such file",run["output"]):
+ vtpm_cleanup(domName)
+ FAIL("TPM frontend support not compiled into (domU?) kernel")
+
+consoleHistory = console.getHistory()
+domain.closeConsole()
+
+old_domid = domid(domName)
+
+loop = 0
+while loop < 3:
+ try:
+ status, ouptut = traceCommand("xm migrate %s localhost" %
+ domName,
+ timeout=90)
+ except TimeoutError, e:
+ saveLog(consoleHistory)
+ vtpm_cleanup(domName)
+ FAIL(str(e))
+
+ if status != 0:
+ saveLog(consoleHistory)
+ vtpm_cleanup(domName)
+ FAIL("xm migrate did not succeed. External device migration
activated?")
+
+
+ domName = domain.getName()
+ new_domid = domid(domName)
+
+ if (old_domid == new_domid):
+ vtpm_cleanup(domName)
+ FAIL("xm migrate failed, domain id is still %s (loop=%d)" %
+ (old_domid,loop))
+
+ try:
+ console = domain.getConsole()
+ except ConsoleError, e:
+ vtpm_cleanup(domName)
+ FAIL(str(e))
+
+ try:
+ run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
+ except ConsoleError, e:
+ saveLog(console.getHistory())
+ vtpm_cleanup(domName)
+ FAIL(str(e))
+ loop += 1
+
+domain.closeConsole()
+
+domain.stop()
+
+vtpm_cleanup(domName)
+
+if not re.search("PCR-00:",run["output"]):
+ FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend
side")
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|