tpm2-tools/tests/runtest.sh
Štěpán Horáček a56816e41e tpm2-tools: Fix eventlog output
Resolves: rhbz#2136215

Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
2022-10-24 11:49:30 +02:00

51 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Update python command in tpm2-tools tests
pushd source/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
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