ia64/xen-unstable

changeset 9049:8e3865296e31

Move files that have appeared in the wrong place due to incorrect patch -p setting.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Mon Feb 27 16:28:57 2006 +0100 (2006-02-27)
parents d741fa272309
children 38d9f4cbbc1e
files tools/examples/locking.sh tools/examples/logging.sh tools/examples/vtpm-delete tools/examples/vtpm-hotplug-common.sh 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/Makefile.am
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/examples/locking.sh	Mon Feb 27 16:28:57 2006 +0100
     1.3 @@ -0,0 +1,98 @@
     1.4 +#
     1.5 +# Copyright (c) 2005 XenSource Ltd.
     1.6 +#
     1.7 +# This library is free software; you can redistribute it and/or
     1.8 +# modify it under the terms of version 2.1 of the GNU Lesser General Public
     1.9 +# License as published by the Free Software Foundation.
    1.10 +#
    1.11 +# This library is distributed in the hope that it will be useful,
    1.12 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.13 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.14 +# Lesser General Public License for more details.
    1.15 +#
    1.16 +# You should have received a copy of the GNU Lesser General Public
    1.17 +# License along with this library; if not, write to the Free Software
    1.18 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.19 +#
    1.20 +
    1.21 +#
    1.22 +# Serialisation
    1.23 +#
    1.24 +
    1.25 +LOCK_SLEEPTIME=1
    1.26 +LOCK_SPINNING_RETRIES=5
    1.27 +LOCK_RETRIES=10
    1.28 +LOCK_BASEDIR=/var/run/xen-hotplug
    1.29 +
    1.30 +
    1.31 +claim_lock()
    1.32 +{
    1.33 +  local lockdir="$LOCK_BASEDIR/$1"
    1.34 +  mkdir -p "$LOCK_BASEDIR"
    1.35 +  _claim_lock "$lockdir"
    1.36 +}
    1.37 +
    1.38 +
    1.39 +release_lock()
    1.40 +{
    1.41 +  _release_lock "$LOCK_BASEDIR/$1"
    1.42 +}
    1.43 +
    1.44 +
    1.45 +_claim_lock()
    1.46 +{
    1.47 +  local lockdir="$1"
    1.48 +  local owner=$(_lock_owner "$lockdir")
    1.49 +  local retries=0
    1.50 +
    1.51 +  while [ $retries -lt $LOCK_RETRIES ]
    1.52 +  do
    1.53 +    mkdir "$lockdir" 2>/dev/null && trap "release_lock $1; sigerr" ERR &&
    1.54 +      _update_lock_info "$lockdir" && return
    1.55 +
    1.56 +    local new_owner=$(_lock_owner "$lockdir")
    1.57 +    if [ "$new_owner" != "$owner" ]
    1.58 +    then
    1.59 +      owner="$new_owner"
    1.60 +      retries=0
    1.61 +    fi
    1.62 +
    1.63 +    if [ $retries -gt $LOCK_SPINNING_RETRIES ]
    1.64 +    then
    1.65 +      sleep $LOCK_SLEEPTIME
    1.66 +    else
    1.67 +      sleep 0
    1.68 +    fi
    1.69 +    retries=$(($retries + 1))
    1.70 +  done
    1.71 +  _steal_lock "$lockdir"
    1.72 +}
    1.73 +
    1.74 +
    1.75 +_release_lock()
    1.76 +{
    1.77 +  trap sigerr ERR
    1.78 +  rm -rf "$1" 2>/dev/null || true
    1.79 +}
    1.80 +
    1.81 +
    1.82 +_steal_lock()
    1.83 +{
    1.84 +  local lockdir="$1"
    1.85 +  local owner=$(cat "$lockdir/owner" 2>/dev/null || echo "unknown")
    1.86 +  log err "Forced to steal lock on $lockdir from $owner!"
    1.87 +  _release_lock "$lockdir"
    1.88 +  _claim_lock "$lockdir"
    1.89 +}
    1.90 +
    1.91 +
    1.92 +_lock_owner()
    1.93 +{
    1.94 +  cat "$1/owner" 2>/dev/null || echo "unknown"
    1.95 +}
    1.96 +
    1.97 +
    1.98 +_update_lock_info()
    1.99 +{
   1.100 +  echo "$$: $0" >"$1/owner"
   1.101 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/examples/logging.sh	Mon Feb 27 16:28:57 2006 +0100
     2.3 @@ -0,0 +1,22 @@
     2.4 +#
     2.5 +# Copyright (c) 2005 XenSource Ltd.
     2.6 +#
     2.7 +# This library is free software; you can redistribute it and/or
     2.8 +# modify it under the terms of version 2.1 of the GNU Lesser General Public
     2.9 +# License as published by the Free Software Foundation.
    2.10 +#
    2.11 +# This library is distributed in the hope that it will be useful,
    2.12 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.13 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    2.14 +# Lesser General Public License for more details.
    2.15 +#
    2.16 +# You should have received a copy of the GNU Lesser General Public
    2.17 +# License along with this library; if not, write to the Free Software
    2.18 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2.19 +#
    2.20 +
    2.21 +log() {
    2.22 +  local level="$1"
    2.23 +  shift
    2.24 +  logger -p "daemon.$level" -- "$0:" "$@" || echo "$0 $@" >&2
    2.25 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tools/examples/vtpm-delete	Mon Feb 27 16:28:57 2006 +0100
     3.3 @@ -0,0 +1,9 @@
     3.4 +#!/bin/sh
     3.5 +
     3.6 +# This scripts must be called the following way:
     3.7 +# vtpm-delete <domain name>
     3.8 +
     3.9 +dir=$(dirname "$0")
    3.10 +. "$dir/vtpm-common.sh"
    3.11 +
    3.12 +vtpm_delete_instance $1
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/examples/vtpm-hotplug-common.sh	Mon Feb 27 16:28:57 2006 +0100
     4.3 @@ -0,0 +1,35 @@
     4.4 +#
     4.5 +# Copyright (c) 2005 IBM Corporation
     4.6 +# Copyright (c) 2005 XenSource Ltd.
     4.7 +#
     4.8 +# This library is free software; you can redistribute it and/or
     4.9 +# modify it under the terms of version 2.1 of the GNU Lesser General Public
    4.10 +# License as published by the Free Software Foundation.
    4.11 +#
    4.12 +# This library is distributed in the hope that it will be useful,
    4.13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    4.15 +# Lesser General Public License for more details.
    4.16 +#
    4.17 +# You should have received a copy of the GNU Lesser General Public
    4.18 +# License along with this library; if not, write to the Free Software
    4.19 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    4.20 +#
    4.21 +
    4.22 +dir=$(dirname "$0")
    4.23 +. "$dir/xen-hotplug-common.sh"
    4.24 +
    4.25 +findCommand "$@"
    4.26 +if [ "$command" != "online" ]  &&
    4.27 +   [ "$command" != "offline" ] &&
    4.28 +   [ "$command" != "add" ]     &&
    4.29 +   [ "$command" != "remove" ]
    4.30 +then
    4.31 +	log err "Invalid command: $command"
    4.32 +	exit 1
    4.33 +fi
    4.34 +
    4.35 +
    4.36 +XENBUS_PATH="${XENBUS_PATH:?}"
    4.37 +
    4.38 +. "$dir/vtpm-common.sh"
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py	Mon Feb 27 16:28:57 2006 +0100
     5.3 @@ -0,0 +1,45 @@
     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 +# Positive Test: create domain with virtual TPM attached at build time,
    5.10 +#                verify list
    5.11 +
    5.12 +
    5.13 +from XmTestLib import *
    5.14 +
    5.15 +def vtpm_cleanup(domName):
    5.16 +	# Since this is only a temporary domain I clean up the domain from the
    5.17 +	# virtual TPM directory
    5.18 +	traceCommand("/etc/xen/scripts/vtpm-delete %s" % domName)
    5.19 +
    5.20 +if ENABLE_HVM_SUPPORT:
    5.21 +    SKIP("vtpm-list not supported for HVM domains")
    5.22 +
    5.23 +config = {"vtpm":"instance=1,backend=0"}
    5.24 +domain = XmTestDomain(extraConfig=config)
    5.25 +
    5.26 +try:
    5.27 +    domain.start()
    5.28 +except DomainError, e:
    5.29 +    if verbose:
    5.30 +        print e.extra
    5.31 +    vtpm_cleanup(domain.getName())
    5.32 +    FAIL("Unable to create domain")
    5.33 +
    5.34 +domName = domain.getName()
    5.35 +
    5.36 +status, output = traceCommand("xm vtpm-list %s" % domain.getId())
    5.37 +eyecatcher = "/local/domain/0/backend/vtpm"
    5.38 +where = output.find(eyecatcher)
    5.39 +if status != 0:
    5.40 +    vtpm_cleanup(domName)
    5.41 +    FAIL("xm vtpm-list returned bad status, expected 0, status is %i" % status)
    5.42 +elif where < 0:
    5.43 +    vtpm_cleanup(domName)
    5.44 +    FAIL("Fail to list virtual TPM device")
    5.45 +
    5.46 +domain.stop()
    5.47 +
    5.48 +vtpm_cleanup(domName)
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py	Mon Feb 27 16:28:57 2006 +0100
     6.3 @@ -0,0 +1,81 @@
     6.4 +#!/usr/bin/python
     6.5 +
     6.6 +# Copyright (C) International Business Machines Corp., 2006
     6.7 +# Author: Stefan Berger <stefanb@us.ibm.com)
     6.8 +
     6.9 +# Positive Test: create domain with virtual TPM attached at build time,
    6.10 +#                check list of pcrs
    6.11 +
    6.12 +from XmTestLib import *
    6.13 +
    6.14 +def vtpm_cleanup(domName):
    6.15 +	# Since this is only a temporary domain I clean up the domain from the
    6.16 +	# virtual TPM directory
    6.17 +	traceCommand("/etc/xen/scripts/vtpm-delete %s" % domName)
    6.18 +
    6.19 +if ENABLE_HVM_SUPPORT:
    6.20 +    SKIP("vtpm-list not supported for HVM domains")
    6.21 +
    6.22 +status, output = traceCommand("ls /dev/tpm0")
    6.23 +if re.search("No such file or directory",output):
    6.24 +    SKIP("This machine has no hardware TPM; cannot run this test")
    6.25 +
    6.26 +status, output = traceCommand("ps aux | grep vtpm_manager | grep -v grep")
    6.27 +if output == "":
    6.28 +    FAIL("virtual TPM manager must be started to run this test")
    6.29 +
    6.30 +# vtpm manager has been detected
    6.31 +config = {"vtpm":"instance=1,backend=0"}
    6.32 +domain = XmTestDomain(extraConfig=config)
    6.33 +
    6.34 +try:
    6.35 +    domain.start()
    6.36 +except DomainError, e:
    6.37 +    if verbose:
    6.38 +        print e.extra
    6.39 +    vtpm_cleanup(domain.getName())
    6.40 +    FAIL("Unable to create domain")
    6.41 +
    6.42 +domName = domain.getName()
    6.43 +
    6.44 +try:
    6.45 +    console = XmConsole(domain.getName())
    6.46 +except ConsoleError, e:
    6.47 +    vtpm_cleanup(domName)
    6.48 +    FAIL(str(e))
    6.49 +
    6.50 +try:
    6.51 +    console.sendInput("input")
    6.52 +    run = console.runCmd("ls /sys")
    6.53 +except ConsoleError, e:
    6.54 +    saveLog(console.getHistory())
    6.55 +    vtpm_cleanup(domName)
    6.56 +    FAIL(str(e))
    6.57 +
    6.58 +if re.search("No such file",run["output"]):
    6.59 +    try:
    6.60 +        run = console.runCmd("mkdir /sys")
    6.61 +        run = console.runCmd("mount -t sysfs /sys /sys")
    6.62 +    except ConsoleError, e:
    6.63 +        saveLog(console.getHistory())
    6.64 +        vtpm_cleanup(domName)
    6.65 +        FAIL(str(e))
    6.66 +
    6.67 +try:
    6.68 +    run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
    6.69 +except ConsoleError, e:
    6.70 +    saveLog(console.getHistory())
    6.71 +    vtpm_cleanup(domName)
    6.72 +    FAIL(str(e))
    6.73 +
    6.74 +if re.search("No such file",run["output"]):
    6.75 +    FAIL("TPM frontend support not compiled into (domU?) kernel")
    6.76 +
    6.77 +console.closeConsole()
    6.78 +
    6.79 +domain.stop()
    6.80 +
    6.81 +vtpm_cleanup(domName)
    6.82 +
    6.83 +if not re.search("PCR-00:",run["output"]):
    6.84 +	FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side")
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/tools/xm-test/tests/vtpm/Makefile.am	Mon Feb 27 16:28:57 2006 +0100
     7.3 @@ -0,0 +1,22 @@
     7.4 +
     7.5 +SUBDIRS =
     7.6 +
     7.7 +TESTS = 01_vtpm-list_pos.test \
     7.8 +        02_vtpm-cat_pcrs.test
     7.9 +
    7.10 +XFAIL_TESTS =
    7.11 +
    7.12 +EXTRA_DIST = $(TESTS) $(XFAIL_TESTS)
    7.13 +
    7.14 +TESTS_ENVIRONMENT=@TENV@
    7.15 +
    7.16 +%.test: %.py
    7.17 +	cp $< $@
    7.18 +	chmod +x $@
    7.19 +
    7.20 +clean-local: am_config_clean-local
    7.21 +
    7.22 +am_config_clean-local:
    7.23 +	rm -f *test
    7.24 +	rm -f *log
    7.25 +	rm -f *~
     8.1 --- a/xen-unstable.hg/tools/examples/locking.sh	Mon Feb 27 16:14:11 2006 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,98 +0,0 @@
     8.4 -#
     8.5 -# Copyright (c) 2005 XenSource Ltd.
     8.6 -#
     8.7 -# This library is free software; you can redistribute it and/or
     8.8 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
     8.9 -# License as published by the Free Software Foundation.
    8.10 -#
    8.11 -# This library is distributed in the hope that it will be useful,
    8.12 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.13 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    8.14 -# Lesser General Public License for more details.
    8.15 -#
    8.16 -# You should have received a copy of the GNU Lesser General Public
    8.17 -# License along with this library; if not, write to the Free Software
    8.18 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    8.19 -#
    8.20 -
    8.21 -#
    8.22 -# Serialisation
    8.23 -#
    8.24 -
    8.25 -LOCK_SLEEPTIME=1
    8.26 -LOCK_SPINNING_RETRIES=5
    8.27 -LOCK_RETRIES=10
    8.28 -LOCK_BASEDIR=/var/run/xen-hotplug
    8.29 -
    8.30 -
    8.31 -claim_lock()
    8.32 -{
    8.33 -  local lockdir="$LOCK_BASEDIR/$1"
    8.34 -  mkdir -p "$LOCK_BASEDIR"
    8.35 -  _claim_lock "$lockdir"
    8.36 -}
    8.37 -
    8.38 -
    8.39 -release_lock()
    8.40 -{
    8.41 -  _release_lock "$LOCK_BASEDIR/$1"
    8.42 -}
    8.43 -
    8.44 -
    8.45 -_claim_lock()
    8.46 -{
    8.47 -  local lockdir="$1"
    8.48 -  local owner=$(_lock_owner "$lockdir")
    8.49 -  local retries=0
    8.50 -
    8.51 -  while [ $retries -lt $LOCK_RETRIES ]
    8.52 -  do
    8.53 -    mkdir "$lockdir" 2>/dev/null && trap "release_lock $1; sigerr" ERR &&
    8.54 -      _update_lock_info "$lockdir" && return
    8.55 -
    8.56 -    local new_owner=$(_lock_owner "$lockdir")
    8.57 -    if [ "$new_owner" != "$owner" ]
    8.58 -    then
    8.59 -      owner="$new_owner"
    8.60 -      retries=0
    8.61 -    fi
    8.62 -
    8.63 -    if [ $retries -gt $LOCK_SPINNING_RETRIES ]
    8.64 -    then
    8.65 -      sleep $LOCK_SLEEPTIME
    8.66 -    else
    8.67 -      sleep 0
    8.68 -    fi
    8.69 -    retries=$(($retries + 1))
    8.70 -  done
    8.71 -  _steal_lock "$lockdir"
    8.72 -}
    8.73 -
    8.74 -
    8.75 -_release_lock()
    8.76 -{
    8.77 -  trap sigerr ERR
    8.78 -  rm -rf "$1" 2>/dev/null || true
    8.79 -}
    8.80 -
    8.81 -
    8.82 -_steal_lock()
    8.83 -{
    8.84 -  local lockdir="$1"
    8.85 -  local owner=$(cat "$lockdir/owner" 2>/dev/null || echo "unknown")
    8.86 -  log err "Forced to steal lock on $lockdir from $owner!"
    8.87 -  _release_lock "$lockdir"
    8.88 -  _claim_lock "$lockdir"
    8.89 -}
    8.90 -
    8.91 -
    8.92 -_lock_owner()
    8.93 -{
    8.94 -  cat "$1/owner" 2>/dev/null || echo "unknown"
    8.95 -}
    8.96 -
    8.97 -
    8.98 -_update_lock_info()
    8.99 -{
   8.100 -  echo "$$: $0" >"$1/owner"
   8.101 -}
     9.1 --- a/xen-unstable.hg/tools/examples/logging.sh	Mon Feb 27 16:14:11 2006 +0100
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,22 +0,0 @@
     9.4 -#
     9.5 -# Copyright (c) 2005 XenSource Ltd.
     9.6 -#
     9.7 -# This library is free software; you can redistribute it and/or
     9.8 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
     9.9 -# License as published by the Free Software Foundation.
    9.10 -#
    9.11 -# This library is distributed in the hope that it will be useful,
    9.12 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.13 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.14 -# Lesser General Public License for more details.
    9.15 -#
    9.16 -# You should have received a copy of the GNU Lesser General Public
    9.17 -# License along with this library; if not, write to the Free Software
    9.18 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    9.19 -#
    9.20 -
    9.21 -log() {
    9.22 -  local level="$1"
    9.23 -  shift
    9.24 -  logger -p "daemon.$level" -- "$0:" "$@" || echo "$0 $@" >&2
    9.25 -}
    10.1 --- a/xen-unstable.hg/tools/examples/vtpm-delete	Mon Feb 27 16:14:11 2006 +0100
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,9 +0,0 @@
    10.4 -#!/bin/sh
    10.5 -
    10.6 -# This scripts must be called the following way:
    10.7 -# vtpm-delete <domain name>
    10.8 -
    10.9 -dir=$(dirname "$0")
   10.10 -. "$dir/vtpm-common.sh"
   10.11 -
   10.12 -vtpm_delete_instance $1
    11.1 --- a/xen-unstable.hg/tools/examples/vtpm-hotplug-common.sh	Mon Feb 27 16:14:11 2006 +0100
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,35 +0,0 @@
    11.4 -#
    11.5 -# Copyright (c) 2005 IBM Corporation
    11.6 -# Copyright (c) 2005 XenSource Ltd.
    11.7 -#
    11.8 -# This library is free software; you can redistribute it and/or
    11.9 -# modify it under the terms of version 2.1 of the GNU Lesser General Public
   11.10 -# License as published by the Free Software Foundation.
   11.11 -#
   11.12 -# This library is distributed in the hope that it will be useful,
   11.13 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.14 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   11.15 -# Lesser General Public License for more details.
   11.16 -#
   11.17 -# You should have received a copy of the GNU Lesser General Public
   11.18 -# License along with this library; if not, write to the Free Software
   11.19 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   11.20 -#
   11.21 -
   11.22 -dir=$(dirname "$0")
   11.23 -. "$dir/xen-hotplug-common.sh"
   11.24 -
   11.25 -findCommand "$@"
   11.26 -if [ "$command" != "online" ]  &&
   11.27 -   [ "$command" != "offline" ] &&
   11.28 -   [ "$command" != "add" ]     &&
   11.29 -   [ "$command" != "remove" ]
   11.30 -then
   11.31 -	log err "Invalid command: $command"
   11.32 -	exit 1
   11.33 -fi
   11.34 -
   11.35 -
   11.36 -XENBUS_PATH="${XENBUS_PATH:?}"
   11.37 -
   11.38 -. "$dir/vtpm-common.sh"
    12.1 --- a/xen-unstable.hg/tools/xm-test/tests/vtpm/01_vtpm-list_pos.py	Mon Feb 27 16:14:11 2006 +0100
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,45 +0,0 @@
    12.4 -#!/usr/bin/python
    12.5 -
    12.6 -# Copyright (C) International Business Machines Corp., 2006
    12.7 -# Author: Stefan Berger <stefanb@us.ibm.com)
    12.8 -
    12.9 -# Positive Test: create domain with virtual TPM attached at build time,
   12.10 -#                verify list
   12.11 -
   12.12 -
   12.13 -from XmTestLib import *
   12.14 -
   12.15 -def vtpm_cleanup(domName):
   12.16 -	# Since this is only a temporary domain I clean up the domain from the
   12.17 -	# virtual TPM directory
   12.18 -	traceCommand("/etc/xen/scripts/vtpm-delete %s" % domName)
   12.19 -
   12.20 -if ENABLE_HVM_SUPPORT:
   12.21 -    SKIP("vtpm-list not supported for HVM domains")
   12.22 -
   12.23 -config = {"vtpm":"instance=1,backend=0"}
   12.24 -domain = XmTestDomain(extraConfig=config)
   12.25 -
   12.26 -try:
   12.27 -    domain.start()
   12.28 -except DomainError, e:
   12.29 -    if verbose:
   12.30 -        print e.extra
   12.31 -    vtpm_cleanup(domain.getName())
   12.32 -    FAIL("Unable to create domain")
   12.33 -
   12.34 -domName = domain.getName()
   12.35 -
   12.36 -status, output = traceCommand("xm vtpm-list %s" % domain.getId())
   12.37 -eyecatcher = "/local/domain/0/backend/vtpm"
   12.38 -where = output.find(eyecatcher)
   12.39 -if status != 0:
   12.40 -    vtpm_cleanup(domName)
   12.41 -    FAIL("xm vtpm-list returned bad status, expected 0, status is %i" % status)
   12.42 -elif where < 0:
   12.43 -    vtpm_cleanup(domName)
   12.44 -    FAIL("Fail to list virtual TPM device")
   12.45 -
   12.46 -domain.stop()
   12.47 -
   12.48 -vtpm_cleanup(domName)
    13.1 --- a/xen-unstable.hg/tools/xm-test/tests/vtpm/02_vtpm-cat_pcrs.py	Mon Feb 27 16:14:11 2006 +0100
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,81 +0,0 @@
    13.4 -#!/usr/bin/python
    13.5 -
    13.6 -# Copyright (C) International Business Machines Corp., 2006
    13.7 -# Author: Stefan Berger <stefanb@us.ibm.com)
    13.8 -
    13.9 -# Positive Test: create domain with virtual TPM attached at build time,
   13.10 -#                check list of pcrs
   13.11 -
   13.12 -from XmTestLib import *
   13.13 -
   13.14 -def vtpm_cleanup(domName):
   13.15 -	# Since this is only a temporary domain I clean up the domain from the
   13.16 -	# virtual TPM directory
   13.17 -	traceCommand("/etc/xen/scripts/vtpm-delete %s" % domName)
   13.18 -
   13.19 -if ENABLE_HVM_SUPPORT:
   13.20 -    SKIP("vtpm-list not supported for HVM domains")
   13.21 -
   13.22 -status, output = traceCommand("ls /dev/tpm0")
   13.23 -if re.search("No such file or directory",output):
   13.24 -    SKIP("This machine has no hardware TPM; cannot run this test")
   13.25 -
   13.26 -status, output = traceCommand("ps aux | grep vtpm_manager | grep -v grep")
   13.27 -if output == "":
   13.28 -    FAIL("virtual TPM manager must be started to run this test")
   13.29 -
   13.30 -# vtpm manager has been detected
   13.31 -config = {"vtpm":"instance=1,backend=0"}
   13.32 -domain = XmTestDomain(extraConfig=config)
   13.33 -
   13.34 -try:
   13.35 -    domain.start()
   13.36 -except DomainError, e:
   13.37 -    if verbose:
   13.38 -        print e.extra
   13.39 -    vtpm_cleanup(domain.getName())
   13.40 -    FAIL("Unable to create domain")
   13.41 -
   13.42 -domName = domain.getName()
   13.43 -
   13.44 -try:
   13.45 -    console = XmConsole(domain.getName())
   13.46 -except ConsoleError, e:
   13.47 -    vtpm_cleanup(domName)
   13.48 -    FAIL(str(e))
   13.49 -
   13.50 -try:
   13.51 -    console.sendInput("input")
   13.52 -    run = console.runCmd("ls /sys")
   13.53 -except ConsoleError, e:
   13.54 -    saveLog(console.getHistory())
   13.55 -    vtpm_cleanup(domName)
   13.56 -    FAIL(str(e))
   13.57 -
   13.58 -if re.search("No such file",run["output"]):
   13.59 -    try:
   13.60 -        run = console.runCmd("mkdir /sys")
   13.61 -        run = console.runCmd("mount -t sysfs /sys /sys")
   13.62 -    except ConsoleError, e:
   13.63 -        saveLog(console.getHistory())
   13.64 -        vtpm_cleanup(domName)
   13.65 -        FAIL(str(e))
   13.66 -
   13.67 -try:
   13.68 -    run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
   13.69 -except ConsoleError, e:
   13.70 -    saveLog(console.getHistory())
   13.71 -    vtpm_cleanup(domName)
   13.72 -    FAIL(str(e))
   13.73 -
   13.74 -if re.search("No such file",run["output"]):
   13.75 -    FAIL("TPM frontend support not compiled into (domU?) kernel")
   13.76 -
   13.77 -console.closeConsole()
   13.78 -
   13.79 -domain.stop()
   13.80 -
   13.81 -vtpm_cleanup(domName)
   13.82 -
   13.83 -if not re.search("PCR-00:",run["output"]):
   13.84 -	FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side")
    14.1 --- a/xen-unstable.hg/tools/xm-test/tests/vtpm/Makefile.am	Mon Feb 27 16:14:11 2006 +0100
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,22 +0,0 @@
    14.4 -
    14.5 -SUBDIRS =
    14.6 -
    14.7 -TESTS = 01_vtpm-list_pos.test \
    14.8 -        02_vtpm-cat_pcrs.test
    14.9 -
   14.10 -XFAIL_TESTS =
   14.11 -
   14.12 -EXTRA_DIST = $(TESTS) $(XFAIL_TESTS)
   14.13 -
   14.14 -TESTS_ENVIRONMENT=@TENV@
   14.15 -
   14.16 -%.test: %.py
   14.17 -	cp $< $@
   14.18 -	chmod +x $@
   14.19 -
   14.20 -clean-local: am_config_clean-local
   14.21 -
   14.22 -am_config_clean-local:
   14.23 -	rm -f *test
   14.24 -	rm -f *log
   14.25 -	rm -f *~