|
| 1 | +name: tpm2-tools Tests |
| 2 | + |
| 3 | +# START OF COMMON SECTION |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [ 'master', 'main', 'release/**' ] |
| 7 | + pull_request: |
| 8 | + branches: [ '*' ] |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | +# END OF COMMON SECTION |
| 14 | + |
| 15 | +jobs: |
| 16 | + build_wolfprovider: |
| 17 | + uses: ./.github/workflows/build-wolfprovider.yml |
| 18 | + with: |
| 19 | + wolfssl_ref: ${{ matrix.wolfssl_ref }} |
| 20 | + openssl_ref: ${{ matrix.openssl_ref }} |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + wolfssl_ref: [ 'master', 'v5.8.0-stable' ] |
| 24 | + openssl_ref: [ 'openssl-3.5.0' ] |
| 25 | + |
| 26 | + test_tpm2_tools: |
| 27 | + runs-on: ubuntu-22.04 |
| 28 | + needs: build_wolfprovider |
| 29 | + # This should be a safe limit for the tests to run. |
| 30 | + timeout-minutes: 20 |
| 31 | + strategy: |
| 32 | + fail-fast: false |
| 33 | + matrix: |
| 34 | + tpm2_tools_ref: [ '5.7' ] |
| 35 | + wolfssl_ref: [ 'master', 'v5.8.0-stable' ] |
| 36 | + openssl_ref: [ 'openssl-3.5.0' ] |
| 37 | + force_fail: [ 'WOLFPROV_FORCE_FAIL=1', '' ] |
| 38 | + steps: |
| 39 | + - name: Checkout wolfProvider |
| 40 | + uses: actions/checkout@v4 |
| 41 | + with: |
| 42 | + fetch-depth: 1 |
| 43 | + |
| 44 | + - name: Retrieving wolfSSL/wolfProvider from cache |
| 45 | + uses: actions/cache/restore@v4 |
| 46 | + id: wolfprov-cache |
| 47 | + with: |
| 48 | + path: | |
| 49 | + wolfssl-install |
| 50 | + wolfprov-install |
| 51 | + openssl-install/lib64 |
| 52 | + openssl-install/include |
| 53 | + openssl-install/bin |
| 54 | +
|
| 55 | + key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }} |
| 56 | + fail-on-cache-miss: true |
| 57 | + |
| 58 | + - name: Install tpm2-tools test dependencies |
| 59 | + run: | |
| 60 | + sudo apt-get update |
| 61 | + sudo apt-get install -y git sudo autoconf expect vim dbus vim-common \ |
| 62 | + autoconf-archive python3 python3-yaml python3-pip libefivar-dev \ |
| 63 | + libcmocka-dev automake libtool pkg-config build-essential pandoc \ |
| 64 | + libtss2-dev tpm2-abrmd swtpm tpm2-tools iproute2 libcurl4-openssl-dev |
| 65 | +
|
| 66 | + - name: Download tpm2-tools |
| 67 | + uses: actions/checkout@v4 |
| 68 | + with: |
| 69 | + repository: tpm2-software/tpm2-tools |
| 70 | + ref: ${{ matrix.tpm2_tools_ref }} |
| 71 | + path: tpm2-tools |
| 72 | + fetch-depth: 1 |
| 73 | + |
| 74 | + - name: Build tpm2-tools |
| 75 | + working-directory: tpm2-tools |
| 76 | + run: | |
| 77 | + ./bootstrap |
| 78 | + ./configure \ |
| 79 | + --prefix="$GITHUB_WORKSPACE/tpm2-tools-install" \ |
| 80 | + --with-openssl="$GITHUB_WORKSPACE/openssl-install" \ |
| 81 | + --enable-unit |
| 82 | + make -j$(nproc) |
| 83 | +
|
| 84 | + - name: Run tpm2-tools tests |
| 85 | + working-directory: tpm2-tools |
| 86 | + run: | |
| 87 | + # Set up the environment for wolfProvider |
| 88 | + source $GITHUB_WORKSPACE/scripts/env-setup |
| 89 | + export ${{ matrix.force_fail }} |
| 90 | +
|
| 91 | + # Run only unit tests and integration tests that dont need TPM2 hardware/simulator |
| 92 | + make check TESTS="test/unit/test_string_bytes test/unit/test_files \ |
| 93 | + test/unit/test_tpm2_header test/unit/test_tpm2_attr_util test/unit/test_tpm2_alg_util \ |
| 94 | + test/unit/test_pcr test/unit/test_tpm2_auth_util test/unit/test_tpm2_errata \ |
| 95 | + test/unit/test_tpm2_session test/unit/test_tpm2_policy test/unit/test_tpm2_util \ |
| 96 | + test/unit/test_options test/unit/test_cc_util test/unit/test_tpm2_eventlog \ |
| 97 | + test/unit/test_tpm2_eventlog_yaml test/unit/test_object \ |
| 98 | + test/integration/tests/X509certutil test/integration/tests/toggle_options \ |
| 99 | + test/integration/tests/rc_decode test/integration/tests/X509certutil" 2>&1 | tee tpm2-tools-test.log |
| 100 | +
|
| 101 | + # Capture result - Fails test/unit/test_tpm2_policy and test/unit/test_tpm2_eventlog with WPFF |
| 102 | + TEST_RESULT=$(grep -q "# PASS: 20" tpm2-tools-test.log && echo "0" || echo "1") |
| 103 | + $GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} tpm2-tools |
0 commit comments