tests: Convert test_samples_create_tpmca to run installed

Convert the TPM 1.2 test case test_samples_create_tpmca to be able to run
installed. It also needs to have the test_config file installed.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2024-09-13 13:02:46 -04:00 committed by Stefan Berger
parent f122f14a56
commit 02555ce58a
2 changed files with 12 additions and 7 deletions

View File

@ -231,7 +231,7 @@ testdir = $(libexecdir)/installed-tests/$(PACKAGE)
install-data-hook:
mkdir -p $(DESTDIR)$(testdir)
cd $(srcdir) && for file in $(EXTRA_DIST); do ./fileinstall "$$file" "$(DESTDIR)$(testdir)/$$file" ; done
cd $(srcdir) && for file in test_config $(EXTRA_DIST); do ./fileinstall "$$file" "$(DESTDIR)$(testdir)/$$file" ; done
echo "$(TESTS)" > $(DESTDIR)$(testdir)/tests
$(srcdir)/sed-inplace '/SWTPM_TEST_UNINSTALLED=1/d' $(DESTDIR)$(testdir)/common

View File

@ -22,12 +22,18 @@ SRCDIR=${abs_top_srcdir:-$(dirname "$0")/..}
PATH=$ROOT/src/swtpm:$PATH
source "${abs_top_builddir:-$(dirname "$0")/..}/tests/test_config"
source "${TESTDIR}/test_config"
source "${TESTDIR}/common"
SWTPM_SETUP=${ROOT}/src/swtpm_setup/swtpm_setup
SWTPM_CREATE_TPMCA=${SRCDIR}/samples/swtpm-create-tpmca
SWTPM_LOCALCA=${ROOT}/src/swtpm_localca/swtpm_localca
SWTPM_IOCTL=${ROOT}/src/swtpm_ioctl/swtpm_ioctl
if [ -n "${SWTPM_TEST_UNINSTALLED}" ]; then
SWTPM_CREATE_TPMCA=${SRCDIR}/samples/swtpm-create-tpmca
else
SWTPM_CREATE_TPMCA=/usr/share/swtpm/swtpm-create-tpmca
fi
if [ ! -x "${SWTPM_CREATE_TPMCA}" ]; then
echo "Could not find swtpm-create-tpmca"
exit 77
fi
SWTPM_INTERFACE=socket+socket
SWTPM_SERVER_NAME=localhost
@ -75,7 +81,6 @@ function cleanup()
}
trap "cleanup" SIGTERM EXIT
source "${TESTDIR}/common"
skip_test_no_tpm12 "${SWTPM_EXE}"
PATH=${ROOT}/src/swtpm_bios:${ROOT}/src/swtpm_cert:${PATH}