2 CLEANFILES += valgrind.*.log
4 # run any given test by running make test.check
5 # if the test fails, run it again at at least debug level 2
7 @$(TESTS_ENVIRONMENT) \
12 # run any given test in a loop
14 @for i in `seq 1 $(LOOPS)`; do \
15 $(TESTS_ENVIRONMENT) \
18 # run any given test in an infinite loop
21 $(TESTS_ENVIRONMENT) \
24 # valgrind any given test by running make test.valgrind
26 $(TESTS_ENVIRONMENT) \
27 CK_DEFAULT_TIMEOUT=360 \
28 G_SLICE=always-malloc \
30 libtool --mode=execute \
32 $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \
33 --tool=memcheck --leak-check=full --trace-children=yes \
34 --leak-resolution=high --num-callers=20 \
35 ./$* 2>&1 | tee "valgrind.$*.log"
36 @if grep "==" "valgrind.$*.log" > /dev/null 2>&1; then \
40 # valgrind any given test and generate suppressions for it
41 %.valgrind.gen-suppressions: %
42 $(TESTS_ENVIRONMENT) \
43 CK_DEFAULT_TIMEOUT=360 \
44 G_SLICE=always-malloc \
46 libtool --mode=execute \
48 $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \
49 --tool=memcheck --leak-check=full --trace-children=yes \
50 --leak-resolution=high --num-callers=20 \
51 --gen-suppressions=all \
52 ./$* 2>&1 | tee suppressions.log
54 # valgrind any given test until failure by running make test.valgrind-forever
56 @while $(MAKE) $*.valgrind; do \
59 # gdb any given test by running make test.gdb
61 $(TESTS_ENVIRONMENT) \
63 libtool --mode=execute \
68 @echo "Torturing tests ..."
69 for i in `seq 1 $(LOOPS)`; do \
71 (echo "Failure after $$i runs"; exit 1) || \
74 @banner="All $(LOOPS) loops passed"; \
75 dashes=`echo "$$banner" | sed s/./=/g`; \
76 echo $$dashes; echo $$banner; echo $$dashes
80 @echo "Forever tests ..."
83 (echo "Failure"; exit 1) || \
89 @echo "Valgrinding tests ..."
91 for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
92 $(MAKE) $$t.valgrind; \
93 if test "$$?" -ne 0; then \
94 echo "Valgrind error for test $$t"; \
95 failed=`expr $$failed + 1`; \
96 whicht="$$whicht $$t"; \
99 if test "$$failed" -ne 0; then \
100 echo "$$failed tests had leaks or errors under valgrind:"; \
106 @echo "make check -- run all checks"
107 @echo "make torture -- run all checks $(LOOPS) times"
108 @echo "make (dir)/(test).check -- run the given check once"
109 @echo "make (dir)/(test).forever -- run the given check forever"
110 @echo "make (dir)/(test).torture -- run the given check $(LOOPS) times"
112 @echo "make (dir)/(test).gdb -- start up gdb for the given test"
114 @echo "make valgrind -- valgrind all tests"
115 @echo "make (dir)/(test).valgrind -- valgrind the given test"
116 @echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever"
117 @echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions"
118 @echo " and save to suppressions.log"
119 @echo "make inspect -- inspect all plugin features"