aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py')
-rw-r--r--tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py b/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py
index 0a2f32cb53..ccc8b73782 100644
--- a/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py
+++ b/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py
@@ -13,6 +13,7 @@ from vtpm_utils import *
import commands
import os
import os.path
+import atexit
config = {"vtpm":"instance=1,backend=0"}
domain = XmTestDomain(extraConfig=config)
@@ -24,25 +25,23 @@ try:
except DomainError, e:
if verbose:
print e.extra
- vtpm_cleanup(domName)
FAIL("Unable to create domain (%s)" % domName)
+atexit.register(vtpm_cleanup, vtpm_get_uuid(domid(domName)))
+
try:
console.sendInput("input")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL(str(e))
try:
run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("No result from dumping the PCRs")
if re.search("No such file",run["output"]):
- vtpm_cleanup(domName)
FAIL("TPM frontend support not compiled into (domU?) kernel")
consoleHistory = console.getHistory()
@@ -58,12 +57,10 @@ while loop < 3:
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?")
@@ -71,26 +68,22 @@ while loop < 3:
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/xen/vtpm-0/pcrs")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("No result from dumping the PCRs")
if not re.search("PCR-00:",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side")
loop += 1
@@ -98,5 +91,3 @@ while loop < 3:
domain.closeConsole()
domain.stop()
-
-vtpm_cleanup(domName)