From b94c056b137e59deefc62fbfe0cd3a23edfcc07c Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 10 Sep 2018 16:46:59 +1000 Subject: 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 --- tests/Makefile.tests | 5 +++++ tests/testutils.c | 10 ++++++++++ 2 files changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/Makefile.tests b/tests/Makefile.tests index 6903333..bd1c8ef 100644 --- a/tests/Makefile.tests +++ b/tests/Makefile.tests @@ -83,8 +83,13 @@ tests_clean: check: tests ${TESTS_BIN} $(TESTS_PYLIBFDT) cd $(TESTS_PREFIX); ./run_tests.sh +ifeq ($(NO_VALGRIND),1) +checkm: + @echo "make checkm requires valgrind, but NO_VALGRIND=1" +else checkm: tests ${TESTS_BIN} $(TESTS_PYLIBFDT) cd $(TESTS_PREFIX); ./run_tests.sh -m 2>&1 | tee vglog.$$$$ +endif checkv: tests ${TESTS_BIN} $(TESTS_PYLIBFDT) cd $(TESTS_PREFIX); ./run_tests.sh -v 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 #include +#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 +#endif #include -- cgit v1.1