[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Break out common parts of vtpm tests into new vtpm_utils library.



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID a66c48bdf9c38895de32e14f56a838e8230a7250
# Parent  a659a3f200669ec3a4b7e9bec29cd9e0c3749d18
Break out common parts of vtpm tests into new vtpm_utils library.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r a659a3f20066 -r a66c48bdf9c3 
tools/xm-test/tests/vtpm/01_vtpm-list_pos.py
--- a/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py      Tue Mar 21 10:44:56 2006
+++ b/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py      Tue Mar 21 10:49:29 2006
@@ -8,16 +8,9 @@
 
 
 from XmTestLib import *
+from vtpm_utils import *
 import commands
 import os
-
-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")
 
 config = {"vtpm":"instance=1,backend=0"}
 domain = XmTestDomain(extraConfig=config)
diff -r a659a3f20066 -r a66c48bdf9c3 
tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py
--- a/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py      Tue Mar 21 10:44:56 2006
+++ b/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py      Tue Mar 21 10:49:29 2006
@@ -7,26 +7,11 @@
 #                check list of pcrs
 
 from XmTestLib import *
+from vtpm_utils 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)
 
diff -r a659a3f20066 -r a66c48bdf9c3 
tools/xm-test/tests/vtpm/03_vtpm-susp_res.py
--- a/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py      Tue Mar 21 10:44:56 2006
+++ b/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py      Tue Mar 21 10:49:29 2006
@@ -8,26 +8,11 @@
 #                check list of pcrs again
 
 from XmTestLib import *
+from vtpm_utils 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)
 
diff -r a659a3f20066 -r a66c48bdf9c3 tools/xm-test/tests/vtpm/Makefile.am
--- a/tools/xm-test/tests/vtpm/Makefile.am      Tue Mar 21 10:44:56 2006
+++ b/tools/xm-test/tests/vtpm/Makefile.am      Tue Mar 21 10:49:29 2006
@@ -1,4 +1,3 @@
-
 SUBDIRS =
 
 TESTS = 01_vtpm-list_pos.test \
@@ -7,8 +6,7 @@
 
 XFAIL_TESTS =
 
-EXTRA_DIST = $(TESTS) $(XFAIL_TESTS)
-
+EXTRA_DIST = $(TESTS) $(XFAIL_TESTS) vtpm_utils.py
 TESTS_ENVIRONMENT=@TENV@
 
 %.test: %.py
diff -r a659a3f20066 -r a66c48bdf9c3 tools/xm-test/tests/vtpm/vtpm_utils.py
--- /dev/null   Tue Mar 21 10:44:56 2006
+++ b/tools/xm-test/tests/vtpm/vtpm_utils.py    Tue Mar 21 10:49:29 2006
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2006
+# Author: Stefan Berger <stefanb@xxxxxxxxxx>
+
+from XmTestLib import *
+
+if ENABLE_HVM_SUPPORT:
+    SKIP("vtpm tests not supported for HVM domains")
+
+if not os.path.isfile("/dev/tpm0"):
+    SKIP("This machine has no hardware TPM; cannot run this test")
+
+status, output = traceCommand("ps aux | grep vtpm_manager | grep -v grep")
+if output == "":
+    FAIL("virtual TPM manager must be started to run this test")
+
+def vtpm_cleanup(domName):
+       traceCommand("/etc/xen/scripts/vtpm-delete %s" % domName)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.