From 64018ac5ab758188b3351a487f26f68b219faa96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Hor=C3=A1=C4=8Dek?= Date: Thu, 29 May 2025 15:59:00 +0200 Subject: [PATCH] Update tests to tmt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves: RHEL-94930 Signed-off-by: Štěpán Horáček --- .fmf/version | 1 - ci.fmf | 36 ------------------------------------ plan.fmf | 24 ++++++++++++++++++++++++ tests/runtest.sh | 19 +++++++++++++++---- tests/test.fmf | 3 +++ tests/tests.yml | 31 ------------------------------- 6 files changed, 42 insertions(+), 72 deletions(-) delete mode 100644 .fmf/version delete mode 100644 ci.fmf create mode 100644 plan.fmf create mode 100644 tests/test.fmf delete mode 100644 tests/tests.yml diff --git a/.fmf/version b/.fmf/version deleted file mode 100644 index d00491f..0000000 --- a/.fmf/version +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/ci.fmf b/ci.fmf deleted file mode 100644 index 19c7752..0000000 --- a/ci.fmf +++ /dev/null @@ -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" diff --git a/plan.fmf b/plan.fmf new file mode 100644 index 0000000..b5ce6dd --- /dev/null +++ b/plan.fmf @@ -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 diff --git a/tests/runtest.sh b/tests/runtest.sh index dfc7d5a..598485b 100755 --- a/tests/runtest.sh +++ b/tests/runtest.sh @@ -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 diff --git a/tests/test.fmf b/tests/test.fmf new file mode 100644 index 0000000..eeec447 --- /dev/null +++ b/tests/test.fmf @@ -0,0 +1,3 @@ +summary: upstream testsuite +test: ./runtest.sh +duration: 60m diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index 217bf86..0000000 --- a/tests/tests.yml +++ /dev/null @@ -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 -