Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a TPM simulator for the integration tests #107

Merged
merged 6 commits into from
Apr 24, 2019

Conversation

diabonas
Copy link
Member

Add a simple test harness to automatically start and use a TPM simulator for the integration tests. This is possible by using the TCTI environment variable introduced in #62, which is now enabled by default for this reason.

This has the following advantages:

  • Integration tests will run out of the box on any system.
  • There is no danger of clobbering data on an existing TPM.
  • The tests can be run in parallel.
  • The integration test scripts can be simplified because the environment configuration is done globally in the test harness.

Additionally this PR fixes #106 (upstream renaming of tpm2-tools options).

Closes #86

This has been changed upstream in
tpm2-software/tpm2-tools@11e5c70

Signed-off-by: Jonas Witschel <diabonas@gmx.de>
The environment variable is useful for configuring the integration
tests to use a TPM simulator.

Signed-off-by: Jonas Witschel <diabonas@gmx.de>
@diabonas diabonas force-pushed the issue-86 branch 5 times, most recently from e539976 to 1c09c4c Compare April 18, 2019 00:02
@codecov
Copy link

codecov bot commented Apr 18, 2019

Codecov Report

Merging #107 into master will increase coverage by 4.69%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #107      +/-   ##
==========================================
+ Coverage   62.73%   67.43%   +4.69%     
==========================================
  Files           9        9              
  Lines        1170     1176       +6     
==========================================
+ Hits          734      793      +59     
+ Misses        436      383      -53
Impacted Files Coverage Δ
src/tpm2-tss-engine.c 58.73% <0%> (+0.39%) ⬆️
src/tpm2-tss-engine-tcti.c 58.67% <0%> (+45.45%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a063e24...ffc049b. Read the comment docs.

@diabonas diabonas force-pushed the issue-86 branch 2 times, most recently from c9afa65 to 71d92f1 Compare April 18, 2019 07:09
Currently the integration tests use the first TPM they find on the system.
This commit starts a TPM simulator for every integration test and
configures the TCTI environment variable to use it, allowing parallel
execution of the tests.

Signed-off-by: Jonas Witschel <diabonas@gmx.de>
Setting the environment variables and clearing the TPM is now done in
the wrapper. Furthermore as we run in a temporary directory anyway,
there is no need for ${DIR} any more.

Signed-off-by: Jonas Witschel <diabonas@gmx.de>
Avoids a port conflict when running the tests in parallel.

Signed-off-by: Jonas Witschel <diabonas@gmx.de>
This is possible after the preceeding changes to the integration test
harness.

Signed-off-by: Jonas Witschel <diabonas@gmx.de>
Copy link
Member

@AndreasFuchsTPM AndreasFuchsTPM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests failing with latest tpm2.0-tools version Make integration tests use TPM simulator out of the box
2 participants