Update tests to tmt

Resolves: RHEL-94930

Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
This commit is contained in:
Štěpán Horáček 2025-05-29 15:59:00 +02:00
parent d91ac56102
commit 64018ac5ab
6 changed files with 42 additions and 72 deletions

View File

@ -1 +0,0 @@
1

36
ci.fmf
View File

@ -1,36 +0,0 @@
/keylime-e2e-tests-with-python-agent:
summary: run selected keylime e2e tests using Python keylime_agent
context:
swtpm: yes
agent: python
prepare:
- how: shell
script:
- dnf config-manager --set-enabled updates-testing
- systemctl disable --now dnf-makecache.service || true
- systemctl disable --now dnf-makecache.timer || true
discover:
how: fmf
url: https://github.com/RedHat-SP-Security/keylime-tests
ref: "@.tmt/dynamic_ref.fmf"
test:
- /setup/configure_tpm_emulator
- /setup/configure_kernel_ima_module/ima_policy_signing
- /setup/inject_SELinux_AVC_check
- /functional/basic-attestation-on-localhost
- /functional/measured-boot-swtpm-sanity
- /functional/ek-cert-use-ek_check_script
- /functional/ek-cert-use-ek_handle-custom-ca_certs
execute:
how: tmt
adjust:
- when: distro == fedora-rawhide
environment:
AVC_CHECK_AUSEARCH_PARAMS: "-se keylime"
because: "On Rawhide we ignore SELinux AVCs not related to keylime"

24
plan.fmf Normal file
View File

@ -0,0 +1,24 @@
summary: running tpm2-tools tests
prepare:
how: install
package:
- git
- automake
- openssl
- openssl-devel
- sed
- tpm2-tss
- tpm2-tss-devel
- tpm2-tools
- tpm2-abrmd
- tpm2-abrmd-selinux
- swtpm
- python3
- vim-common
- perl-Digest-SHA
- dbus-daemon
discover:
how: fmf
dist-git-source: true
execute:
how: tmt

View File

@ -1,7 +1,12 @@
#!/bin/bash
pushd source/test/integration
cd ../..
# Update python command in tpm2-tools tests
pushd source/tpm2-tools-5.7/test/integration
# sed -i -e 's/python/python3/g' helpers.sh
pushd tests
# sed -i -e 's/python/python3/g' *.sh
# some tests aren't executable currently. Needs to be fixed upstream.
chmod +x *.sh
popd
@ -11,14 +16,14 @@ popd
TPM2_ABRMD=tpm2-abrmd
TPM2_SIM=swtpm
TPM2_TOOLS_TEST_FIXTURES=`pwd`/source/test/integration/fixtures
TPM2_TOOLS_TEST_FIXTURES=`pwd`/source/tpm2-tools-5.7/test/integration/fixtures
PATH=.:$PATH
abs_srcdir=`pwd`/source
abs_srcdir=`pwd`/source/tpm2-tools-5.7
srcdir=$abs_srcdir
test_drv=`rpm -ql automake | grep test-driver`
export TPM2_ABRMD TPM2_SIM TPM2_TOOLS_TEST_FIXTURES PATH abs_srcdir srcdir
pushd source/test/integration
pushd source/tpm2-tools-5.7/test/integration
for t in `ls tests/*.sh`
do
f=`basename $t`
@ -37,6 +42,12 @@ if [[ $(($fail + $xpass + $error)) -eq 0 ]]; then
else
success=1
fi;
find
cat ./incrementalselftest.log
cat ./getekcertificate.log
cat ./pcrextend.log
popd
echo PASSED: $pass

3
tests/test.fmf Normal file
View File

@ -0,0 +1,3 @@
summary: upstream testsuite
test: ./runtest.sh
duration: 60m

View File

@ -1,31 +0,0 @@
- hosts: localhost
roles:
- role: standard-test-source
tags:
- always
required_packages:
- git
- role: standard-test-basic
tags:
- classic
required_packages:
- automake
- openssl
- openssl-devel
- sed
- tpm2-tss
- tpm2-tss-devel
- tpm2-tools
- tpm2-abrmd
- tpm2-abrmd-selinux
- swtpm
- python3
- vim-common
- perl-Digest-SHA
- dbus-daemon
tests:
- intel-tpm2:
dir: .
run: dbus-run-session ./runtest.sh
timeout: 60m