Files
xen/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py
T
kaf24@firebug.cl.cam.ac.uk d36b2acb2b [TPM] Add 3 more test cases to the xm testsuite that extend the
state of a PCR register and test that the value remains the same during
a suspend/resume cycle and during live and non-live local migration. 
The patch adapts existing tests to the changes in the driver (moving of
the sysfs entry). Some problems with existing tests are fixed.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2006-06-28 16:22:38 +01:00

53 lines
1.2 KiB
Python

#!/usr/bin/python
# Copyright (C) International Business Machines Corp., 2006
# Author: Stefan Berger <stefanb@us.ibm.com>
# Positive Test: create domain with virtual TPM attached at build time,
# check list of pcrs
from XmTestLib import *
from vtpm_utils import *
import commands
import os
import os.path
config = {"vtpm":"instance=1,backend=0"}
domain = XmTestDomain(extraConfig=config)
domName = domain.getName()
try:
console = domain.start()
except DomainError, e:
if verbose:
print e.extra
vtpm_cleanup(domName)
FAIL("Unable to create domain (%s)" % 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")
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")