mirror of
https://github.com/stefanberger/swtpm.git
synced 2025-12-31 02:55:53 +00:00
Allow tests to run in parallel
Create uniqe names for the /dev/vtpm* so that tests can run in parallel. Also separate the state directories of the TPMs into individual temporary dirs. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
ec37bb56cb
commit
e150007d18
@ -41,6 +41,3 @@ EXTRA_DIST=$(TESTS) \
|
||||
data/tpmstate2/pwdfile.txt \
|
||||
data/tpmstate2/README \
|
||||
test_swtpm_cert
|
||||
|
||||
# Cannot run the tests in parallel...
|
||||
.NOTPARALLEL:
|
||||
|
||||
@ -3,36 +3,35 @@
|
||||
# For the license, see the LICENSE file in the root directory.
|
||||
#set -x
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Need to be root to run this test."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
MAJOR=255
|
||||
MINOR=100
|
||||
VTPM_NAME=$(printf "vtpm-%d-%d" $MAJOR $MINOR)
|
||||
export TPM_PATH=/tmp
|
||||
VTPM_NAME="vtpm-test-encrypted-state"
|
||||
export TPM_PATH=$(mktemp -d)
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
KEY=1234567890abcdef1234567890abcdef
|
||||
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Need to be root to run this test."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
keyfile=$(mktemp)
|
||||
logfile=$(mktemp)
|
||||
echo "$KEY" > $keyfile
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
pid=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
pid=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME " | gawk '{print $2}')
|
||||
if [ -n "$pid" ]; then
|
||||
kill -9 $pid
|
||||
fi
|
||||
rm -f $keyfile $logfile
|
||||
rm -rf $TPM_PATH
|
||||
}
|
||||
|
||||
trap "cleanup" EXIT
|
||||
@ -46,7 +45,7 @@ $SWTPM_EXE -n $VTPM_NAME --key file=$keyfile,mode=aes-cbc,format=hex \
|
||||
#sleep 20
|
||||
#echo "continuing"
|
||||
sleep 0.5
|
||||
PID=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
PID=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME " | gawk '{print $2}')
|
||||
|
||||
ps aux | grep $SWTPM | grep -v grep
|
||||
|
||||
@ -114,13 +113,13 @@ $CUSE_TPM_IOCTL -s /dev/$VTPM_NAME
|
||||
$SWTPM_EXE -n $VTPM_NAME --key file=$keyfile,mode=aes-cbc,format=hex,remove \
|
||||
--log file=$logfile
|
||||
sleep 0.5
|
||||
PID=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
PID=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME " | gawk '{print $2}')
|
||||
|
||||
ps aux | grep $SWTPM | grep -v grep
|
||||
|
||||
kill -0 $PID
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: CUSE TPM did not start."
|
||||
echo "Error (2): CUSE TPM did not start."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@ -3,29 +3,28 @@
|
||||
# For the license, see the LICENSE file in the root directory.
|
||||
#set -x
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
MAJOR=255
|
||||
MINOR=100
|
||||
VTPM_NAME=$(printf "vtpm-%d-%d" $MAJOR $MINOR)
|
||||
export TPM_PATH=/tmp
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Need to be root to run this test."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
VTPM_NAME="vtpm-test-getcap"
|
||||
export TPM_PATH=$(mktemp -d)
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
pid=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
pid=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
if [ -n "$pid" ]; then
|
||||
kill -9 $pid
|
||||
fi
|
||||
rm -rf $TPM_PATH
|
||||
}
|
||||
|
||||
trap "cleanup" EXIT
|
||||
@ -36,9 +35,10 @@ rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null
|
||||
|
||||
$SWTPM_EXE -n $VTPM_NAME
|
||||
sleep 0.5
|
||||
PID=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
PID=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
|
||||
ps aux | grep $SWTPM | grep -v grep
|
||||
ls -l /dev/vtpm*
|
||||
|
||||
kill -0 $PID
|
||||
if [ $? -ne 0 ]; then
|
||||
|
||||
@ -3,29 +3,28 @@
|
||||
# For the license, see the LICENSE file in the root directory.
|
||||
#set -x
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
MAJOR=255
|
||||
MINOR=100
|
||||
VTPM_NAME=$(printf "vtpm-%d-%d" $MAJOR $MINOR)
|
||||
export TPM_PATH=/tmp
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Need to be root to run this test."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
VTPM_NAME="vtpm-test-hashing"
|
||||
export TPM_PATH=$(mktemp -d)
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
pid=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
pid=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
if [ -n "$pid" ]; then
|
||||
kill -9 $pid
|
||||
fi
|
||||
rm -rf $TPM_PATH
|
||||
}
|
||||
|
||||
trap "cleanup" EXIT
|
||||
@ -36,7 +35,7 @@ rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null
|
||||
|
||||
$SWTPM_EXE -n $VTPM_NAME
|
||||
sleep 0.5
|
||||
PID=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
PID=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
|
||||
ps aux | grep $SWTPM | grep -v grep
|
||||
|
||||
|
||||
@ -3,29 +3,28 @@
|
||||
# For the license, see the LICENSE file in the root directory.
|
||||
#set -x
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
MAJOR=255
|
||||
MINOR=100
|
||||
VTPM_NAME=$(printf "vtpm-%d-%d" $MAJOR $MINOR)
|
||||
export TPM_PATH=/tmp
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Need to be root to run this test."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
VTPM_NAME="vtpm-test-hashing2"
|
||||
export TPM_PATH=$(mktemp -d)
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
pid=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
pid=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
if [ -n "$pid" ]; then
|
||||
kill -9 $pid
|
||||
fi
|
||||
rm -rf $TPM_PATH
|
||||
}
|
||||
|
||||
trap "cleanup" EXIT
|
||||
@ -36,7 +35,7 @@ rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null
|
||||
|
||||
$SWTPM_EXE -n $VTPM_NAME
|
||||
sleep 0.5
|
||||
PID=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
PID=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
|
||||
ps aux | grep $SWTPM | grep -v grep
|
||||
|
||||
|
||||
@ -3,29 +3,28 @@
|
||||
# For the license, see the LICENSE file in the root directory.
|
||||
#set -x
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
MAJOR=255
|
||||
MINOR=100
|
||||
VTPM_NAME=$(printf "vtpm-%d-%d" $MAJOR $MINOR)
|
||||
export TPM_PATH=/tmp
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Need to be root to run this test."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
VTPM_NAME="vtpm-test-init"
|
||||
export TPM_PATH=$(mktemp -d)
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
pid=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
pid=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
if [ -n "$pid" ]; then
|
||||
kill -9 $pid
|
||||
fi
|
||||
rm -rf $TPM_PATH
|
||||
}
|
||||
|
||||
trap "cleanup" EXIT
|
||||
@ -36,7 +35,7 @@ rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null
|
||||
|
||||
$SWTPM_EXE -n $VTPM_NAME
|
||||
sleep 0.5
|
||||
PID=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
PID=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
|
||||
ps aux | grep $SWTPM | grep -v grep
|
||||
|
||||
|
||||
@ -3,29 +3,28 @@
|
||||
# For the license, see the LICENSE file in the root directory.
|
||||
#set -x
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
MAJOR=255
|
||||
MINOR=100
|
||||
VTPM_NAME=$(printf "vtpm-%d-%d" $MAJOR $MINOR)
|
||||
export TPM_PATH=/tmp
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Need to be root to run this test."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
VTPM_NAME="vtpm-test-locality"
|
||||
export TPM_PATH=$(mktemp -d)
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
pid=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
pid=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
if [ -n "$pid" ]; then
|
||||
kill -9 $pid
|
||||
fi
|
||||
rm -rf $TPM_PATH
|
||||
}
|
||||
|
||||
trap "cleanup" EXIT
|
||||
@ -36,7 +35,7 @@ rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null
|
||||
|
||||
$SWTPM_EXE -n $VTPM_NAME
|
||||
sleep 0.5
|
||||
PID=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
PID=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
|
||||
ps aux | grep $SWTPM | grep -v grep
|
||||
|
||||
|
||||
@ -47,6 +47,11 @@ FILESIZES=(
|
||||
1712
|
||||
)
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Need to be root to run this test."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
SWTPM=swtpm
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
TCSD=`type -P tcsd`
|
||||
@ -57,12 +62,6 @@ TPMAUTHORING="$ROOT/src/swtpm_setup/swtpm_setup --config ${SWTPM_SETUP_CONF} --r
|
||||
PATH=${PWD}/${ROOT}/src/swtpm_bios:$PATH
|
||||
PATH=${PWD}/${ROOT}/src/swtpm_setup:$PATH
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Need to be root to run this test."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
|
||||
trap "cleanup" SIGTERM EXIT
|
||||
|
||||
if test "$TCSD" = ""; then
|
||||
|
||||
@ -3,19 +3,17 @@
|
||||
# For the license, see the LICENSE file in the root directory.
|
||||
#set -x
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Need to be root to run this test."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
MAJOR=255
|
||||
MINOR=100
|
||||
VTPM_NAME=$(printf "vtpm-%d-%d" $MAJOR $MINOR)
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Need to be root to run this test."
|
||||
exit 77
|
||||
fi
|
||||
VTPM_NAME="vtpm-test-resume-volatile"
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
|
||||
@ -3,29 +3,28 @@
|
||||
# For the license, see the LICENSE file in the root directory.
|
||||
#set -x
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
MAJOR=255
|
||||
MINOR=100
|
||||
VTPM_NAME=$(printf "vtpm-%d-%d" $MAJOR $MINOR)
|
||||
export TPM_PATH=/tmp
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Need to be root to run this test."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
VTPM_NAME="vtpm-test-volatilestate"
|
||||
export TPM_PATH=$(mktemp -d)
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
pid=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
pid=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
if [ -n "$pid" ]; then
|
||||
kill -9 $pid
|
||||
fi
|
||||
rm -rf $TPM_PATH
|
||||
}
|
||||
|
||||
trap "cleanup" EXIT
|
||||
@ -36,7 +35,7 @@ rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null
|
||||
|
||||
$SWTPM_EXE -n $VTPM_NAME
|
||||
sleep 0.5
|
||||
PID=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
PID=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
|
||||
ps aux | grep $SWTPM | grep -v grep
|
||||
|
||||
|
||||
@ -3,29 +3,28 @@
|
||||
# For the license, see the LICENSE file in the root directory.
|
||||
#set -x
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
MAJOR=255
|
||||
MINOR=100
|
||||
VTPM_NAME=$(printf "vtpm-%d-%d" $MAJOR $MINOR)
|
||||
export TPM_PATH=/tmp
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Need to be root to run this test."
|
||||
exit 77
|
||||
fi
|
||||
|
||||
DIR=$(dirname "$0")
|
||||
ROOT=${DIR}/..
|
||||
SWTPM=swtpm_cuse
|
||||
SWTPM_EXE=$ROOT/src/swtpm/$SWTPM
|
||||
CUSE_TPM_IOCTL=$ROOT/src/swtpm_ioctl/swtpm_ioctl
|
||||
VTPM_NAME="vtpm-test-wrongorder"
|
||||
export TPM_PATH=$(mktemp -d)
|
||||
STATE_FILE=$TPM_PATH/tpm-00.permall
|
||||
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
pid=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
pid=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
if [ -n "$pid" ]; then
|
||||
kill -9 $pid
|
||||
fi
|
||||
rm -rf $TPM_PATH
|
||||
}
|
||||
|
||||
trap "cleanup" EXIT
|
||||
@ -36,7 +35,7 @@ rm -f $STATE_FILE $VOLATILE_STATE_FILE 2>/dev/null
|
||||
|
||||
$SWTPM_EXE -n $VTPM_NAME
|
||||
sleep 0.5
|
||||
PID=$(ps aux | grep $SWTPM | grep $VTPM_NAME | gawk '{print $2}')
|
||||
PID=$(ps aux | grep $SWTPM | grep -E "$VTPM_NAME\$" | gawk '{print $2}')
|
||||
|
||||
ps aux | grep $SWTPM | grep -v grep
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user