summaryrefslogtreecommitdiff
path: root/tests/testutils.c
diff options
context:
space:
mode:
author David Gibson <david@gibson.dropbear.id.au> 2018-09-10 16:46:59 +1000
committer David Gibson <david@gibson.dropbear.id.au> 2018-09-10 16:46:59 +1000
commitb94c056b137e59deefc62fbfe0cd3a23edfcc07c (patch)
tree2bce03b8f128958e5c2451c34ed284cbafd5736f /tests/testutils.c
parentfd06c54d4711f20d16bb1e18cba4d7bed09e5ad2 (diff)
Make valgrind optional
Some platforms don't have valgrind support, and sometimes you simply might not want to use valgrind. But at present, dtc, or more specifically its testsuite, won't compile without valgrind because we use the valgrind client interface in some places to improve our testing and suppress false positives. This adds some Makefile detection to correctly handle the case where valgrind is not available. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests/testutils.c')
-rw-r--r--tests/testutils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/testutils.c b/tests/testutils.c
index 75e3e20..0217b02 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -30,7 +30,17 @@
#include <unistd.h>
#include <fcntl.h>
+#if NO_VALGRIND
+static inline void VALGRIND_MAKE_MEM_UNDEFINED(void *p, size_t len)
+{
+}
+
+static inline void VALGRIND_MAKE_MEM_DEFINED(void *p, size_t len)
+{
+}
+#else
#include <valgrind/memcheck.h>
+#endif
#include <libfdt.h>