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

The Ubuntu (PPA) build system executes the build on an environment that has problems with seccomp profiles. It does not allow us to run the test suite with swtpm applying its seccomp profile since it fails with a 'bad system call' error. To work around this we introduce the env. variable SWTPM_TEST_SECCOMP_OPT that we can set to "--seccomp action=none" to avoid having swtpm apply it seccomp profile. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
60 lines
1.1 KiB
Bash
Executable File
60 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# For the license, see the LICENSE file in the root directory.
|
|
|
|
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
|
|
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
|
|
|
|
TPMDIR=`mktemp -d`
|
|
SWTPM_CTRL_UNIX_PATH=$TPMDIR/sock
|
|
PID_FILE=$TPMDIR/swtpm.pid
|
|
LOG_FILE=$TPMDIR/swtpm.log
|
|
|
|
source ${TESTDIR}/test_common
|
|
|
|
trap "cleanup" SIGTERM EXIT
|
|
|
|
function cleanup()
|
|
{
|
|
rm -rf $TPMDIR
|
|
if [ -n "$PID" ]; then
|
|
kill_quiet -SIGTERM $PID 2>/dev/null
|
|
fi
|
|
}
|
|
|
|
source ${TESTDIR}/common
|
|
|
|
if ! [[ "$(uname -s)" =~ Linux ]]; then
|
|
echo "Need Linux to run UnixIO test for CMD_SET_DATAFD."
|
|
exit 77
|
|
fi
|
|
|
|
# Test CMD_SET_DATAFD
|
|
cp ${TESTDIR}/data/tpmstate1/* ${TPMDIR}
|
|
$SWTPM_EXE socket \
|
|
--flags not-need-init \
|
|
--ctrl type=unixio,path=$SWTPM_CTRL_UNIX_PATH \
|
|
--tpmstate dir=$TPMDIR \
|
|
-t \
|
|
--pid file=$PID_FILE \
|
|
--log file=$LOG_FILE,level=20 \
|
|
${SWTPM_TEST_SECCOMP_OPT} &
|
|
PID=$!
|
|
|
|
if wait_for_file $PID_FILE 3; then
|
|
echo "Error: Socket TPM did not write pidfile."
|
|
exit 1
|
|
fi
|
|
|
|
LOG=$(SOCK_PATH=$SWTPM_CTRL_UNIX_PATH exec $TESTDIR/test_setdatafd.py)
|
|
res=$?
|
|
|
|
if [ $res -ne 0 ]; then
|
|
echo "Error: CMD_SET_DATAFD failed: $LOG"
|
|
exit 1
|
|
fi
|
|
|
|
echo "OK"
|
|
|
|
exit 0
|