From f273ae717361c89b941e532b456cdc7a222b1201 Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Sun, 7 Apr 2013 15:58:58 +0800 Subject: Add macros for mocking functions This introduces two symbols for mocking functions in existing code: - test_mockable - test_mockable_static BUG=chrome-os-partner:18598 TEST=none BRANCH=none Change-Id: Ia7251a9b609136c8f3b155c221634bac7dcb1d68 Signed-off-by: Vic Yang Reviewed-on: https://gerrit.chromium.org/gerrit/47540 Reviewed-by: Randall Spangler --- include/common.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/common.h b/include/common.h index ca772b303f..d1f4eb8296 100644 --- a/include/common.h +++ b/include/common.h @@ -66,4 +66,16 @@ enum ec_error_list { EC_ERROR_INTERNAL_LAST = 0x1FFFF }; +/* + * Define test_mockable and test_mockable_static for mocking + * functions. + */ +#ifdef TEST_BUILD +#define test_mockable __attribute__((weak)) +#define test_mockable_static __attribute__((weak)) +#else +#define test_mockable +#define test_mockable_static static +#endif + #endif /* __CROS_EC_COMMON_H */ -- cgit v1.2.1