diff options
Diffstat (limited to 'utest/Makefile')
-rw-r--r-- | utest/Makefile | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/utest/Makefile b/utest/Makefile index 337db9bf..480edcd3 100644 --- a/utest/Makefile +++ b/utest/Makefile @@ -17,6 +17,8 @@ LIBS += $(ZLIB_LDLAGS) $(LIBZSTD_LDLAGS) OBJS := $(OBJS:%.o=$(bdir)/%.o) DEPS := $(OBJS:$(bdir)/%.o=$(bdir)/.%.d) +VALGRIND = $(shell which valgrind) + $(bdir): @mkdir -p $(bdir) @@ -39,5 +41,18 @@ dep_includes := $(wildcard $(DEPS)) test: $(TARGETS) +test_mem: test +ifeq (, $(VALGRIND)) + $(error "No valgrind in $(PATH), cannot run memory test") +endif +ifneq ($(shell id -u), 0) + $(error "The memory test should be run as root, as it reuqires full access to tracefs") +endif + CK_FORK=no $(VALGRIND) \ + --show-leak-kinds=all --leak-resolution=high \ + --leak-check=full --show-possibly-lost=yes \ + --track-origins=yes -s \ + $(bdir)/trace-utest + clean: $(RM) $(TARGETS) $(bdir)/*.o $(bdir)/.*.d |