diff options
author | Yu-Ping Wu <yupingso@chromium.org> | 2022-07-05 15:45:20 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-21 09:44:53 +0000 |
commit | ce6207613256d4f54637b580e4e863565d18dacc (patch) | |
tree | 15c480714e79ccff5fbc71d7c01e542f7cf28f82 /Makefile | |
parent | 956c2efb0af310a3089b362fdb5d5f70238758f2 (diff) | |
download | vboot-ce6207613256d4f54637b580e4e863565d18dacc.tar.gz |
tests: Remove --allow-multiple-definition linker option
The --allow-multiple-definition linker option was added in CL:6770 to
allow mocking functions. Now that we're exclusively using the weak
attribute (or equivalently test_mockable in vboot_reference) in other
firmware repositories (coreboot, depthcharge) for unit testing, the
--allow-multiple-definition option should no longer be needed.
In addition, one problem with --allow-multiple-definition is that, when
a function being mocked is automatically inlined by compiler
optimization, the mock function may not be called at all, leading to
unexpected behavior. Marking that function as test_mockable can prevent
this situation.
Therefore, add test_mockable to all the functions being mocked, and
remove the linker option from Makefile.
BUG=none
TEST=make -j32 test_setup && make runtests
BRANCH=none
Change-Id: Ifcd8138641d17bff689dd5093cdd69e4da9f0b0c
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3744746
Reviewed-by: Jakub Czapiga <czapiga@google.com>
Commit-Queue: Jakub Czapiga <czapiga@google.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 3 |
1 files changed, 0 insertions, 3 deletions
@@ -673,7 +673,6 @@ FUTIL_SRCS = \ futility/cmd_update.c \ futility/cmd_validate_rec_mrc.c \ futility/cmd_vbutil_firmware.c \ - futility/cmd_vbutil_firmware.c \ futility/cmd_vbutil_kernel.c \ futility/cmd_vbutil_key.c \ futility/cmd_vbutil_keyblock.c \ @@ -1204,8 +1203,6 @@ ${BUILD}/tests/hmac_test: LDLIBS += ${CRYPTO_LIBS} ${TEST21_BINS}: LDLIBS += ${CRYPTO_LIBS} -# Allow multiple definitions, so tests can mock functions from other libraries -${BUILD}/tests/%: LDFLAGS += -Xlinker --allow-multiple-definition ${BUILD}/tests/%: LDLIBS += -lrt -luuid ${BUILD}/tests/%: LIBS += ${TESTLIB} |