aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py')
-rw-r--r--tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py19
1 files changed, 3 insertions, 16 deletions
diff --git a/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py b/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py
index 0f59677f7d..4ff33600a0 100644
--- a/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py
+++ b/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py
@@ -14,6 +14,7 @@ from vtpm_utils import *
import commands
import os
import os.path
+import atexit
config = {"vtpm":"instance=1,backend=0"}
domain = XmTestDomain(extraConfig=config)
@@ -25,45 +26,40 @@ 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("mknod /dev/tpm0 c 10 224")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Error while creating /dev/tpm0")
try:
run = console.runCmd("echo -ne \"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\" > seq; cat seq > /dev/tpm0")
except ConsoleError, e:
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Error while extending PCR 0")
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")
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: \n%s" % run["output"])
if not re.search("PCR-00: 1E A7 BD",run["output"]):
@@ -83,12 +79,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?")
@@ -96,31 +90,26 @@ 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")
if not re.search("PCR-00: 1E A7 BD",run["output"]):
saveLog(console.getHistory())
- vtpm_cleanup(domName)
FAIL("Virtual TPM lost PCR 0 value: \n%s" % run["output"])
loop += 1
@@ -128,5 +117,3 @@ while loop < 3:
domain.closeConsole()
domain.stop()
-
-vtpm_cleanup(domName)