diff options
Diffstat (limited to 'tests/tests.c')
-rw-r--r-- | tests/tests.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/tests.c b/tests/tests.c index cde696f4..592d896c 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -18,6 +18,7 @@ #include "tests.h" #include <stdio.h> +#include <string.h> #include <stdint.h> /* redefinitions/wrapping */ @@ -31,6 +32,16 @@ void io_mock_register(const struct io_mock *io) current_io = io; } +/* Workaround for https://github.com/clibs/cmocka/issues/17 */ +char *__wrap_strdup(const char *s) +{ + size_t len = strlen(s) + 1; + void *new = malloc(len); + if (new == NULL) + return NULL; + return (char *)memcpy(new, s, len); +} + void __wrap_physunmap(void *virt_addr, size_t len) { LOG_ME; |