Skip to contentSkip to conversation

Cleaned-up patch

PATCH Applied Stefan Berger 2 participants 2 messages Feb 22, 2006 – Feb 27, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Cleaned-up patch

The attached patch does the following:

- introduces two basic tests for the virtual TPM (skipped on hardware where a TPM is not available or vtpm manager has not been started manually before)
- adapts the Makefiles to make the test cases available
- splits up the hotplug files into two files where the vtpm-common.sh can be sourced by 'other' scripts as well
- uses echo "$var" to return variables from functions
- gets rid of the 'set +e" work-around
- introduces a script (vtpm-delete) to delete entries from the virtual TPM directory in /etc/xen/vtpm.db

The xm-tests will skip over the 2nd test on most systems and the patch has otherwise no effect on existing tests.

xen-unstable.hg/tools/xm-test/configure.ac +1 -0
Index: root/xen-unstable.hg/tools/xm-test/configure.ac
===================================================================
@@ -93,6 +93,7 @@ AC_CONFIG_FILES([
     tests/unpause/Makefile
     tests/vcpu-pin/Makefile
     tests/vcpu-disable/Makefile
+    tests/vtpm/Makefile
     tests/enforce_dom0_cpus/Makefile
     lib/XmTestReport/xmtest.py
     lib/XmTestLib/config.py
xen-unstable.hg/tools/xm-test/tests/Makefile.am +1 -0
Index: root/xen-unstable.hg/tools/xm-test/tests/Makefile.am
===================================================================
@@ -23,6 +23,7 @@ SUBDIRS = 	               	\
 		unpause         \
 		vcpu-disable    \
 		vcpu-pin	\
+		vtpm            \
 		enforce_dom0_cpus	\
 		save restore migrate
 
xen-unstable.hg/tools/xm-test/tests/vtpm/Makefile.am new file +22 -0
Index: root/xen-unstable.hg/tools/xm-test/tests/vtpm/Makefile.am
===================================================================
@@ -0,0 +1,22 @@
+
+SUBDIRS =
+
+TESTS = 01_vtpm-list_pos.test \
+        02_vtpm-cat_pcrs.test
+
+XFAIL_TESTS =
+
+EXTRA_DIST = $(TESTS) $(XFAIL_TESTS)
+
+TESTS_ENVIRONMENT=@TENV@
+
+%.test: %.py
+	cp $< $@
+	chmod +x $@
+
+clean-local: am_config_clean-local
+
+am_config_clean-local:
+	rm -f *test
+	rm -f *log
+	rm -f *~
xen-unstable.hg/tools/xm-test/lib/XmTestLib/XenDomain.py +1 -0
Index: root/xen-unstable.hg/tools/xm-test/lib/XmTestLib/XenDomain.py
===================================================================
@@ -99,6 +99,7 @@ class XenConfig:
         # These options need to be lists
         self.defaultOpts["disk"] = []
         self.defaultOpts["vif"]  = []
+        self.defaultOpts["vtpm"] = []
 
         self.opts = self.defaultOpts
 
xen-unstable.hg/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py new file +45 -0

45 lines not on this page · raw message

xen-unstable.hg/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py new file +81 -0

81 lines not on this page · raw message

xen-unstable.hg/tools/examples/Makefile +2 -2
Index: root/xen-unstable.hg/tools/examples/Makefile
===================================================================
@@ -26,10 +26,10 @@ XEN_SCRIPTS += network-route vif-route
 XEN_SCRIPTS += network-nat vif-nat
 XEN_SCRIPTS += block
 XEN_SCRIPTS += block-enbd block-nbd
-XEN_SCRIPTS += vtpm
+XEN_SCRIPTS += vtpm vtpm-delete
 XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh
 XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
-XEN_SCRIPT_DATA += block-common.sh vtpm-common.sh
+XEN_SCRIPT_DATA += block-common.sh vtpm-common.sh vtpm-hotplug-common.sh
 
 XEN_HOTPLUG_DIR = /etc/hotplug
 XEN_HOTPLUG_SCRIPTS = xen-backend.agent
xen-unstable.hg/tools/examples/vtpm-common.sh +58 -53

239 lines not on this page · raw message

xen-unstable.hg/tools/examples/vtpm-delete new file +9 -0
Index: root/xen-unstable.hg/tools/examples/vtpm-delete
===================================================================
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# This scripts must be called the following way:
+# vtpm-delete <domain name>
+
+dir=$(dirname "$0")
+. "$dir/vtpm-common.sh"
+
+vtpm_delete_instance $1
xen-unstable.hg/tools/examples/vtpm +1 -1
Index: root/xen-unstable.hg/tools/examples/vtpm
===================================================================
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 dir=$(dirname "$0")
-. "$dir/vtpm-common.sh"
+. "$dir/vtpm-hotplug-common.sh"
 
 vtpm_fatal_error=0
 
xen-unstable.hg/tools/examples/vtpm-hotplug-common.sh new file +35 -0
Index: root/xen-unstable.hg/tools/examples/vtpm-hotplug-common.sh
===================================================================
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2005 IBM Corporation
+# Copyright (c) 2005 XenSource Ltd.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of version 2.1 of the GNU Lesser General Public
+# License as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+
+dir=$(dirname "$0")
+. "$dir/xen-hotplug-common.sh"
+
+findCommand "$@"
+if [ "$command" != "online" ]  &&
+   [ "$command" != "offline" ] &&
+   [ "$command" != "add" ]     &&
+   [ "$command" != "remove" ]
+then
+	log err "Invalid command: $command"
+	exit 1
+fi
+
+
+XENBUS_PATH="${XENBUS_PATH:?}"
+
+. "$dir/vtpm-common.sh"

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

Applied
#1 lore raw
Quoted 13 lines · Stefan Berger

The attached patch does the following:

- introduces two basic tests for the virtual TPM (skipped on hardware where a TPM is not available or vtpm manager has not been started manually before)
- adapts the Makefiles to make the test cases available
- splits up the hotplug files into two files where the vtpm-common.sh can be sourced by 'other' scripts as well
- uses echo "$var" to return variables from functions
- gets rid of the 'set +e" work-around
- introduces a script (vtpm-delete) to delete entries from the virtual TPM directory in /etc/xen/vtpm.db

Quoted 4 lines

The xm-tests will skip over the 2nd test on most systems and the patch has otherwise no effect on existing tests.

Applied, thank you.

Ewan.