aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml9
-rw-r--r--Makefile7
-rw-r--r--tests/Makefile.tests5
-rw-r--r--tests/testutils.c10
4 files changed, 25 insertions, 6 deletions
diff --git a/.travis.yml b/.travis.yml
index 87adfa0..ecdef0d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,11 +25,8 @@ matrix:
- make
- make check && make checkm
- # Check it builds properly without the python bits
- - addons:
- apt:
- packages:
- - valgrind
- script:
+ # Check it builds properly without optional packages:
+ # python, valgrind
+ - script:
- make
- make check
diff --git a/Makefile b/Makefile
index d8ebc4f..c4bfae6 100644
--- a/Makefile
+++ b/Makefile
@@ -39,6 +39,13 @@ INCLUDEDIR = $(PREFIX)/include
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
sed -e 's/\(cygwin\|msys\).*/\1/')
+NO_VALGRIND := $(shell $(PKG_CONFIG) --exists valgrind; echo $$?)
+ifeq ($(NO_VALGRIND),1)
+ CFLAGS += -DNO_VALGRIND
+else
+ CFLAGS += $(shell $(PKG_CONFIG) --cflags valgrind)
+endif
+
ifeq ($(HOSTOS),darwin)
SHAREDLIB_EXT = dylib
SHAREDLIB_CFLAGS = -fPIC
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 <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>