[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Put 03_vtpm-susp_res.py in its rightful place.
# HG changeset patch # User emellor@xxxxxxxxxxxxxxxxxxxxxx # Node ID 25e1c3b1a9f2666275723bded98248ed82b4bd41 # Parent e36f95b43bf1c3e04eea31d10db5bb2d0db6eefe Put 03_vtpm-susp_res.py in its rightful place. Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx> diff -r e36f95b43bf1 -r 25e1c3b1a9f2 tools/xm-test/tests/vtpm/03_vtpm-susp_res.py --- /dev/null Tue Mar 21 00:28:29 2006 +++ b/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py Tue Mar 21 08:53:00 2006 @@ -0,0 +1,120 @@ +#!/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; suspend and resume the domain and +# check list of pcrs again + +from XmTestLib import * +import commands +import os +import os.path + +def vtpm_cleanup(domName): + # Since this is only a temporary domain I clean up the domain from the + # virtual TPM directory + os.system("/etc/xen/scripts/vtpm-delete %s" % domName) + +if ENABLE_HVM_SUPPORT: + SKIP("vtpm-list not supported for HVM domains") + +if os.path.exists("/dev/tpm0") == False: + SKIP("This machine has no hardware TPM; cannot run this test") + +output = commands.getoutput("ps aux | grep vtpm_manager | grep -v grep") +if output == "": + SKIP("virtual TPM manager must be started to run this test") + +# vtpm manager has been detected +config = {"vtpm":"instance=1,backend=0"} +domain = XmTestDomain(extraConfig=config) + +try: + domain.start() +except DomainError, e: + if verbose: + print e.extra + vtpm_cleanup(domain.getName()) + FAIL("Unable to create domain") + +domName = domain.getName() + +try: + console = XmConsole(domain.getName()) +except ConsoleError, e: + vtpm_cleanup(domName) + FAIL(str(e)) + +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"]): + FAIL("TPM frontend support not compiled into (domU?) kernel") + +console.closeConsole() + +try: + status, ouptut = traceCommand("xm save %s %s.save" % + (domName, domName), + timeout=30) +except TimeoutError, e: + saveLog(console.getHistory()) + vtpm_cleanup(domName) + FAIL(str(e)) + +if status != 0: + saveLog(console.getHistory()) + vtpm_cleanup(domName) + FAIL("xm save did not succeed") + +try: + status, ouptut = traceCommand("xm restore %s.save" % + (domName), + timeout=30) +except TimeoutError, e: + os.remove("%s.save" % domName) + saveLog(console.getHistory()) + vtpm_cleanup(domName) + FAIL(str(e)) + +os.remove("%s.save" % domName) + +if status != 0: + saveLog(console.getHistory()) + vtpm_cleanup(domName) + FAIL("xm restore did not succeed") + +try: + console = XmConsole(domain.getName()) +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)) + +console.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") diff -r e36f95b43bf1 -r 25e1c3b1a9f2 xen-unstable.hg/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py --- a/xen-unstable.hg/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py Tue Mar 21 00:28:29 2006 +++ /dev/null Tue Mar 21 08:53:00 2006 @@ -1,120 +0,0 @@ -#!/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; suspend and resume the domain and -# check list of pcrs again - -from XmTestLib import * -import commands -import os -import os.path - -def vtpm_cleanup(domName): - # Since this is only a temporary domain I clean up the domain from the - # virtual TPM directory - os.system("/etc/xen/scripts/vtpm-delete %s" % domName) - -if ENABLE_HVM_SUPPORT: - SKIP("vtpm-list not supported for HVM domains") - -if os.path.exists("/dev/tpm0") == False: - SKIP("This machine has no hardware TPM; cannot run this test") - -output = commands.getoutput("ps aux | grep vtpm_manager | grep -v grep") -if output == "": - SKIP("virtual TPM manager must be started to run this test") - -# vtpm manager has been detected -config = {"vtpm":"instance=1,backend=0"} -domain = XmTestDomain(extraConfig=config) - -try: - domain.start() -except DomainError, e: - if verbose: - print e.extra - vtpm_cleanup(domain.getName()) - FAIL("Unable to create domain") - -domName = domain.getName() - -try: - console = XmConsole(domain.getName()) -except ConsoleError, e: - vtpm_cleanup(domName) - FAIL(str(e)) - -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"]): - FAIL("TPM frontend support not compiled into (domU?) kernel") - -console.closeConsole() - -try: - status, ouptut = traceCommand("xm save %s %s.save" % - (domName, domName), - timeout=30) -except TimeoutError, e: - saveLog(console.getHistory()) - vtpm_cleanup(domName) - FAIL(str(e)) - -if status != 0: - saveLog(console.getHistory()) - vtpm_cleanup(domName) - FAIL("xm save did not succeed") - -try: - status, ouptut = traceCommand("xm restore %s.save" % - (domName), - timeout=30) -except TimeoutError, e: - os.remove("%s.save" % domName) - saveLog(console.getHistory()) - vtpm_cleanup(domName) - FAIL(str(e)) - -os.remove("%s.save" % domName) - -if status != 0: - saveLog(console.getHistory()) - vtpm_cleanup(domName) - FAIL("xm restore did not succeed") - -try: - console = XmConsole(domain.getName()) -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)) - -console.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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |