summaryrefslogtreecommitdiffstats
path: root/tests/meson.build
diff options
context:
space:
mode:
authorAnastasia Klimchuk <aklm@chromium.org>2021-07-15 10:00:20 +1000
committerEdward O'Callaghan <quasisec@chromium.org>2021-07-19 04:41:32 +0000
commit80c3296499b841b2a5a1b6fe82d4378dab331cca (patch)
treeef483d95cf37ef6e2ce1110abcf86cc4e97cca1c /tests/meson.build
parent02bc0b2c53d1c20d676ac11bbfa84f42d2fb070c (diff)
downloadflashrom-80c3296499b841b2a5a1b6fe82d4378dab331cca.tar.gz
flashrom-80c3296499b841b2a5a1b6fe82d4378dab331cca.tar.bz2
flashrom-80c3296499b841b2a5a1b6fe82d4378dab331cca.zip
tests: Wrap strdup to help cmocka recognise memory allocation
This is a known issue in cmocka (see https://github.com/clibs/cmocka/issues/17) where cmocka does not recognise memory allocation happening inside strdup, and then later throws an error when the memory is freed. If the issue is fixed at some point, this workaround can be removed. Given that cmocka already overrides malloc, calloc, realloc, free, adding strdup there seems fine. Existing tests now can (and have to) free the memory they allocated by strdup, and this is in the same patch. BUG=b:193584590 TEST=ninja test Change-Id: I56aef6b342752d80995c36ab075b12198fc101d9 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56323 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'tests/meson.build')
-rw-r--r--tests/meson.build1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/meson.build b/tests/meson.build
index a18bc4556..0bc05607c 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -22,6 +22,7 @@ srcs = [
]
mocks = [
+ '-Wl,--wrap=strdup',
'-Wl,--wrap=physunmap',
'-Wl,--wrap=physmap',
'-Wl,--wrap=spi_send_command',