Skip to content

Commit 240dc17

Browse files
afreofgotthardp
authored andcommitted
README: cover containerized test execution
Signed-off-by: Adrian Freihofer <adrian.freihofer@gmail.com>
1 parent 14daa75 commit 240dc17

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

docs/INSTALL.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,29 @@ make check-code-coverage
159159
This will run the test suite (`make check`) and build a code coverage report
160160
detailing the code which was touched.
161161

162+
## Build and run all tests in a container
163+
164+
To make the test setup as reproducible as possible and to reduce the risk
165+
of damaging the real TPM, a container environment is also available.
166+
167+
Build and run a container with podman (Docker should work as well):
168+
169+
```sh
170+
TEST_CONTAINER=ubuntu-2204
171+
# TEST_CONTAINER=fedora-38
172+
podman build -f "test/Containerfiles/Containerfile.$TEST_CONTAINER" --tag "tpm2-openssl-build-$TEST_CONTAINER"
173+
podman run -it --name tpm2-openssl-1 -v "$(pwd):/build:Z" --rm --userns=keep-id \
174+
"localhost/tpm2-openssl-build-$TEST_CONTAINER" /bin/bash
175+
```
176+
177+
Run all tests with the swtpm simulator in the container:
178+
179+
```sh
180+
/build/test/run-with-simulator
181+
```
182+
183+
Run all tests with the IBM simulator in the container:
184+
185+
```sh
186+
/build/test/run-with-simulator ibm
187+
```

0 commit comments

Comments
 (0)