-
Notifications
You must be signed in to change notification settings - Fork 366
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
test: rework FAPI integration test harness #2699
Comments
One remark: In the past I did debug FAPI with the following script:
I just replaced mssim with libtpms and it worked for test/integration/fapi-get-random.fint. So standalone debugging is already possible with libtpms in cert less mode. |
you marked the variables related to the used config and keystore paths. What exactly did you mean in this context with "no global state"? |
Ah, that is helpful, thanks.
I mainly meant the What I'd prefer having is a test context, like we have with sapi and esapi right now. This way, you can pass exactly what is needed by the function (either the whole context or members) to the function and it is instantly clear what is read/modified by the function. tpm2-tss/test/integration/test-common.h Lines 35 to 39 in 761d15a
tpm2-tss/test/integration/test-common.h Lines 46 to 51 in 761d15a
Admittedly this is not a huge deal or difficult to refactor, I was mentioning it more for completeness sake. |
yes it would be cleaner to use a TSS2_TEST_FAPI_CONTEXT. As you wrote the checks, the writing of the EK pub to a file and perhaps the computation of the EK fingerprint could be integrated into the FAPI main program. Could we call the former |
Agreed.
Technically we could, but I'd rather not have the (now currently self-sufficient) binaries call a shell to interpret some scripts. Could we maybe generate the stuff once and then use the same certificates for all the tests? If so, we could move the call to |
But you need the ek to generate the certificate. If you execute the provisioning with libtpms you will get a different ek for every call. |
The FAPI test harness has several issues and should be refactored.
What is done already
In #2640, we finally switched to tctildr and enabled libtpms for our integration tests. While I was at it, I cleaned up the sys and esys test harnesses. I did this for three reasons:
test/helper/tpm_startup.c
,test/helper/tpm_dumpstate.c
,test/helper/tpm_transientempty.c
, ...script/int-log-compiler.sh
,script/fint-log-compiler.sh
, ...)As a consequence, sys and esys can already run as standalone binaries. The dumpstate/transientempty/... logic is now part of the same binary and libtpms is loaded by tctildr if configured accordingly (currently via the mandatory env variable
TPM20TEST_TCTI
).What needs to be done still
The fapi test harness is very complex. I'd like to see the following things:
@JuergenReppSIT I need your support with 3.ii. When working on #2640, I started with this but realized this is not trivial. I don't know what exactly we are doing here, but I wonder if we can move some of this code to the c code for test setup and/or to
bootstrap.sh
. I'm open for other suggestions.Why
Firstly, this should simplify the code a lot. This alone should be reason enough. Secondly, this enables calling fapi tests standalone which makes e.g. debugging via gdb much easier. Lastly, switching to meson some day (#955) requires having standalone binaries, afaik (@AndreasFuchsTPM correct me if I'm wrong).
The text was updated successfully, but these errors were encountered: