Skip to contentSkip to conversation

More vTPM test cases

PATCH New Stefan Berger 1 participant 1 message Jun 27, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 More vTPM test cases

This patch adds 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.

xen-unstable.hg/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py +13 -11
Index: root/xen-unstable.hg/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py
===================================================================
@@ -16,6 +16,7 @@ import os.path
 
 config = {"vtpm":"instance=1,backend=0"}
 domain = XmTestDomain(extraConfig=config)
+domName = domain.getName()
 consoleHistory = ""
 
 try:
@@ -23,10 +24,8 @@ try:
 except DomainError, e:
     if verbose:
         print e.extra
-    vtpm_cleanup(domain.getName())
-    FAIL("Unable to create domain")
-
-domName = domain.getName()
+    vtpm_cleanup(domName)
+    FAIL("Unable to create domain (%s)" % domName)
 
 try:
     console.sendInput("input")
@@ -36,11 +35,11 @@ except ConsoleError, e:
     FAIL(str(e))
 
 try:
-    run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
+    run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
 except ConsoleError, e:
     saveLog(console.getHistory())
     vtpm_cleanup(domName)
-    FAIL(str(e))
+    FAIL("No result from dumping the PCRs")
 
 if re.search("No such file",run["output"]):
     vtpm_cleanup(domName)
@@ -83,11 +82,17 @@ while loop < 3:
         FAIL(str(e))
 
     try:
-        run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
+        run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
     except ConsoleError, e:
         saveLog(console.getHistory())
         vtpm_cleanup(domName)
-        FAIL(str(e))
+        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")
+
     loop += 1
 
 domain.closeConsole()
@@ -95,6 +100,3 @@ 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")
xen-unstable.hg/tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py +13 -11
Index: root/xen-unstable.hg/tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py
===================================================================
@@ -16,6 +16,7 @@ import os.path
 
 config = {"vtpm":"instance=1,backend=0"}
 domain = XmTestDomain(extraConfig=config)
+domName = domain.getName()
 consoleHistory = ""
 
 try:
@@ -23,10 +24,8 @@ try:
 except DomainError, e:
     if verbose:
         print e.extra
-    vtpm_cleanup(domain.getName())
-    FAIL("Unable to create domain")
-
-domName = domain.getName()
+    vtpm_cleanup(domName)
+    FAIL("Unable to create domain (%s)" % domName)
 
 try:
     console.sendInput("input")
@@ -36,11 +35,11 @@ except ConsoleError, e:
     FAIL(str(e))
 
 try:
-    run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
+    run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
 except ConsoleError, e:
     saveLog(console.getHistory())
     vtpm_cleanup(domName)
-    FAIL(str(e))
+    FAIL("No result from dumping the PCRs")
 
 if re.search("No such file",run["output"]):
     vtpm_cleanup(domName)
@@ -83,11 +82,17 @@ while loop < 3:
         FAIL(str(e))
 
     try:
-        run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
+        run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
     except ConsoleError, e:
         saveLog(console.getHistory())
         vtpm_cleanup(domName)
-        FAIL(str(e))
+        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")
+
     loop += 1
 
 domain.closeConsole()
@@ -95,6 +100,3 @@ 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")
xen-unstable.hg/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py +5 -6
Index: root/xen-unstable.hg/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py
===================================================================
@@ -14,16 +14,15 @@ 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(domain.getName())
-    FAIL("Unable to create domain")
-
-domName = domain.getName()
+    vtpm_cleanup(domName)
+    FAIL("Unable to create domain (%s)" % domName)
 
 try:
     console.sendInput("input")
@@ -33,11 +32,11 @@ except ConsoleError, e:
     FAIL(str(e))
 
 try:
-    run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
+    run = console.runCmd("cat /sys/devices/xen/vtpm-0/pcrs")
 except ConsoleError, e:
     saveLog(console.getHistory())
     vtpm_cleanup(domName)
-    FAIL(str(e))
+    FAIL("No result from dumping the PCRs")
 
 if re.search("No such file",run["output"]):
     vtpm_cleanup(domName)
xen-unstable.hg/tools/xm-test/tests/vtpm/03_vtpm-susp_res.py +54 -48

136 lines not on this page · raw message

xen-unstable.hg/tools/xm-test/tests/vtpm/Makefile.am +4 -1
Index: root/xen-unstable.hg/tools/xm-test/tests/vtpm/Makefile.am
===================================================================
@@ -4,7 +4,10 @@ TESTS = 01_vtpm-list_pos.test \
         02_vtpm-cat_pcrs.test \
         03_vtpm-susp_res.test \
         04_vtpm-loc_migr.test \
-        05_vtpm-loc_migr.test
+        05_vtpm-loc_migr.test \
+        06_vtpm-susp_res_pcrs.test \
+        07_vtpm-mig_pcrs.test \
+        08_vtpm-mig_pcrs.test
 
 XFAIL_TESTS =
 
xen-unstable.hg/tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py new file +139 -0

139 lines not on this page · raw message

xen-unstable.hg/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py new file +132 -0

132 lines not on this page · raw message

xen-unstable.hg/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py new file +132 -0

132 lines not on this page · raw message

xen-unstable.hg/tools/xm-test/tests/vtpm/vtpm_utils.py +1 -1
Index: root/xen-unstable.hg/tools/xm-test/tests/vtpm/vtpm_utils.py
===================================================================
@@ -16,4 +16,4 @@ 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)
+    traceCommand("/etc/xen/scripts/vtpm-delete %s" % domName)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel