diff options
author | Vic Yang <victoryang@chromium.org> | 2013-04-07 15:58:58 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-04-08 09:33:47 -0700 |
commit | f273ae717361c89b941e532b456cdc7a222b1201 (patch) | |
tree | def6a43fe20bee3504f8035c91bf960cded2b716 /include | |
parent | 303aef9e3f68c41052182392f264819d1df0c962 (diff) | |
download | chrome-ec-f273ae717361c89b941e532b456cdc7a222b1201.tar.gz |
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 <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47540
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/common.h | 12 |
1 files changed, 12 insertions, 0 deletions
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 */ |