summaryrefslogtreecommitdiff
path: root/tests/test_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_common.h')
-rw-r--r--tests/test_common.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_common.h b/tests/test_common.h
index 34e39ed7..9d6e8eaf 100644
--- a/tests/test_common.h
+++ b/tests/test_common.h
@@ -58,4 +58,11 @@ int TEST_SUCC(int result, const char* testname);
/* Check that all memory allocations were freed */
int vboot_api_stub_check_memory(void);
+/* Abort if asprintf fails. */
+#define xasprintf(...) \
+ do { \
+ if (asprintf(__VA_ARGS__) < 0) \
+ abort(); \
+ } while (0)
+
#endif /* VBOOT_REFERENCE_TEST_COMMON_H_ */