check.mak: for some weird reason valgrind does not report actual memleaks if GST_PLUG...
[platform/upstream/gst-common.git] / check.mak
1 clean-local-check:
2         for i in `find . -name ".libs" -type d`; do \
3           rm -rf $$i; \
4         done
5
6 if HAVE_VALGRIND
7 # hangs spectacularly on some machines, so let's not do this by default yet
8 check-local-disabled:
9         make valgrind
10 else
11 check-local-disabled:
12         @true
13 endif
14
15 # run any given test by running make test.check
16 %.check: % $(CHECK_REGISTRY)
17         @$(TESTS_ENVIRONMENT)                                   \
18         $*
19
20 # valgrind any given test by running make test.valgrind
21 %.valgrind: % $(CHECK_REGISTRY)
22         $(TESTS_ENVIRONMENT)                                    \
23         libtool --mode=execute                                  \
24         $(VALGRIND_PATH) -q --suppressions=$(SUPPRESSIONS)      \
25         --tool=memcheck --leak-check=yes --trace-children=yes   \
26         $*
27
28 # valgrind all tests
29 valgrind: $(TESTS)
30         @echo "Valgrinding tests ..."
31         $(TESTS_ENVIRONMENT) $(GST_TOOLS_DIR)/gst-register-@GST_MAJORMINOR@
32         @failed=0;                                                      \
33         for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do   \
34                 make $$t.valgrind;                                      \
35                 if test "$$?" -ne 0; then                               \
36                         echo "Valgrind error for test $$t";             \
37                         failed=`expr $$failed + 1`;                     \
38                 fi;                                                     \
39         done;                                                           \
40         if test "$$failed" -ne 0; then                                  \
41                 echo "$$failed tests had leaks under valgrind";         \
42                 false;                                                  \
43         fi