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

TEST: Fix test with ESYS and FAPI disabled. #2772

Merged
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
7 changes: 7 additions & 0 deletions Makefile-test.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ TESTS_CFLAGS = $(AM_CFLAGS) $(CRYPTO_CFLAGS) -I$(srcdir)/include -I$(srcdir)/src
TESTS_LDADD = $(check_LTLIBRARIES) $(lib_LTLIBRARIES) \
$(CRYPTO_LIBS) $(libutil) $(libutilio)

if ESYS
TESTS_CFLAGS += -DTEST_ESYS
endif
if FAPI
TESTS_CFLAGS += -DTEST_FAPI
endif

check_LTLIBRARIES =
# test harness configuration
TEST_EXTENSIONS = .int .fint
Expand Down
34 changes: 21 additions & 13 deletions test/integration/test-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
#include "tss2_tpm2_types.h"
#include "tss2_tctildr.h"
#include "tss2_mu.h"
#ifdef TEST_ESYS
#include "tss2_esys.h"

#endif
#define LOGMODULE test
#include "util/log.h"

Expand Down Expand Up @@ -51,6 +52,7 @@ struct tpm_state {
* thus the corresponding handling code in ESYS can be tested.
* The first invocation will be Tss2_Sys_StartUp.
*/
#ifdef TEST_ESYS

TSS2_RC
(*transmit_hook) (const uint8_t *command_buffer, size_t command_size) = NULL;
Expand Down Expand Up @@ -200,6 +202,7 @@ tcti_proxy_initialize(

return TSS2_RC_SUCCESS;
}
#endif /* TEST_ESYS */

int
transient_empty(TSS2_SYS_CONTEXT *sys_ctx)
Expand Down Expand Up @@ -418,6 +421,7 @@ test_sys_teardown(TSS2_TEST_SYS_CONTEXT *test_ctx)
}
}

#ifdef TEST_ESYS
int
test_esys_setup(TSS2_TEST_ESYS_CONTEXT **test_ctx)
{
Expand Down Expand Up @@ -556,18 +560,6 @@ test_esys_checks_post(TSS2_TEST_ESYS_CONTEXT *test_ctx)
return EXIT_SUCCESS;
}

int
test_fapi_checks_pre(TSS2_TEST_FAPI_CONTEXT *test_ctx)
{
return test_esys_checks_pre(&test_ctx->test_esys_ctx);
}

int
test_fapi_checks_post(TSS2_TEST_FAPI_CONTEXT *test_ctx)
{
return test_esys_checks_post(&test_ctx->test_esys_ctx);
}

void
test_esys_teardown(TSS2_TEST_ESYS_CONTEXT *test_ctx)
{
Expand All @@ -580,3 +572,19 @@ test_esys_teardown(TSS2_TEST_ESYS_CONTEXT *test_ctx)
free(test_ctx);
}
}

#endif /* TEST_ESYS */

#ifdef TEST_FAPI
int
test_fapi_checks_pre(TSS2_TEST_FAPI_CONTEXT *test_ctx)
{
return test_esys_checks_pre(&test_ctx->test_esys_ctx);
}

int
test_fapi_checks_post(TSS2_TEST_FAPI_CONTEXT *test_ctx)
{
return test_esys_checks_post(&test_ctx->test_esys_ctx);
}
#endif /* TEST_FAPI */
Loading