virtual TPM test
PATCH 1/1 virtual TPM test
The attached patch adds 2 tests for the virtual TPM to the test suite (more to come over time). It skips the test if it cannot be run. It builds on top of the previous patch.
xen-unstable.hg/tools/xm-test/configure.ac +1 -0
@@ -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
@@ -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
@@ -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
@@ -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 +1 -1
@@ -26,7 +26,7 @@ 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 XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh XEN_SCRIPT_DATA += block-common.sh vtpm-common.sh
xen-unstable.hg/tools/examples/vtpm-common.sh +41 -31
186 lines not on this page · raw message
xen-unstable.hg/tools/examples/vtpm-delete new file +18 -0
@@ -0,0 +1,18 @@ +#!/bin/sh + +# This scripts must be called the following way: +# vtpm-delete <domain name> + +if [ $1 != "remove" ]; then + exec sh -c "bash $0 remove $*" +fi + + +XENBUS_PATH=" " + +dir=$(dirname "$0") +. "$dir/vtpm-common.sh" + +shift + +vtpm_delete_instance $1
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines · Stefan Berger
The attached patch adds 2 tests for the virtual TPM to the test suite (more to come over time). It skips the test if it cannot be run. It builds on top of the previous patch.
Signed-off-by Stefan Berger <[email protected]>
Stefan, I have a number of issues with this patch. Firstly, you have made significant changes to the scripts in tools/examples, plus a change to xm-test's core library, and yet your changelog message makes no mention of them.
xen-unstable.hg/tools/examples/vtpm-common.sh function find_instance () { · line 89
Quoted 9 lines
Index:
xen/xen-unstable.hg/tools/examples/vtpm-common.sh
===================================================================xen-unstable.hg/tools/examples/vtpm-common.sh +1
-1@@ -82,16 +85,15 @@ function find_instance () { if [ "$instance" != "" ]; then ret=1 fi - return $ret + res=$ret }
Why have you made this change? Setting a global variable to return a result as a side effect is poor style. This occurs a number of times in your patch.
Quoted 13 lines
Index: xen/xen-unstable.hg/tools/examples/vtpm-delete
===================================================================xen-unstable.hg/tools/examples/vtpm-delete new file +8
-0@@ -0,0 +1,18 @@ +#!/bin/sh + +# This scripts must be called the following way: +# vtpm-delete <domain name> + +if [ $1 != "remove" ]; then + exec sh -c "bash $0 remove $*" +fi
xen-unstable.hg/tools/examples/vtpm-delete line 18
Quoted 10 lines
xen-unstable.hg/tools/examples/vtpm-delete new file +10
-0+ + +XENBUS_PATH=" " + +dir=$(dirname "$0") +. "$dir/vtpm-common.sh" + +shift + +vtpm_delete_instance $1
You are setting XENBUS_PATH just to hack your way into the hotplug scripts, and then relying on the fact that vtpm_delete_instance doesn't actually use that value. This is not a reasonable thing to be do. If there's a need for a tpm-manipulating library, separate from the hotplug infrastructure, then you should split vtpm-common.sh into vtpm-common.sh and vtpm-hotplug-common.sh (or similar). Note that vif-common.sh includes xen-hotplug-common.sh and xen-network-common.sh -- these are split apart for exactly that reason (xen-network-common.sh being used for the network-xyz scripts as well as for the vif-xyz hotplugging scripts).
Ewan.
[email protected] wrote on 02/22/2006 10:40:33 AM:
Quoted 9 lines · Stefan Berger
Quoted 6 lines
The attached patch adds 2 tests for the virtual TPM to the test suite (more to come over time). It skips the test if it cannot be run. It builds on top of the previous patch.
Signed-off-by Stefan Berger <[email protected]>Stefan, I have a number of issues with this patch. Firstly, you have
made
Quoted 2 lines
significant changes to the scripts in
tools/examples, plus a change to xm-test's core library, and yet your changelog message makes no mention
of
Quoted 13 lines
them.
xen-unstable.hg/tools/examples/vtpm-common.sh function find_instance () { · line 89
Quoted 9 lines
Index:
xen/xen-unstable.hg/tools/examples/vtpm-common.sh
===================================================================xen-unstable.hg/tools/examples/vtpm-common.sh +1
-1@@ -82,16 +85,15 @@ function find_instance () { if [ "$instance" != "" ]; then ret=1 fi - return $ret + res=$ret }Why have you made this change? Setting a global variable to return a
result
Quoted 1 line
as a side effect is poor style. This occurs a number of times in your
patch.
To get rid of the 'set +e' command I cannot return a number in the return statement, otherwise the script just terminates.
Quoted 18 lines
Quoted 18 lines
Index: xen/xen-unstable.hg/tools/examples/vtpm-delete
===================================================================xen-unstable.hg/tools/examples/vtpm-delete new file +12
-0@@ -0,0 +1,18 @@ +#!/bin/sh + +# This scripts must be called the following way: +# vtpm-delete <domain name> + +if [ $1 != "remove" ]; then + exec sh -c "bash $0 remove $*" +fi + + +XENBUS_PATH=" " +
Quoted 8 lines
xen-unstable.hg/tools/examples/vtpm-delete line 18
Quoted 6 lines
xen-unstable.hg/tools/examples/vtpm-delete new file +6
-0+dir=$(dirname "$0") +. "$dir/vtpm-common.sh" + +shift + +vtpm_delete_instance $1You are setting
XENBUS_PATHjust to hack your way into the hotplug
scripts,
Quoted 1 line
and then relying on the fact that
vtpm_delete_instancedoesn't actually
use
Quoted 1 line
that value. This is not a reasonable thing to be do. If there's a need
for a
Quoted 1 line
tpm-manipulating library, separate from the hotplug infrastructure, then
you
Quoted 1 line
should split
vtpm-common.shintovtpm-common.shand
vtpm-hotplug-common.sh (or
Quoted 3 lines
similar). Note that
vif-common.shincludesxen-hotplug-common.shandxen-network-common.sh-- these are split apart for exactly that reason (xen-network-common.shbeing used for the network-xyz scripts as well as
for
Quoted 1 line
the vif-xyz hotplugging scripts).
It's a hack, indeed. I will change that.
-- Stefan
Quoted 7 lines
Ewan.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 11 lines · Stefan Berger
Quoted 11 lines
xen-unstable.hg/tools/examples/vtpm-common.sh function find_instance () { · line 89
Quoted 9 lines
Index:
xen/xen-unstable.hg/tools/examples/vtpm-common.sh
===================================================================xen-unstable.hg/tools/examples/vtpm-common.sh +1
-1@@ -82,16 +85,15 @@ function find_instance () { if [ "$instance" != "" ]; then ret=1 fi - return $ret + res=$ret }Why have you made this change? Setting a global variable to return a
Quoted 6 lines
result
Quoted 1 line
as a side effect is poor style. This occurs a number of times in your
patch.
To get rid of the 'set +e' command I cannot return a number in the return statement, otherwise the script just terminates.
Got you. I prefer
foo()
{
echo '1'
}
...
thing=$(foo "$param1")
That way you avoid the global variable, but can still return useful things from the function. With this, you can even have more descriptive return values than integer codes, too.
Cheers,
Ewan.
[email protected] wrote on 02/22/2006 10:40:33 AM:
Quoted 2 lines · Stefan Berger
Ewan, if I cannot source the vtpm-hotplug-common.sh from the vtpm-delete anymore, I don't have access to the locking functions (claim_lock, release_lock) in vtpm-hotplug-common.sh which are needed by my script. May I separte those out to locking.sh so they can be 'sourced' by other scritps as well?
Stefan
Quoted 17 lines
Quoted 17 lines
Index: xen/xen-unstable.hg/tools/examples/vtpm-delete
===================================================================xen-unstable.hg/tools/examples/vtpm-delete new file +12
-0@@ -0,0 +1,18 @@ +#!/bin/sh + +# This scripts must be called the following way: +# vtpm-delete <domain name> + +if [ $1 != "remove" ]; then + exec sh -c "bash $0 remove $*" +fi + + +XENBUS_PATH=" " +
Quoted 8 lines
xen-unstable.hg/tools/examples/vtpm-delete line 18
Quoted 6 lines
xen-unstable.hg/tools/examples/vtpm-delete new file +6
-0+dir=$(dirname "$0") +. "$dir/vtpm-common.sh" + +shift + +vtpm_delete_instance $1You are setting
XENBUS_PATHjust to hack your way into the hotplug
scripts,
Quoted 1 line
and then relying on the fact that
vtpm_delete_instancedoesn't actually
use
Quoted 1 line
that value. This is not a reasonable thing to be do. If there's a need
for a
Quoted 1 line
tpm-manipulating library, separate from the hotplug infrastructure, then
you
Quoted 1 line
should split
vtpm-common.shintovtpm-common.shand
vtpm-hotplug-common.sh (or
Quoted 3 lines
similar). Note that
vif-common.shincludesxen-hotplug-common.shandxen-network-common.sh-- these are split apart for exactly that reason (xen-network-common.shbeing used for the network-xyz scripts as well as
for
Quoted 8 lines
the vif-xyz hotplugging scripts).
Ewan.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 10 lines · Stefan Berger
[email protected] wrote on 02/22/2006 10:40:33 AM:
Quoted 2 lines · Stefan Berger
Ewan, if I cannot source the
vtpm-hotplug-common.shfrom the vtpm-delete anymore, I don't have access to the locking functions (claim_lock,release_lock) invtpm-hotplug-common.shwhich are needed by my script. May I separte those out tolocking.shso they can be 'sourced' by other scritps as well?
Sure, that makes sense.
Ewan.