|
| 1 | +name: tpm2-tss Tests |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ 'master', 'main', 'release/**' ] |
| 5 | + pull_request: |
| 6 | + branches: [ '*' ] |
| 7 | +concurrency: |
| 8 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +jobs: |
| 12 | + build_wolfprovider: |
| 13 | + uses: ./.github/workflows/build-wolfprovider.yml |
| 14 | + with: |
| 15 | + wolfssl_ref: ${{ matrix.wolfssl_ref }} |
| 16 | + openssl_ref: ${{ matrix.openssl_ref }} |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + wolfssl_ref: [ 'master', 'v5.8.0-stable' ] |
| 20 | + openssl_ref: [ 'openssl-3.5.0' ] |
| 21 | + |
| 22 | + test_tpm2_tss: |
| 23 | + runs-on: ubuntu-22.04 |
| 24 | + needs: build_wolfprovider |
| 25 | + timeout-minutes: 30 |
| 26 | + strategy: |
| 27 | + matrix: |
| 28 | + wolfssl_ref: [ 'master', 'v5.8.0-stable' ] |
| 29 | + openssl_ref: [ 'openssl-3.5.0' ] |
| 30 | + tpm2_tss_ref: [ 'master', '4.1.3'] |
| 31 | + force_fail: [ 'WOLFPROV_FORCE_FAIL=1', '' ] |
| 32 | + exclude: |
| 33 | + - tpm2_tss_ref: 'master' |
| 34 | + force_fail: 'WOLFPROV_FORCE_FAIL=1' |
| 35 | + steps: |
| 36 | + - name: Checkout wolfProvider |
| 37 | + uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + fetch-depth: 1 |
| 40 | + - name: Retrieving wolfSSL/wolfProvider from cache |
| 41 | + uses: actions/cache/restore@v4 |
| 42 | + id: wolfprov-cache |
| 43 | + with: |
| 44 | + path: | |
| 45 | + wolfssl-install |
| 46 | + wolfprov-install |
| 47 | + openssl-install/lib64 |
| 48 | + openssl-install/include |
| 49 | + openssl-install/bin |
| 50 | + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} |
| 51 | + fail-on-cache-miss: true |
| 52 | + |
| 53 | + # Replace system openssl with our version |
| 54 | + - name: Setup OpenSSL |
| 55 | + run: | |
| 56 | + OPENSSL_SYSTEM=$(which openssl) |
| 57 | + sudo rm ${OPENSSL_SYSTEM} |
| 58 | + sudo ln -s $GITHUB_WORKSPACE/openssl-install/bin/openssl ${OPENSSL_SYSTEM} |
| 59 | + - name: Install test dependencies |
| 60 | + run: | |
| 61 | + sudo apt-get update |
| 62 | + sudo apt-get install -y pkg-config libcunit1-dev autoconf-archive \ |
| 63 | + gettext libcmocka-dev build-essential autoconf automake libtool \ |
| 64 | + libjson-c-dev libcurl4-openssl-dev acl libusb-1.0-0-dev |
| 65 | + # ensure libssl-dev is not installed |
| 66 | + - name: Ensure libssl-dev is not installed |
| 67 | + run: | |
| 68 | + if dpkg -l | grep -q libssl-dev; then |
| 69 | + echo "libssl-dev is installed, removing it to avoid conflicts" |
| 70 | + sudo apt-get remove -y libssl-dev |
| 71 | + else |
| 72 | + echo "libssl-dev is not installed, no action needed" |
| 73 | + fi |
| 74 | + - name: Checkout tpm2-tss |
| 75 | + uses: actions/checkout@v4 |
| 76 | + with: |
| 77 | + repository: tpm2-software/tpm2-tss |
| 78 | + path: tpm2_tss_repo |
| 79 | + ref: ${{ matrix.tpm2_tss_ref }} |
| 80 | + fetch-depth: 1 |
| 81 | + |
| 82 | + # Apply patch to fix missing stdint.h includes in test files |
| 83 | + - name: Apply patch for test source files |
| 84 | + working-directory: tpm2_tss_repo |
| 85 | + if: ${{ matrix.tpm2_tss_ref }} == '4.1.3' |
| 86 | + run: | |
| 87 | + perl -pi -e 's|(#include <cmocka\.h>)|#include <stdint.h>\n$1|' ./test/unit/*.c |
| 88 | + - name: Build and install tpm2-tss |
| 89 | + working-directory: tpm2_tss_repo |
| 90 | + run: | |
| 91 | + source $GITHUB_WORKSPACE/scripts/env-setup |
| 92 | + ./bootstrap |
| 93 | + ./configure --prefix=$PWD/tpm2-tss-install --with-crypto=ossl \ |
| 94 | + --enable-unit --includedir=$GITHUB_WORKSPACE/openssl-install/include |
| 95 | + make -j$(nproc) |
| 96 | + make install |
| 97 | + - name: Run tpm2-tss tests |
| 98 | + working-directory: tpm2_tss_repo |
| 99 | + run: | |
| 100 | + source $GITHUB_WORKSPACE/scripts/env-setup |
| 101 | + export ${{ matrix.force_fail }} |
| 102 | + make check 2>&1 || true |
| 103 | + if $(grep -q "FAIL: test/unit" test-suite.log); then |
| 104 | + TEST_RESULT=1 |
| 105 | + echo "Expected zero failures" |
| 106 | + else |
| 107 | + TEST_RESULT=0 |
| 108 | + fi |
| 109 | + $GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} tpm2-tss |
0 commit comments