diff options
author | Stefan Berger <stefanb@linux.ibm.com> | 2018-11-14 10:07:08 -0500 |
---|---|---|
committer | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2018-11-16 07:40:57 -0500 |
commit | 992929a38f9c1889be1dfe9bb64bff5950291a27 (patch) | |
tree | 36511bf235908cf591df431dda499722a08256d0 /tests/scripts | |
parent | 6163954e59f6a1c948d035c147ba9d18b6ca4093 (diff) | |
download | gnutls-992929a38f9c1889be1dfe9bb64bff5950291a27.tar.gz |
tests: tpm: Add a test case for tpmtool
This test case exercises tpmtool and uses certtool to create a
self-signed certificate with the TPM. It uses swtpm as TPM emulator and
configures tcsd to talk to swtpm.
Extend the Readme.md with the packages needed for TPM support and TPM test
support.
This test case needs to be run as root since tcsd needs to be started
as root.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Diffstat (limited to 'tests/scripts')
-rw-r--r-- | tests/scripts/common.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/scripts/common.sh b/tests/scripts/common.sh index 10c25738dd..94333f19b3 100644 --- a/tests/scripts/common.sh +++ b/tests/scripts/common.sh @@ -212,3 +212,32 @@ create_testdir() { trap "test -e \"$d\" && rm -rf \"$d\"" 1 15 2 echo "$d" } + +wait_for_file() { + local filename="$1" + local timeout="$2" + + local loops=$((timeout * 10)) loop=0 + + while test $loop -lt $loops; do + [ -f "$filename" ] && { + #allow file to be written to + sleep 0.2 + return 1 + } + sleep 0.1 + loop=$((loop+1)) + done + return 0 +} + +# Kill a process quietly +# @1: signal, e.g. -9 +# @2: pid +kill_quiet() { + local sig="$1" + local pid="$2" + + sh -c "kill $sig $pid &>/dev/null" + return $? +} |