From ce55ca2fcaab23010b2f7e310c921f65b037034d Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 9 Jun 2021 18:37:42 +0200 Subject: tests: Rework mocking facility Using the linker's --wrap feature has the downside that it only covers references across object files: If foo.c defines a() and b(), with b calling a, --wrap=a does nothing to that call. Instead, use objcopy to mark a weak and global so it can be overridden by another implementation, but only for files originating in src/. That way mocks - implemented in tests/ - become the source of truth. TEST=Had such an issue with get_log_level() in a follow-up commit, and the mock now takes over. Also, all existing unit tests still pass. Change-Id: I99c6d6e44ecfc73366bf464d9c51c7da3f8db388 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/c/coreboot/+/55360 Tested-by: build bot (Jenkins) Reviewed-by: Jakub Czapiga --- tests/lib/coreboot_table-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/lib/coreboot_table-test.c') diff --git a/tests/lib/coreboot_table-test.c b/tests/lib/coreboot_table-test.c index cd82ee5c3a..ba3e63d84b 100644 --- a/tests/lib/coreboot_table-test.c +++ b/tests/lib/coreboot_table-test.c @@ -264,7 +264,7 @@ void cbmem_run_init_hooks(int is_recovery) } extern uintptr_t _cbmem_top_ptr; -void *__wrap_cbmem_top_chipset(void) +void *cbmem_top_chipset(void) { return (void *)_cbmem_top_ptr; } -- cgit v1.2.3