From d28f613667a6d64ced1d5e1dba8abb3bc41524cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Hor=C3=A1=C4=8Dek?= Date: Wed, 22 May 2024 15:41:36 +0200 Subject: [PATCH] Include tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves: RHEL-23199 Signed-off-by: Štěpán Horáček --- tests/runtest.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/tests.yml | 31 ++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100755 tests/runtest.sh create mode 100644 tests/tests.yml diff --git a/tests/runtest.sh b/tests/runtest.sh new file mode 100755 index 0000000..dfc7d5a --- /dev/null +++ b/tests/runtest.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +pushd source/test/integration +pushd tests +# some tests aren't executable currently. Needs to be fixed upstream. +chmod +x *.sh +popd +# copy the yaml comparison files (196e3d43) +cp fixtures/event-raw/event-*.yaml fixtures +popd + +TPM2_ABRMD=tpm2-abrmd +TPM2_SIM=swtpm +TPM2_TOOLS_TEST_FIXTURES=`pwd`/source/test/integration/fixtures +PATH=.:$PATH +abs_srcdir=`pwd`/source +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 +for t in `ls tests/*.sh` +do + f=`basename $t` + test=${f%%.*} + $test_drv --test-name $test --log-file $test.log --trs-file $test.trs $t +done +all=`grep ":test-result:" *.trs | wc -l`; +pass=`grep ":test-result: PASS" *.trs | wc -l`; +fail=`grep ":test-result: FAIL" *.trs | wc -l`; +skip=`grep ":test-result: SKIP" *.trs | wc -l`; +xfail=`grep ":test-result: XFAIL" *.trs | wc -l`; +xpass=`grep ":test-result: XPASS" *.trs | wc -l`; +error=`grep ":test-result: ERROR" *.trs | wc -l`; +if [[ $(($fail + $xpass + $error)) -eq 0 ]]; then + success=0 +else + success=1 +fi; +popd + +echo PASSED: $pass +echo FAILED: $fail +echo SKIPPED: $skip +echo XFAIL: $xfail +echo XPASS: $xpass +echo ERROR: $error + +exit $success + diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..217bf86 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,31 @@ +- 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 +