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 /host | |
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 'host')
-rw-r--r-- | host/lib/subprocess.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/host/lib/subprocess.c b/host/lib/subprocess.c index 8905d1c2..ee181591 100644 --- a/host/lib/subprocess.c +++ b/host/lib/subprocess.c @@ -290,6 +290,7 @@ struct subprocess_target subprocess_stderr = { .fd = STDERR_FILENO, }; +test_mockable int subprocess_run(const char *const argv[], struct subprocess_target *input, struct subprocess_target *output, |