#;**********************************************************************;
# Copyright (c) 2015 - 2018 Intel Corporation
# Copyright (c) 2018 Fraunhofer SIT sponsored by Infineon Technologies AG
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without 
# modification, are permitted provided that the following conditions are met:
# 
# 1. Redistributions of source code must retain the above copyright notice, 
# this list of conditions and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright notice, 
# this list of conditions and the following disclaimer in the documentation 
# and/or other materials provided with the distribution.
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
# THE POSSIBILITY OF SUCH DAMAGE.
#;**********************************************************************;

TESTS_CFLAGS = $(AM_CFLAGS) $(LIBCRYPTO_CFLAGS) -I$(srcdir)/src/tss2-mu \
    -I$(srcdir)/src/tss2-sys -I$(srcdir)/src/tss2-esys \
    -Wno-unused-parameter -Wno-missing-field-initializers
TESTS_LDADD = $(noinst_LTLIBRARIES) $(lib_LTLIBRARIES) $(LIBCRYPTO_LIBS) $(libutil)

# test harness configuration
TEST_EXTENSIONS = .int
if TESTPTPM
INT_LOG_COMPILER = $(srcdir)/script/int-log-compiler-ptpm.sh
INT_LOG_FLAGS = --ptpm=$(PTPM)
else
INT_LOG_COMPILER = $(srcdir)/script/int-log-compiler.sh
endif
EXTRA_DIST += $(srcdir)/script/int-log-compiler.sh $(srcdir)/script/int-log-compiler-ptpm.sh
AM_TESTS_ENVIRONMENT = PATH="$(PATH)"

check-programs: $(check_PROGRAMS)

check_PROGRAMS = $(TESTS_UNIT) $(TESTS_INTEGRATION)
TESTS = $(check_PROGRAMS)

if ENABLE_INTEGRATION
noinst_PROGRAMS += test/helper/tpm_startup
test_helper_tpm_startup_CFLAGS = $(TESTS_CFLAGS) -I$(srcdir)/test/integration
test_helper_tpm_startup_LDFLAGS = $(TESTS_LDFLAGS)
test_helper_tpm_startup_LDADD = $(TESTS_LDADD)
test_helper_tpm_startup_SOURCES = test/helper/tpm_startup.c

noinst_PROGRAMS += test/helper/tpm_transientempty
test_helper_tpm_transientempty_CFLAGS = $(TESTS_CFLAGS) -I$(srcdir)/test/integration
test_helper_tpm_transientempty_LDFLAGS = $(TESTS_LDFLAGS)
test_helper_tpm_transientempty_LDADD = $(TESTS_LDADD)
test_helper_tpm_transientempty_SOURCES = test/helper/tpm_transientempty.c
endif #ENABLE_INTEGRATION

if ESYS_OSSL
ESYSCRY_CFLAGS = -DOSSL
ESYSCRY_LDFLAGS = -lssl -lcrypto -ldl
else
if ESYS_GCRYPT
ESYSCRY_CFLAGS =
ESYSCRY_LDFLAGS = -lgcrypt -ldl
endif
endif

if UNIT
TESTS_UNIT  = \
    test/unit/CommonPreparePrologue \
    test/unit/CopyCommandHeader \
    test/unit/GetNumHandles \
    test/unit/io \
    test/unit/key-value-parse \
    test/unit/tcti-device \
    test/unit/tcti-mssim \
    test/unit/UINT8-marshal \
    test/unit/UINT16-marshal \
    test/unit/UINT32-marshal \
    test/unit/UINT64-marshal \
    test/unit/TPMA-marshal \
    test/unit/TPM2B-marshal \
    test/unit/TPMS-marshal \
    test/unit/TPML-marshal \
    test/unit/TPMT-marshal \
    test/unit/TPMU-marshal
if ESAPI
TESTS_UNIT += \
    test/unit/esys-context-null \
    test/unit/esys-default-tcti \
    test/unit/esys-resubmissions \
    test/unit/esys-sequence-finish \
    test/unit/esys-tcti-rcs \
    test/unit/esys-tpm-rcs \
    test/unit/esys-getpollhandles \
    test/unit/esys-nulltcti \
    test/unit/esys-crypto 
endif ESAPI
endif #UNIT

if ENABLE_INTEGRATION
noinst_LTLIBRARIES += test/integration/libtest_utils.la

if TESTPTPM
TESTS_INTEGRATION =
endif
if !TESTPTPM
TESTS_INTEGRATION = \
    test/integration/sapi-asymmetric-encrypt-decrypt.int \
    test/integration/sapi-primary-rsa-2K-aes128cfb.int \
    test/integration/sapi-create-keyedhash-sha1-hmac.int \
    test/integration/sapi-encrypt-decrypt.int \
    test/integration/sapi-encrypt-decrypt-2.int \
    test/integration/sapi-evict-ctrl.int \
    test/integration/sapi-get-random.int \
    test/integration/sapi-hierarchy-change-auth.int \
    test/integration/sapi-abi-version.int \
    test/integration/sapi-pcr-extension.int \
    test/integration/sapi-self-test.int \
    test/integration/sapi-start-auth-session.int \
    test/integration/sapi-sys-initialize.int \
    test/integration/sapi-tpm-properties.int \
    test/integration/sapi-system-api.int \
    test/integration/sapi-policy-template.int \
    test/integration/sapi-create-loaded.int \
    test/integration/sapi-policy-authorizeNV.int \
    test/integration/sapi-command-cancel.int \
    test/integration/sapi-param-encrypt-decrypt.int \
    test/tpmclient/tpmclient.int
endif # !TESTPTPM

if ESAPI
ESYS_TESTS_INTEGRATION_DESTRUCTIVE = \
    test/integration/esys-clear.int \
    test/integration/esys-clear-session.int \
    test/integration/esys-field-upgrade.int \
    test/integration/esys-firmware-read.int \
    test/integration/esys-lock.int \
    test/integration/esys-set-algorithm-set.int

ESYS_TESTS_INTEGRATION_MANDATORY = \
    test/integration/esys-certify-creation.int \
    test/integration/esys-certify.int \
    test/integration/esys-clear-control.int \
    test/integration/esys-clockset.int \
    test/integration/esys-commit.int \
    test/integration/esys-create-fail.int \
    test/integration/esys-create-password-auth.int \
    test/integration/esys-create-primary-ecc-hmac.int \
    test/integration/esys-create-primary-hmac.int \
    test/integration/esys-create-session-auth-bound.int \
    test/integration/esys-create-session-auth-ecc.int \
    test/integration/esys-create-session-auth.int \
    test/integration/esys-create-session-auth-xor.int \
    test/integration/esys-ecc-parameters.int \
    test/integration/esys-ecdh-zgen.int \
    test/integration/esys-event-sequence-complete.int \
    test/integration/esys-evict-control-serialization.int \
    test/integration/esys-get-capability.int \
    test/integration/esys-get-random.int \
    test/integration/esys-hash.int \
    test/integration/esys-hashsequencestart.int \
    test/integration/esys-hashsequencestart-session.int \
    test/integration/esys-hierarchychangeauth.int \
    test/integration/esys-hmac.int \
    test/integration/esys-hmacsequencestart.int \
    test/integration/esys-hmacsequencestart-session.int \
    test/integration/esys-import.int \
    test/integration/esys-make-credential.int \
    test/integration/esys-make-credential-session.int \
    test/integration/esys-nv-ram-counter.int \
    test/integration/esys-nv-ram-counter-session.int \
    test/integration/esys-nv-ram-extend-index.int \
    test/integration/esys-nv-ram-extend-index-session.int \
    test/integration/esys-nv-ram-ordinary-index-rlock.int \
    test/integration/esys-nv-ram-ordinary-index-rlock-session.int \
    test/integration/esys-nv-ram-ordinary-index-wlock.int \
    test/integration/esys-nv-ram-ordinary-index-wlock-session.int \
    test/integration/esys-nv-ram-set-bits.int \
    test/integration/esys-nv-ram-set-bits-session.int \
    test/integration/esys-object-changeauth.int \
    test/integration/esys-policy-authorize.int \
    test/integration/esys-policy-nv-changeauth.int \
    test/integration/esys-policy-nv-undefine-special.int \
    test/integration/esys-policy-password.int \
    test/integration/esys-policy-regression.int \
    test/integration/esys-quote.int \
    test/integration/esys-rsa-encrypt-decrypt.int \
    test/integration/esys-save-and-load-context.int \
    test/integration/esys-stir-random.int \
    test/integration/esys-testparms.int \
    test/integration/esys-tpm-tests.int \
    test/integration/esys-tr-fromTpmPublic-key.int \
    test/integration/esys-tr-fromTpmPublic-nv.int \
    test/integration/esys-tr-getName-hierarchy.int \
    test/integration/esys-unseal-password-auth.int \
    test/integration/esys-verify-signature.int \
    test/integration/esys-ecdh-keygen.int \
    test/integration/esys-policy-ticket.int

ESYS_TESTS_INTEGRATION_OPTIONAL = \
    test/integration/esys-audit.int \
    test/integration/esys-change-eps.int \
    test/integration/esys-createloaded.int \
    test/integration/esys-createloaded-session.int \
    test/integration/esys-duplicate.int \
    test/integration/esys-encrypt-decrypt.int \
    test/integration/esys-get-time.int \
    test/integration/esys-hierarchy-control.int \
    test/integration/esys-nv-certify.int \
    test/integration/esys-pcr-auth-value.int \
    test/integration/esys-pcr-basic.int \
    test/integration/esys-policy-regression-opt.int \
    test/integration/esys-pp-commands.int \
    test/integration/esys-zgen-2phase.int

if TESTPTPM

if PTPMMANDATORY
TESTS_INTEGRATION +=  $(ESYS_TESTS_INTEGRATION_MANDATORY)
endif

if PTPMOPTIONAL
TESTS_INTEGRATION +=  $(ESYS_TESTS_INTEGRATION_OPTIONAL)
endif

if PTPMDESTRUCTIVE
TESTS_INTEGRATION += $(ESYS_TESTS_INTEGRATION_DESTRUCTIVE)
endif

endif # TESTPTPM

if !TESTPTPM
TESTS_INTEGRATION += $(ESYS_TESTS_INTEGRATION_MANDATORY) $(ESYS_TESTS_INTEGRATION_OPTIONAL) $(ESYS_TESTS_INTEGRATION_DESTRUCTIVE)
endif # !TESTPTPM

endif #ESAPI
endif #ENABLE_INTEGRATION

CLEANFILES += \
    test/integration/*.log \
    test/tpmclient/*.log \
    test/unit/*.log

if UNIT
test_unit_tcti_device_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_tcti_device_LDADD   = $(CMOCKA_LIBS) $(libtss2_mu) $(libutil)
test_unit_tcti_device_LDFLAGS = -Wl,--wrap=read -Wl,--wrap=write, -Wl,--wrap=poll
test_unit_tcti_device_SOURCES = test/unit/tcti-device.c \
    src/tss2-tcti/tcti-common.c src/tss2-tcti/tcti-common.h \
    src/tss2-tcti/tcti-device.c src/tss2-tcti/tcti-device.h

test_unit_tcti_mssim_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS) $(URIPARSER_CFLAGS)
test_unit_tcti_mssim_LDADD   = $(CMOCKA_LIBS) $(libtss2_mu) $(URIPARSER_LIBS) $(libutil)
test_unit_tcti_mssim_LDFLAGS = -Wl,--wrap=connect,--wrap=read,--wrap=select,--wrap=write
test_unit_tcti_mssim_SOURCES = test/unit/tcti-mssim.c \
    src/tss2-tcti/tcti-common.c src/tss2-tcti/tcti-common.h \
    src/tss2-tcti/tcti-mssim.c src/tss2-tcti/tcti-mssim.h

test_unit_io_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_io_LDADD   = $(CMOCKA_LIBS) $(libtss2_mu) $(libutil)
test_unit_io_LDFLAGS = -Wl,--wrap=connect,--wrap=read,--wrap=socket,--wrap=write
test_unit_io_SOURCES = test/unit/io.c

test_unit_key_value_parse_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_key_value_parse_LDADD   = $(CMOCKA_LIBS) $(libutil)
test_unit_key_value_parse_SOURCES = test/unit/key-value-parse.c

test_unit_CommonPreparePrologue_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_CommonPreparePrologue_LDFLAGS = -Wl,--unresolved-symbols=ignore-all
test_unit_CommonPreparePrologue_LDADD = $(CMOCKA_LIBS) $(libtss2_sys)
test_unit_CommonPreparePrologue_SOURCES = test/unit/CommonPreparePrologue.c

test_unit_GetNumHandles_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_GetNumHandles_LDADD   = $(CMOCKA_LIBS) $(libtss2_sys)
test_unit_GetNumHandles_SOURCES = test/unit/GetNumHandles.c

test_unit_CopyCommandHeader_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_CopyCommandHeader_LDFLAGS = -Wl,--unresolved-symbols=ignore-all
test_unit_CopyCommandHeader_LDADD = $(CMOCKA_LIBS) $(libtss2_sys)
test_unit_CopyCommandHeader_SOURCES = test/unit/CopyCommandHeader.c

test_unit_UINT8_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_UINT8_marshal_LDADD   = $(CMOCKA_LIBS) $(libtss2_mu)
test_unit_UINT8_marshal_SOURCES = test/unit/UINT8-marshal.c

test_unit_UINT16_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_UINT16_marshal_LDADD   = $(CMOCKA_LIBS) $(libtss2_mu)
test_unit_UINT16_marshal_SOURCES = test/unit/UINT16-marshal.c

test_unit_UINT32_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_UINT32_marshal_LDADD   = $(CMOCKA_LIBS) $(libtss2_mu)
test_unit_UINT32_marshal_SOURCES = test/unit/UINT32-marshal.c

test_unit_UINT64_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_UINT64_marshal_LDADD   = $(CMOCKA_LIBS) $(libtss2_mu)
test_unit_UINT64_marshal_SOURCES = test/unit/UINT64-marshal.c

test_unit_TPMA_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_TPMA_marshal_LDADD   = $(CMOCKA_LIBS) $(libtss2_mu)
test_unit_TPMA_marshal_SOURCES = test/unit/TPMA-marshal.c

test_unit_TPM2B_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_TPM2B_marshal_LDADD   = $(CMOCKA_LIBS) $(libtss2_mu)
test_unit_TPM2B_marshal_SOURCES = test/unit/TPM2B-marshal.c

test_unit_TPMS_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_TPMS_marshal_LDADD   = $(CMOCKA_LIBS) $(libtss2_mu)
test_unit_TPMS_marshal_SOURCES = test/unit/TPMS-marshal.c

test_unit_TPML_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_TPML_marshal_LDADD   = $(CMOCKA_LIBS) $(libtss2_mu)
test_unit_TPML_marshal_SOURCES = test/unit/TPML-marshal.c

test_unit_TPMT_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_TPMT_marshal_LDADD   = $(CMOCKA_LIBS) $(libtss2_mu)
test_unit_TPMT_marshal_SOURCES = test/unit/TPMT-marshal.c

test_unit_TPMU_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_TPMU_marshal_LDADD   = $(CMOCKA_LIBS) $(libtss2_mu)
test_unit_TPMU_marshal_SOURCES = test/unit/TPMU-marshal.c

if ESAPI
test_unit_esys_context_null_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_esys_context_null_LDADD = $(CMOCKA_LIBS)  $(TESTS_LDADD)
test_unit_esys_context_null_LDFLAGS = $(TESTS_LDFLAGS) $(ESYSCRY_LDFLAGS)
test_unit_esys_context_null_SOURCES = test/unit/esys-context-null.c

test_unit_esys_default_tcti_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS) \
        -UESYS_TCTI_DEFAULT_MODULE -UESYS_TCTI_DEFAUT_CONFIG
test_unit_esys_default_tcti_LDADD = $(CMOCKA_LIBS)  $(TESTS_LDADD)
test_unit_esys_default_tcti_LDFLAGS = \
        -Wl,--wrap=dlopen -Wl,-wrap=dlclose -Wl,-wrap=dlsym \
        -Wl,--wrap=Tss2_Tcti_Device_Init \
        -Wl,--wrap=Tss2_Tcti_Mssim_Init
test_unit_esys_default_tcti_SOURCES = test/unit/esys-default-tcti.c \
        src/tss2-esys/esys_tcti_default.c src/tss2-esys/esys_tcti_default.h

test_unit_esys_resubmissions_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_esys_resubmissions_LDADD = $(CMOCKA_LIBS)  $(TESTS_LDADD)
test_unit_esys_resubmissions_LDFLAGS = $(TESTS_LDFLAGS)
test_unit_esys_resubmissions_SOURCES = test/unit/esys-resubmissions.c

test_unit_esys_sequence_finish_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_esys_sequence_finish_LDADD = $(CMOCKA_LIBS)  $(TESTS_LDADD)
test_unit_esys_sequence_finish_LDFLAGS = $(TESTS_LDFLAGS)
test_unit_esys_sequence_finish_SOURCES = test/unit/esys-sequence-finish.c

test_unit_esys_tcti_rcs_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_esys_tcti_rcs_LDADD = $(CMOCKA_LIBS)  $(TESTS_LDADD)
test_unit_esys_tcti_rcs_LDFLAGS = $(TESTS_LDFLAGS)
test_unit_esys_tcti_rcs_SOURCES = test/unit/esys-tcti-rcs.c

test_unit_esys_tpm_rcs_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_esys_tpm_rcs_LDADD = $(CMOCKA_LIBS)  $(TESTS_LDADD)
test_unit_esys_tpm_rcs_LDFLAGS = $(TESTS_LDFLAGS)
test_unit_esys_tpm_rcs_SOURCES = test/unit/esys-tpm-rcs.c

test_unit_esys_getpollhandles_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_esys_getpollhandles_LDADD = $(CMOCKA_LIBS)  $(TESTS_LDADD)
test_unit_esys_getpollhandles_LDFLAGS = $(TESTS_LDFLAGS)
test_unit_esys_getpollhandles_SOURCES = test/unit/esys-getpollhandles.c

test_unit_esys_nulltcti_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_esys_nulltcti_LDADD = $(CMOCKA_LIBS)  $(TESTS_LDADD)
test_unit_esys_nulltcti_LDFLAGS = $(TESTS_LDFLAGS) -ldl
test_unit_esys_nulltcti_SOURCES = test/unit/esys-nulltcti.c \
        src/tss2-esys/esys_context.c

test_unit_esys_crypto_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS) $(ESYSCRY_CFLAGS)
test_unit_esys_crypto_LDADD = $(CMOCKA_LIBS)  $(TESTS_LDADD)
test_unit_esys_crypto_LDFLAGS = $(TESTS_LDFLAGS) $(ESYSCRY_LDFLAGS)
test_unit_esys_crypto_SOURCES = test/unit/esys-crypto.c \
        src/tss2-esys/esys_context.c

endif # ESAPI
endif # UNIT

if ENABLE_INTEGRATION
test_tpmclient_tpmclient_int_CFLAGS   = $(AM_CFLAGS) -U_FORTIFY_SOURCE  $(TESTS_CFLAGS)
test_tpmclient_tpmclient_int_LDADD    = $(TESTS_LDADD)
test_tpmclient_tpmclient_int_SOURCES  = \
    test/tpmclient/tpmclient.int.c test/integration/main-sapi.c

test_integration_libtest_utils_la_CFLAGS = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_libtest_utils_la_SOURCES = \
    test/integration/sapi-context-util.c test/integration/context-util.h \
    test/integration/sapi-util.c    test/integration/sapi-util.h \
    test/integration/sapi-session-util.c test/integration/session-util.h \
    test/integration/sapi-test-options.c test/integration/test-options.h \
    test/integration/sapi-entity-util.c test/integration/test.h

test_integration_sapi_asymmetric_encrypt_decrypt_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_asymmetric_encrypt_decrypt_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_asymmetric_encrypt_decrypt_int_SOURCES = \
    test/integration/sapi-asymmetric-encrypt-decrypt.int.c test/integration/main-sapi.c

test_integration_sapi_primary_rsa_2K_aes128cfb_int_CFLAGS = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_primary_rsa_2K_aes128cfb_int_LDADD  = $(TESTS_LDADD)
test_integration_sapi_primary_rsa_2K_aes128cfb_int_SOURCES = \
    test/integration/sapi-primary-rsa-2K-aes128cfb.int.c \
    test/integration/main-sapi.c

test_integration_sapi_create_keyedhash_sha1_hmac_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_create_keyedhash_sha1_hmac_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_create_keyedhash_sha1_hmac_int_SOURCES = \
    test/integration/sapi-create-keyedhash-sha1-hmac.int.c test/integration/main-sapi.c

test_integration_sapi_encrypt_decrypt_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_encrypt_decrypt_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_encrypt_decrypt_int_SOURCES = \
    test/integration/sapi-encrypt-decrypt.int.c test/integration/main-sapi.c

test_integration_sapi_encrypt_decrypt_2_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_encrypt_decrypt_2_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_encrypt_decrypt_2_int_SOURCES = \
    test/integration/sapi-encrypt-decrypt-2.int.c test/integration/main-sapi.c

test_integration_sapi_evict_ctrl_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_evict_ctrl_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_evict_ctrl_int_SOURCES = \
    test/integration/sapi-evict-ctrl.int.c test/integration/main-sapi.c

test_integration_sapi_sys_initialize_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_sys_initialize_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_sys_initialize_int_SOURCES = test/integration/sapi-sys-initialize.int.c \
    test/integration/main-sapi.c

test_integration_sapi_get_random_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_get_random_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_get_random_int_SOURCES = test/integration/sapi-get-random.int.c \
    test/integration/main-sapi.c

test_integration_sapi_abi_version_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_abi_version_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_abi_version_int_SOURCES = test/integration/sapi-abi-version.int.c \
    test/integration/main-sapi.c

test_integration_sapi_pcr_extension_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_pcr_extension_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_pcr_extension_int_SOURCES = test/integration/sapi-pcr-extension.int.c \
    test/integration/main-sapi.c

test_integration_sapi_self_test_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_self_test_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_self_test_int_SOURCES = test/integration/sapi-self-test.int.c \
    test/integration/main-sapi.c

test_integration_sapi_hierarchy_change_auth_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_hierarchy_change_auth_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_hierarchy_change_auth_int_SOURCES = \
    test/integration/sapi-hierarchy-change-auth.int.c test/integration/main-sapi.c

test_integration_sapi_start_auth_session_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_start_auth_session_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_start_auth_session_int_SOURCES = test/integration/main-sapi.c \
    test/integration/sapi-start-auth-session.int.c

test_integration_sapi_tpm_properties_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_tpm_properties_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_tpm_properties_int_SOURCES = test/integration/main-sapi.c \
    test/integration/sapi-tpm-properties.int.c

test_integration_sapi_system_api_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_system_api_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_system_api_int_SOURCES = test/integration/main-sapi.c \
    test/integration/sapi-system-api.int.c

test_integration_sapi_aram_encrypt_decrypt_int_CFLAGS  = $(AM_CFLAGS) $(TESTS_CFLAGS)
test_integration_sapi_param_encrypt_decrypt_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_param_encrypt_decrypt_int_SOURCES = \
    test/integration/sapi-param-encrypt-decrypt.int.c test/integration/main-sapi.c

if ESAPI
test_integration_esys_audit_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_audit_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_audit_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_audit_int_SOURCES = \
    test/integration/esys-audit.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_certify_creation_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_certify_creation_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_certify_creation_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_certify_creation_int_SOURCES = \
    test/integration/esys-certify-creation.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_certify_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_certify_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_certify_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_certify_int_SOURCES = \
    test/integration/esys-certify.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_change_eps_int_CFLAGS = $(TESTS_CFLAGS)
test_integration_esys_change_eps_int_LDADD = $(TESTS_LDADD)
test_integration_esys_change_eps_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_change_eps_int_SOURCES = \
    test/integration/esys-change-eps.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_clear_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_clear_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_clear_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_clear_int_SOURCES = \
    test/integration/esys-clear.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_clear_control_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_clear_control_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_clear_control_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_clear_control_int_SOURCES = \
    test/integration/esys-clear-control.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_clear_session_int_CFLAGS  = $(TESTS_CFLAGS) -DTEST_SESSION
test_integration_esys_clear_session_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_clear_session_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_clear_session_int_SOURCES = \
    test/integration/esys-clear.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_clockset_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_clockset_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_clockset_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_clockset_int_SOURCES = \
    test/integration/esys-clockset.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_commit_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_commit_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_commit_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_commit_int_SOURCES = \
    test/integration/esys-commit.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_create_fail_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_create_fail_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_create_fail_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_create_fail_int_SOURCES = \
    test/integration/esys-create-fail.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_createloaded_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_createloaded_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_createloaded_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_createloaded_int_SOURCES = \
    test/integration/esys-createloaded.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_createloaded_session_int_CFLAGS  = $(TESTS_CFLAGS) \
    -DTEST_SESSION
test_integration_esys_createloaded_session_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_createloaded_session_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_createloaded_session_int_SOURCES = \
    test/integration/esys-createloaded.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_create_password_auth_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_create_password_auth_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_create_password_auth_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_create_password_auth_int_SOURCES = \
    test/integration/esys-create-password-auth.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_create_primary_ecc_hmac_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_create_primary_ecc_hmac_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_create_primary_ecc_hmac_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_create_primary_ecc_hmac_int_SOURCES = \
    test/integration/esys-create-primary-hmac.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_create_primary_hmac_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_create_primary_hmac_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_create_primary_hmac_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_create_primary_hmac_int_SOURCES = \
    test/integration/esys-create-primary-hmac.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_create_session_auth_int_CFLAGS  = $(TESTS_CFLAGS) \
    -DTEST_AES_ENCRYPTION
test_integration_esys_create_session_auth_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_create_session_auth_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_create_session_auth_int_SOURCES = \
    test/integration/esys-create-session-auth.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_create_session_auth_bound_int_CFLAGS  = $(TESTS_CFLAGS) \
    -DTEST_AES_ENCRYPTION -DTEST_BOUND_SESSION
test_integration_esys_create_session_auth_bound_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_create_session_auth_bound_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_create_session_auth_bound_int_SOURCES = \
    test/integration/esys-create-session-auth.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_create_session_auth_ecc_int_CFLAGS  = $(TESTS_CFLAGS) \
    -DTEST_AES_ENCRYPTION -DTEST_ECC
test_integration_esys_create_session_auth_ecc_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_create_session_auth_ecc_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_create_session_auth_ecc_int_SOURCES = \
    test/integration/esys-create-session-auth.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_create_session_auth_xor_int_CFLAGS  = $(TESTS_CFLAGS) \
    -DTEST_XOR_OBFUSCATION
test_integration_esys_create_session_auth_xor_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_create_session_auth_xor_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_create_session_auth_xor_int_SOURCES = \
    test/integration/esys-create-session-auth.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_duplicate_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_duplicate_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_duplicate_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_duplicate_int_SOURCES = \
    test/integration/esys-duplicate.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_ecc_parameters_int_CFLAGS = $(TESTS_CFLAGS)
test_integration_esys_ecc_parameters_int_LDADD = $(TESTS_LDADD)
test_integration_esys_ecc_parameters_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_ecc_parameters_int_SOURCES = \
    test/integration/esys-ecc-parameters.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_ecdh_keygen_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_ecdh_keygen_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_ecdh_keygen_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_ecdh_keygen_int_SOURCES = \
    test/integration/esys-ecdh-keygen.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_ecdh_zgen_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_ecdh_zgen_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_ecdh_zgen_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_ecdh_zgen_int_SOURCES = \
    test/integration/esys-ecdh-zgen.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_encrypt_decrypt_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_encrypt_decrypt_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_encrypt_decrypt_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_encrypt_decrypt_int_SOURCES = \
    test/integration/esys-encrypt-decrypt.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_event_sequence_complete_int_CFLAGS = $(TESTS_CFLAGS)
test_integration_esys_event_sequence_complete_int_LDADD = $(TESTS_LDADD)
test_integration_esys_event_sequence_complete_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_event_sequence_complete_int_SOURCES = \
    test/integration/esys-event-sequence-complete.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_evict_control_serialization_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_evict_control_serialization_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_evict_control_serialization_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_evict_control_serialization_int_SOURCES = \
    test/integration/esys-evict-control-serialization.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_field_upgrade_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_field_upgrade_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_field_upgrade_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_field_upgrade_int_SOURCES = \
    test/integration/esys-field-upgrade.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_firmware_read_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_firmware_read_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_firmware_read_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_firmware_read_int_SOURCES = \
    test/integration/esys-firmware-read.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_get_capability_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_get_capability_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_get_capability_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_get_capability_int_SOURCES = \
    test/integration/esys-get-capability.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_get_random_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_get_random_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_get_random_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_get_random_int_SOURCES = \
    test/integration/esys-get-random.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_get_time_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_get_time_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_get_time_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_get_time_int_SOURCES = \
    test/integration/esys-get-time.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_hash_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_hash_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_hash_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_hash_int_SOURCES = \
    test/integration/esys-hash.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_hashsequencestart_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_hashsequencestart_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_hashsequencestart_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_hashsequencestart_int_SOURCES = \
    test/integration/esys-hashsequencestart.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_hashsequencestart_session_int_CFLAGS  = $(TESTS_CFLAGS) \
    -DTEST_SESSION
test_integration_esys_hashsequencestart_session_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_hashsequencestart_session_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_hashsequencestart_session_int_SOURCES = \
    test/integration/esys-hashsequencestart.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_hierarchy_control_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_hierarchy_control_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_hierarchy_control_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_hierarchy_control_int_SOURCES = \
    test/integration/esys-hierarchy-control.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_hmac_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_hmac_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_hmac_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_hmac_int_SOURCES = \
    test/integration/esys-hmac.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_hmacsequencestart_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_hmacsequencestart_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_hmacsequencestart_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_hmacsequencestart_int_SOURCES = \
    test/integration/esys-hmacsequencestart.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_hmacsequencestart_session_int_CFLAGS  = $(TESTS_CFLAGS) \
    -DTEST_SESSION
test_integration_esys_hmacsequencestart_session_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_hmacsequencestart_session_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_hmacsequencestart_session_int_SOURCES = \
    test/integration/esys-hmacsequencestart.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_hierarchychangeauth_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_hierarchychangeauth_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_hierarchychangeauth_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_hierarchychangeauth_int_SOURCES = \
    test/integration/esys-hierarchychangeauth.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_import_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_import_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_import_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_import_int_SOURCES = \
    test/integration/esys-import.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_lock_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_lock_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_lock_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_lock_int_SOURCES = \
    test/integration/esys-lock.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_make_credential_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_make_credential_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_make_credential_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_make_credential_int_SOURCES = \
    test/integration/esys-make-credential.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_make_credential_session_int_CFLAGS  = $(TESTS_CFLAGS) \
    -DTEST_SESSION
test_integration_esys_make_credential_session_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_make_credential_session_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_make_credential_session_int_SOURCES = \
    test/integration/esys-make-credential.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_nv_certify_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_nv_certify_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_nv_certify_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_nv_certify_int_SOURCES = \
    test/integration/esys-nv-certify.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_nv_ram_counter_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_nv_ram_counter_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_nv_ram_counter_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_nv_ram_counter_int_SOURCES = \
    test/integration/esys-nv-ram-counter.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_nv_ram_counter_session_int_CFLAGS  = $(TESTS_CFLAGS) \
    -DTEST_SESSION
test_integration_esys_nv_ram_counter_session_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_nv_ram_counter_session_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_nv_ram_counter_session_int_SOURCES = \
    test/integration/esys-nv-ram-counter.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_nv_ram_extend_index_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_nv_ram_extend_index_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_nv_ram_extend_index_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_nv_ram_extend_index_int_SOURCES = \
    test/integration/esys-nv-ram-extend-index.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_nv_ram_extend_index_session_int_CFLAGS  = $(TESTS_CFLAGS) \
    -DTEST_SESSION
test_integration_esys_nv_ram_extend_index_session_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_nv_ram_extend_index_session_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_nv_ram_extend_index_session_int_SOURCES = \
    test/integration/esys-nv-ram-extend-index.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_nv_ram_ordinary_index_rlock_int_CFLAGS  = $(TESTS_CFLAGS) \
    -I. -I$(srcdir)/src/esapi/esapi -I$(srcdir)/include/esapi -I$(srcdir)/test/integration/ \
    -I$(srcdir)/src/esapi/esapi_util -DTEST_READ_LOCK
test_integration_esys_nv_ram_ordinary_index_rlock_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_nv_ram_ordinary_index_rlock_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_nv_ram_ordinary_index_rlock_int_SOURCES = \
    test/integration/esys-nv-ram-ordinary-index.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_nv_ram_ordinary_index_rlock_session_int_CFLAGS  = $(TESTS_CFLAGS) \
    -I. -I$(srcdir)/src/esapi/esapi -I$(srcdir)/include/esapi -I$(srcdir)/include/esapi \
    -I$(srcdir)/src/esapi/esapi_util -DTEST_SESSION -DTEST_READ_LOCK
test_integration_esys_nv_ram_ordinary_index_rlock_session_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_nv_ram_ordinary_index_rlock_session_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_nv_ram_ordinary_index_rlock_session_int_SOURCES = \
    test/integration/esys-nv-ram-ordinary-index.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_nv_ram_ordinary_index_wlock_int_CFLAGS  = $(TESTS_CFLAGS) \
    -I. -I$(srcdir)/src/esapi/esapi -I$(srcdir)/include/esapi -I$(srcdir)/include/esapi \
    -I$(srcdir)/src/esapi/esapi_util  -DTEST_WRITE_LOCK
test_integration_esys_nv_ram_ordinary_index_wlock_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_nv_ram_ordinary_index_wlock_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_nv_ram_ordinary_index_wlock_int_SOURCES = \
    test/integration/esys-nv-ram-ordinary-index.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_nv_ram_ordinary_index_wlock_session_int_CFLAGS  = $(TESTS_CFLAGS) \
    -I. -I$(srcdir)/src/esapi/esapi -I$(srcdir)/include/esapi -I$(srcdir)/include/esapi \
    -I$(srcdir)/src/esapi/esapi_util -DTEST_SESSION -DTEST_WRITE_LOCK
test_integration_esys_nv_ram_ordinary_index_wlock_session_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_nv_ram_ordinary_index_wlock_session_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_nv_ram_ordinary_index_wlock_session_int_SOURCES = \
    test/integration/esys-nv-ram-ordinary-index.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_nv_ram_set_bits_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_nv_ram_set_bits_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_nv_ram_set_bits_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_nv_ram_set_bits_int_SOURCES = \
    test/integration/esys-nv-ram-set-bits.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_nv_ram_set_bits_session_int_CFLAGS  = $(TESTS_CFLAGS) \
    -DTEST_SESSION
test_integration_esys_nv_ram_set_bits_session_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_nv_ram_set_bits_session_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_nv_ram_set_bits_session_int_SOURCES = \
    test/integration/esys-nv-ram-set-bits.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_object_changeauth_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_object_changeauth_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_object_changeauth_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_object_changeauth_int_SOURCES = \
    test/integration/esys-object-changeauth.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_policy_authorize_int_CFLAGS  = $(TESTS_CFLAGS) $(ESYSCRY_CFLAGS)
test_integration_esys_policy_authorize_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_policy_authorize_int_LDFLAGS = $(TESTS_LDFLAGS) $(ESYSCRY_LDFLAGS)
test_integration_esys_policy_authorize_int_SOURCES = \
    test/integration/esys-policy-authorize.int.c \
    src/tss2-esys/esys_crypto.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_policy_regression_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_policy_regression_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_policy_regression_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_policy_regression_int_SOURCES = \
    test/integration/esys-policy-regression.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_policy_regression_opt_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_policy_regression_opt_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_policy_regression_opt_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_policy_regression_opt_int_SOURCES = \
    test/integration/esys-policy-regression-opt.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_policy_ticket_int_CFLAGS  = $(TESTS_CFLAGS) $(ESYSCRY_CFLAGS)
test_integration_esys_policy_ticket_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_policy_ticket_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_policy_ticket_int_SOURCES = \
    test/integration/esys-policy-ticket.int.c \
    src/tss2-esys/esys_crypto.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_policy_nv_changeauth_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_policy_nv_changeauth_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_policy_nv_changeauth_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_policy_nv_changeauth_int_SOURCES = \
    test/integration/esys-policy-nv-changeauth.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_policy_nv_undefine_special_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_policy_nv_undefine_special_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_policy_nv_undefine_special_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_policy_nv_undefine_special_int_SOURCES = \
    test/integration/esys-policy-nv-undefine-special.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_policy_password_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_policy_password_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_policy_password_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_policy_password_int_SOURCES = \
    test/integration/esys-policy-password.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_pcr_basic_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_pcr_basic_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_pcr_basic_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_pcr_basic_int_SOURCES = \
    test/integration/esys-pcr-basic.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_pcr_auth_value_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_pcr_auth_value_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_pcr_auth_value_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_pcr_auth_value_int_SOURCES = \
    test/integration/esys-pcr-auth-value.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_pp_commands_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_pp_commands_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_pp_commands_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_pp_commands_int_SOURCES = \
    test/integration/esys-pp-commands.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_quote_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_quote_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_quote_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_quote_int_SOURCES = \
    test/integration/esys-quote.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_rsa_encrypt_decrypt_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_rsa_encrypt_decrypt_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_rsa_encrypt_decrypt_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_rsa_encrypt_decrypt_int_SOURCES = \
    test/integration/esys-rsa-encrypt-decrypt.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_save_and_load_context_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_save_and_load_context_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_save_and_load_context_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_save_and_load_context_int_SOURCES = \
    test/integration/esys-save-and-load-context.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_set_algorithm_set_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_set_algorithm_set_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_set_algorithm_set_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_set_algorithm_set_int_SOURCES = \
    test/integration/esys-set-algorithm-set.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_stir_random_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_stir_random_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_stir_random_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_stir_random_int_SOURCES = \
    test/integration/esys-stir-random.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_testparms_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_testparms_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_testparms_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_testparms_int_SOURCES = \
    test/integration/esys-testparms.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_tpm_tests_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_tpm_tests_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_tpm_tests_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_tpm_tests_int_SOURCES = \
    test/integration/esys-tpm-tests.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_tr_fromTpmPublic_key_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_tr_fromTpmPublic_key_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_tr_fromTpmPublic_key_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_tr_fromTpmPublic_key_int_SOURCES = \
    test/integration/esys-tr-fromTpmPublic-key.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_tr_fromTpmPublic_nv_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_tr_fromTpmPublic_nv_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_tr_fromTpmPublic_nv_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_tr_fromTpmPublic_nv_int_SOURCES = \
    test/integration/esys-tr-fromTpmPublic-nv.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_tr_getName_hierarchy_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_tr_getName_hierarchy_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_tr_getName_hierarchy_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_tr_getName_hierarchy_int_SOURCES = \
    test/integration/esys-tr-getName-hierarchy.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_unseal_password_auth_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_unseal_password_auth_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_unseal_password_auth_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_unseal_password_auth_int_SOURCES = \
    test/integration/esys-unseal-password-auth.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_verify_signature_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_esys_verify_signature_int_LDADD   = $(TESTS_LDADD)
test_integration_esys_verify_signature_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_verify_signature_int_SOURCES = \
    test/integration/esys-verify-signature.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h

test_integration_esys_zgen_2phase_int_CFLAGS = $(TESTS_CFLAGS)
test_integration_esys_zgen_2phase_int_LDADD = $(TESTS_LDADD)
test_integration_esys_zgen_2phase_int_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_esys_zgen_2phase_int_SOURCES = \
    test/integration/esys-zgen-2phase.int.c \
    test/integration/main-esapi.c test/integration/test-esapi.h
endif #ESAPI

test_integration_sapi_policy_template_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_sapi_policy_template_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_policy_template_int_SOURCES = test/integration/main-sapi.c \
    test/integration/sapi-policy-template.int.c

test_integration_sapi_create_loaded_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_sapi_create_loaded_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_create_loaded_int_SOURCES = test/integration/main-sapi.c \
    test/integration/sapi-create-loaded.int.c

test_integration_sapi_policy_authorizeNV_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_sapi_policy_authorizeNV_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_policy_authorizeNV_int_SOURCES = test/integration/main-sapi.c \
    test/integration/sapi-policy-authorizeNV.int.c

test_integration_sapi_command_cancel_int_CFLAGS  = $(TESTS_CFLAGS)
test_integration_sapi_command_cancel_int_LDADD   = $(TESTS_LDADD)
test_integration_sapi_command_cancel_int_SOURCES = test/integration/main-sapi.c \
    test/integration/sapi-command-cancel.int.c
endif #ENABLE_INTEGRATION

check-ptpm:
	$(MAKE) -j1 check
