From 2006a5b9911d3a500fa21cce20c6f9a696c458bb Mon Sep 17 00:00:00 2001 From: Timothy Rule <90191439+timrulebosch@users.noreply.github.com> Date: Mon, 30 Oct 2023 08:49:11 +0100 Subject: [PATCH] Update testing.h Add support to include CMocka headers, but not enable memory checks. --- dse/testing.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dse/testing.h b/dse/testing.h index 1b205f0..48e12e6 100644 --- a/dse/testing.h +++ b/dse/testing.h @@ -5,8 +5,8 @@ #ifndef DSE_TESTING_H_ #define DSE_TESTING_H_ -#ifdef UNIT_TESTING +#if defined(UNIT_TESTING) || defined(CMOCKA_TESTING) #include #include @@ -18,6 +18,8 @@ #include +#if defined(UNIT_TESTING) // Enables memory checks in CMocka includes. + /* Wrapping strdup() to get memory checking does not work with libyaml (and * perhaps other libs too). Therefore, rather than wrapping we can use the * preprocessor to swap strdup with this implementation in DSE code only. @@ -32,7 +34,8 @@ static inline char *dse_strdup_swap(const char *s) } #define strdup dse_strdup_swap - #endif // UNIT_TESTING +#endif // UNIT_TESTING || CMOCKA_TESTING + #endif // DSE_TESTING_H_