| Index: tests/tpm_lite/tlcl_tests.h
|
| diff --git a/tests/tpm_lite/tlcl_tests.h b/tests/tpm_lite/tlcl_tests.h
|
| index 57e8fd92332898af8998d635ac8af3a82b01bca2..5e23ee39d55d9174c7d3049e4e110645012dd01a 100644
|
| --- a/tests/tpm_lite/tlcl_tests.h
|
| +++ b/tests/tpm_lite/tlcl_tests.h
|
| @@ -13,18 +13,19 @@
|
| #define INDEX0 0xcafe
|
| #define INDEX1 0xcaff
|
|
|
| -#define DO_ON_FAILURE(tpm_command, action) do { \
|
| - uint32_t result; \
|
| - if ((result = (tpm_command)) != TPM_SUCCESS) { \
|
| - action; \
|
| - } \
|
| - } while (0)
|
| -
|
| /* Prints error and returns on failure */
|
| -#define TPM_CHECK(tpm_command) \
|
| - DO_ON_FAILURE(tpm_command, \
|
| - printf("TEST FAILED: line %d: " #tpm_command ": 0x%x\n", \
|
| - __LINE__, result); return result)
|
| +#define TPM_CHECK(tpm_command) TPM_EXPECT(tpm_command, TPM_SUCCESS)
|
| +
|
| +#define TPM_EXPECT(tpm_command, expected_result) do { \
|
| + uint32_t _result = (tpm_command); \
|
| + uint32_t _exp = (expected_result); \
|
| + if (_result != _exp) { \
|
| + printf("TEST FAILED: line %d: " #tpm_command ": 0x%x" \
|
| + " (expecting 0x%x)\n", __LINE__, _result, _exp); \
|
| + return _result; \
|
| + } \
|
| +} while (0)
|
| +
|
|
|
| /* Executes TlclStartup(), but ignores POSTINIT error if the
|
| * TLCL_RESILIENT_STARTUP environment variable is set.
|
|
|