direct-io.hg
changeset 9354:a66c48bdf9c3
Break out common parts of vtpm tests into new vtpm_utils library.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Signed-off-by: Ewan Mellor <ewan@xensource.com>
author | emellor@leeni.uk.xensource.com |
---|---|
date | Tue Mar 21 11:49:29 2006 +0100 (2006-03-21) |
parents | a659a3f20066 |
children | 349d26c1094f a013fa6ee37c |
files | tools/xm-test/tests/vtpm/01_vtpm-list_pos.py tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py tools/xm-test/tests/vtpm/03_vtpm-susp_res.py tools/xm-test/tests/vtpm/Makefile.am tools/xm-test/tests/vtpm/vtpm_utils.py |
line diff
1.1 --- a/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py Tue Mar 21 11:44:56 2006 +0100 1.2 +++ b/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py Tue Mar 21 11:49:29 2006 +0100 1.3 @@ -8,17 +8,10 @@ 1.4 1.5 1.6 from XmTestLib import * 1.7 +from vtpm_utils import * 1.8 import commands 1.9 import os 1.10 1.11 -def vtpm_cleanup(domName): 1.12 - # Since this is only a temporary domain I clean up the domain from the 1.13 - # virtual TPM directory 1.14 - os.system("/etc/xen/scripts/vtpm-delete %s" % domName) 1.15 - 1.16 -if ENABLE_HVM_SUPPORT: 1.17 - SKIP("vtpm-list not supported for HVM domains") 1.18 - 1.19 config = {"vtpm":"instance=1,backend=0"} 1.20 domain = XmTestDomain(extraConfig=config) 1.21
2.1 --- a/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py Tue Mar 21 11:44:56 2006 +0100 2.2 +++ b/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py Tue Mar 21 11:49:29 2006 +0100 2.3 @@ -7,26 +7,11 @@ 2.4 # check list of pcrs 2.5 2.6 from XmTestLib import * 2.7 +from vtpm_utils import * 2.8 import commands 2.9 import os 2.10 import os.path 2.11 2.12 -def vtpm_cleanup(domName): 2.13 - # Since this is only a temporary domain I clean up the domain from the 2.14 - # virtual TPM directory 2.15 - os.system("/etc/xen/scripts/vtpm-delete %s" % domName) 2.16 - 2.17 -if ENABLE_HVM_SUPPORT: 2.18 - SKIP("vtpm-list not supported for HVM domains") 2.19 - 2.20 -if os.path.exists("/dev/tpm0") == False: 2.21 - SKIP("This machine has no hardware TPM; cannot run this test") 2.22 - 2.23 -output = commands.getoutput("ps aux | grep vtpm_manager | grep -v grep") 2.24 -if output == "": 2.25 - SKIP("virtual TPM manager must be started to run this test") 2.26 - 2.27 -# vtpm manager has been detected 2.28 config = {"vtpm":"instance=1,backend=0"} 2.29 domain = XmTestDomain(extraConfig=config) 2.30
3.1 --- a/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py Tue Mar 21 11:44:56 2006 +0100 3.2 +++ b/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py Tue Mar 21 11:49:29 2006 +0100 3.3 @@ -8,26 +8,11 @@ 3.4 # check list of pcrs again 3.5 3.6 from XmTestLib import * 3.7 +from vtpm_utils import * 3.8 import commands 3.9 import os 3.10 import os.path 3.11 3.12 -def vtpm_cleanup(domName): 3.13 - # Since this is only a temporary domain I clean up the domain from the 3.14 - # virtual TPM directory 3.15 - os.system("/etc/xen/scripts/vtpm-delete %s" % domName) 3.16 - 3.17 -if ENABLE_HVM_SUPPORT: 3.18 - SKIP("vtpm-list not supported for HVM domains") 3.19 - 3.20 -if os.path.exists("/dev/tpm0") == False: 3.21 - SKIP("This machine has no hardware TPM; cannot run this test") 3.22 - 3.23 -output = commands.getoutput("ps aux | grep vtpm_manager | grep -v grep") 3.24 -if output == "": 3.25 - SKIP("virtual TPM manager must be started to run this test") 3.26 - 3.27 -# vtpm manager has been detected 3.28 config = {"vtpm":"instance=1,backend=0"} 3.29 domain = XmTestDomain(extraConfig=config) 3.30
4.1 --- a/tools/xm-test/tests/vtpm/Makefile.am Tue Mar 21 11:44:56 2006 +0100 4.2 +++ b/tools/xm-test/tests/vtpm/Makefile.am Tue Mar 21 11:49:29 2006 +0100 4.3 @@ -1,4 +1,3 @@ 4.4 - 4.5 SUBDIRS = 4.6 4.7 TESTS = 01_vtpm-list_pos.test \ 4.8 @@ -7,8 +6,7 @@ TESTS = 01_vtpm-list_pos.test \ 4.9 4.10 XFAIL_TESTS = 4.11 4.12 -EXTRA_DIST = $(TESTS) $(XFAIL_TESTS) 4.13 - 4.14 +EXTRA_DIST = $(TESTS) $(XFAIL_TESTS) vtpm_utils.py 4.15 TESTS_ENVIRONMENT=@TENV@ 4.16 4.17 %.test: %.py
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/tools/xm-test/tests/vtpm/vtpm_utils.py Tue Mar 21 11:49:29 2006 +0100 5.3 @@ -0,0 +1,19 @@ 5.4 +#!/usr/bin/python 5.5 + 5.6 +# Copyright (C) International Business Machines Corp., 2006 5.7 +# Author: Stefan Berger <stefanb@us.ibm.com> 5.8 + 5.9 +from XmTestLib import * 5.10 + 5.11 +if ENABLE_HVM_SUPPORT: 5.12 + SKIP("vtpm tests not supported for HVM domains") 5.13 + 5.14 +if not os.path.isfile("/dev/tpm0"): 5.15 + SKIP("This machine has no hardware TPM; cannot run this test") 5.16 + 5.17 +status, output = traceCommand("ps aux | grep vtpm_manager | grep -v grep") 5.18 +if output == "": 5.19 + FAIL("virtual TPM manager must be started to run this test") 5.20 + 5.21 +def vtpm_cleanup(domName): 5.22 + traceCommand("/etc/xen/scripts/vtpm-delete %s" % domName)