mirror of
https://github.com/stefanberger/swtpm.git
synced 2025-08-22 19:04:35 +00:00

Add a test case that monitors the locking of the storage by swtpm using the directory storage backend to ensure that the lock is taken at the right time and released when required. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
48 lines
1.2 KiB
Bash
Executable File
48 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
|
|
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
|
|
source ${TESTDIR}/common
|
|
skip_test_no_tpm20 "${SWTPM_EXE}"
|
|
|
|
if [ ! -d /proc/$$/fd ] && [ -z "$(type -P lsof)" ]; then
|
|
echo "This test needs procfs process file descriptor support or 'lsof'"
|
|
exit 77
|
|
fi
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
export SWTPM_IOCTL_BUFFERSIZE=100
|
|
export SWTPM_INTERFACE=cuse
|
|
bash _test_tpm2_save_load_state_locking
|
|
ret=$?
|
|
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
|
|
|
|
export SWTPM_IOCTL_BUFFERSIZE=4096
|
|
export SWTPM_INTERFACE=cuse
|
|
bash _test_tpm2_save_load_state_locking
|
|
ret=$?
|
|
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
|
|
|
|
export SWTPM_INTERFACE=socket+socket
|
|
export SWTPM_SERVER_NAME=localhost
|
|
export SWTPM_SERVER_PORT=65466
|
|
export SWTPM_CTRL_PORT=65467
|
|
bash _test_tpm2_save_load_state_locking
|
|
ret=$?
|
|
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
|
|
|
|
export SWTPM_INTERFACE=socket+unix
|
|
export SWTPM_SERVER_NAME=localhost
|
|
export SWTPM_SERVER_PORT=65466
|
|
bash _test_tpm2_save_load_state_locking
|
|
ret=$?
|
|
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
|
|
|
|
export SWTPM_INTERFACE=unix+unix
|
|
bash _test_tpm2_save_load_state_locking
|
|
ret=$?
|
|
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
|
|
|
|
exit 0
|