add a .gdb target always rebuild registry
[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 $(CHECK_REGISTRY).rebuild:
16         -rm $(CHECK_REGISTRY)
17         make $(CHECK_REGISTRY)
18
19 # run any given test by running make test.check
20 %.check: % $(CHECK_REGISTRY).rebuild
21         @$(TESTS_ENVIRONMENT)                                   \
22         $*
23
24 # valgrind any given test by running make test.valgrind
25 %.valgrind: % $(CHECK_REGISTRY).rebuild
26         $(REGISTRY_ENVIRONMENT)                                 \
27         CK_DEFAULT_TIMEOUT=20                                   \
28         libtool --mode=execute                                  \
29         $(VALGRIND_PATH) -q --suppressions=$(SUPPRESSIONS)      \
30         --tool=memcheck --leak-check=yes --trace-children=yes   \
31         $* 2>&1 | tee valgrind.log
32         @if grep "tely lost" valgrind.log; then                 \
33             rm valgrind.log;                                    \
34             exit 1;                                             \
35         fi
36         @rm valgrind.log
37
38 # gdb any given test by running make test.gdb
39 %.gdb: % $(CHECK_REGISTRY).rebuild
40         $(REGISTRY_ENVIRONMENT)                                 \
41         CK_FORK=no                                              \
42         libtool --mode=execute                                  \
43         gdb $*
44
45
46 # valgrind all tests
47 valgrind: $(TESTS)
48         @echo "Valgrinding tests ..."
49         @failed=0;                                                      \
50         for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do   \
51                 make $$t.valgrind;                                      \
52                 if test "$$?" -ne 0; then                               \
53                         echo "Valgrind error for test $$t";             \
54                         failed=`expr $$failed + 1`;                     \
55                         whicht="$$whicht $$t";                          \
56                 fi;                                                     \
57         done;                                                           \
58         if test "$$failed" -ne 0; then                                  \
59                 echo "$$failed tests had leaks under valgrind:";        \
60                 echo "$$whicht";                                        \
61                 false;                                                  \
62         fi