Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: tests/tpm_lite/tlcl_tests.h

Issue 6349091: Improve error messages from tests (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git@master
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/tpm_lite/redefine_unowned.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f76bb7b7b453f557dee866931da391541027fc31 100644
--- a/tests/tpm_lite/tlcl_tests.h
+++ b/tests/tpm_lite/tlcl_tests.h
@@ -13,18 +13,18 @@
#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; \
+ if ((_result = (tpm_command)) != expected_result) { \
Randall Spangler 2011/02/04 16:35:59 Minor nit: (expected_result) (guard macro expansi
+ printf("TEST FAILED: line %d: " #tpm_command ": 0x%x\n", \
+ __LINE__, _result); \
Randall Spangler 2011/02/04 16:35:59 While we're making things more elegant, could prin
+ return _result; \
+ } \
+} while (0)
+
/* Executes TlclStartup(), but ignores POSTINIT error if the
* TLCL_RESILIENT_STARTUP environment variable is set.
« no previous file with comments | « tests/tpm_lite/redefine_unowned.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698