From b122768bc6b60c85f32f375752c2a0ae16a8b156 Mon Sep 17 00:00:00 2001 From: Jerry Snitselaar Date: Thu, 17 Jun 2021 11:27:21 -0700 Subject: [PATCH] tss2: add gating tests Add tss2 gating test for rhel9 builds. resolves: rhbz#1972900 Signed-off-by: Jerry Snitselaar --- gating.yaml | 6 +++++ tests/runtest.sh | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/tests.yml | 19 +++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 gating.yaml create mode 100755 tests/runtest.sh create mode 100644 tests/tests.yml diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..6985029 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-8 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/tests/runtest.sh b/tests/runtest.sh new file mode 100755 index 0000000..27a4c6a --- /dev/null +++ b/tests/runtest.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# get tpm simulator code +IBMTPM_VERSION=1637 +wget --no-check-certificate https://downloads.sourceforge.net/project/ibmswtpm2/ibmtpm$IBMTPM_VERSION.tar.gz + +res="$?" + +if [[ "$res" -ne 0 ]]; then + echo "wget failed" + exit 1 +fi + +# unpackage and build the source +mkdir ibmtpm +pushd ibmtpm +tar xf ../ibmtpm$IBMTPM_VERSION.tar.gz +pushd src +make + +res="$?" + +if [[ "$res" -ne 0 ]]; then + echo "make of ibmtpm failed" + popd + popd + rm -rf ibmtpm ibmtpm$IBMTPM_VERSION.tar.gz + exit 1 +fi + +(./tpm_server)& +popd +popd + +sleep 10 + +export TPM_INTERFACE_TYPE=socsim + +# get tss2 tests +TSS2_VERSION=v1.6.0 +git clone https://git.code.sf.net/p/ibmtpm20tss/tss +pushd tss +git checkout -b test $TSS2_VERSION +pushd utils +# fix python calls to use rhel name for python3 +sed -i -e 's/^PREFIX=\.\//PREFIX=tss/g' reg.sh +# fix paths in rootcerts.txt +c=`pwd` +sed -i -e "s|/gsa/yktgsa/home/k/g/kgold/tpm2/utils|${c}|g" certificates/rootcerts.txt +# run the tests +./reg.sh -a +res="$?" +popd +popd + +# clean up +pkill tpm_server +rm -rf ibmtpm ibmtpm$IBMTPM_VERSION.tar.gz tss + +exit $res diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..61285b2 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,19 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + required_packages: + - gcc + - make + - wget + - openssl + - openssl-devel + - sed + - tss2 + - git + tests: + - ibm-tss2: + dir: . + run: ./runtest.sh + timeout: 30m