Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,14 @@ jobs:
run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi --env RUST_TOOLCHAIN_VERSION=1.74.0 ubuntucontainer /tmp/rust-tss-esapi/tss-esapi/tests/lint-checks.sh
- name: Check Clippy lints latest
run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi ubuntucontainer /tmp/rust-tss-esapi/tss-esapi/tests/lint-checks.sh

# Check that examples builds can be executed.
tests-examples:
name: Check examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Build the container
run: docker build -t ubuntucontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-ubuntu --target tpm2-abrmd
- name: Run the container
run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi ubuntucontainer /tmp/rust-tss-esapi/tss-esapi/tests/examples.sh
9 changes: 9 additions & 0 deletions tss-esapi/tests/Dockerfile-ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ RUN cd tpm2-tools \
&& ./configure \
&& make install

FROM tpm2-tools AS tpm2-abrmd
# Download and install TPM2 ABRMD
RUN git clone https://github.com/tpm2-software/tpm2-abrmd.git --branch 3.0.0
RUN cd tpm2-abrmd \
&& ./bootstrap \
&& ./configure \
&& make install \
&& ldconfig

FROM tpm2-tools AS tpm2-tss-install-dir
# TPM2_TSS_PATH is the env variable build.rs looks for
# an installation.
Expand Down
46 changes: 46 additions & 0 deletions tss-esapi/tests/examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash

# Copyright 2019 Contributors to the Parsec project.
# SPDX-License-Identifier: Apache-2.0

# This script builds and tests the examples.
# It can be run inside the container which Dockerfile
# is in the same folder.

set -euf -o pipefail

#################################################
# Change rust toolchain version
#################################################
if [[ ! -z ${RUST_TOOLCHAIN_VERSION:+x} ]]; then
rustup override set ${RUST_TOOLCHAIN_VERSION}
# Use the frozen Cargo lock to prevent any drift from MSRV being upgraded
# underneath our feet.
cp tests/Cargo.lock.frozen ../Cargo.lock
fi

#################################
# Run the TPM simulation server #
#################################
tpm_server &
sleep 5

####################
# Start tpm2-abrmd #
####################
tpm2-abrmd \
--logger=stdout \
--tcti=mssim \
--allow-root \
--session \
--flush-all &

#################
# Clear the TPM #
#################
tpm2_startup -clear -T tabrmd

####################
# Run the examples #
####################
TEST_TCTI=tabrmd: RUST_BACKTRACE=1 RUST_LOG=info cargo run --example certify
Loading