swtpm/tests/test_tpm2_print_states
Stefan Berger b1b9a6a4ab tests: Add test cases for using swtpm --print-states while swtpm is running
swtpm <0.8 tried to lock the .lock file when executing --print-states,
which then failed when another swtpm was holding the lock. This adds
a test case for this scenario.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2024-06-11 08:43:01 -04:00

34 lines
766 B
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}"
cd "$(dirname "$0")" || exit 1
export SWTPM_IFACE=cuse
bash _test_tpm2_print_states
ret=$?
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
export SWTPM_IFACE=socket
export SWTPM_INTERFACE=socket+socket
export SWTPM_SERVER_NAME=localhost
export SWTPM_SERVER_PORT=65470
export SWTPM_CTRL_PORT=65471
bash _test_tpm2_print_states
ret=$?
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
if test_swtpm_has_chardev "${SWTPM_EXE}"; then
export SWTPM_IFACE=chardev
bash _test_tpm2_print_states
ret=$?
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
else
echo "Skip: No chardev available"
fi
exit 0