re-enable leak checking :)
[platform/upstream/gstreamer.git] / check / Makefile.am
1 CHECK_REGISTRY=$(top_builddir)/check/test-registry.xml
2
3 TESTS_ENVIRONMENT=\
4         GST_PLUGIN_PATH_ONLY=yes \
5         GST_PLUGIN_PATH=$(top_builddir)/gst \
6         GST_REGISTRY=$(CHECK_REGISTRY)
7
8 plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
9
10 # rebuild gst-register-@GST_MAJORMINOR@ if needed
11 $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@$(EXEEXT):
12         cd $(top_builddir)/tools && make
13
14 # override to _not_ install the test plugins
15 install-pluginLTLIBRARIES:
16
17 # ths core dumps of some machines have PIDs appended
18 CLEANFILES = core.* test-registry.xml
19
20 EXTRA_DIST = gst.supp
21
22 clean-local:
23         for i in `find . -name ".libs" -type d`; do \
24           rm -rf $$i; \
25         done
26
27 $(CHECK_REGISTRY):
28         $(TESTS_ENVIRONMENT)                                    \
29         $(top_builddir)/tools/gst-register
30
31 # FIXME: it'd be nicer to run the versioned register, but in that case
32 # "make dist" complains about not finding gst-register-0.9.c
33 TESTS = $(top_builddir)/tools/gst-register      \
34         gst/gst                                 \
35         gst/gstbin                              \
36         gst/gstbuffer                           \
37         gst/gstbus                              \
38         gst/gstcaps                             \
39         gst/gstelement                          \
40         gst/gstghostpad                         \
41         gst/gstiterator                         \
42         gst/gstmessage                          \
43         gst/gstminiobject                       \
44         gst/gstobject                           \
45         gst/gstpad                              \
46         gst/gstsystemclock                      \
47         gst/gststructure                        \
48         gst/gsttag                              \
49         gst/gstvalue                            \
50         elements/gstfakesrc                     \
51         pipelines/simple_launch_lines           \
52         pipelines/cleanup                       \
53         states/sinks                            \
54         gst-libs/gdp    
55
56 check_PROGRAMS = $(TESTS)
57
58 noinst_LTLIBRARIES = libgstcheck.la
59
60 libgstcheck_la_SOURCES = gstcheck.c
61 libgstcheck_la_LIBADD = $(GST_OBJ_LIBS)
62 noinst_HEADERS = gstcheck.h gst/capslist.h
63
64 AM_CFLAGS = $(GST_OBJ_CFLAGS) $(CHECK_CFLAGS)
65 LDADD = $(GST_OBJ_LIBS) $(CHECK_LIBS) libgstcheck.la
66
67 gst_libs_gdp_SOURCES = \
68         gst-libs/gdp.c \
69         $(top_srcdir)/libs/gst/dataprotocol/dataprotocol.c
70 # remove GST_ENABLE_NEW when dataprotocol has been declared API-stable
71 gst_libs_gdp_CFLAGS = $(AM_CFLAGS) -DGST_ENABLE_NEW
72
73 # valgrind testing
74
75 # these just need fixing, period
76 TESTS_TO_FIX =                                  \
77         gst/gstghostpad                         \
78         gst/gstiterator                         \
79         gst/gstmessage                          \
80         gst/gstsystemclock                      \
81         gst/gsttag                              \
82         pipelines/cleanup                       \
83         pipelines/simple_launch_lines
84
85 # these need fixing because the threads cause segfaults under valgrind
86 TESTS_THREADED =                                \
87         gst/gstminiobject                       \
88         gst/gstobject
89
90 VALGRIND_TESTS_DISABLE =                        \
91         $(top_builddir)/tools/gst-register      \
92         $(TESTS_THREADED)                       \
93         $(TESTS_TO_FIX)
94
95 if HAVE_VALGRIND
96 # hangs spectacularly on some machines, so let's not do this by default yet
97 check-local-disabled:
98         make valgrind
99 else
100 check-local-disabled:
101         @true
102 endif
103
104 # valgrind any given test by running make test.valgrind
105 %.valgrind: % $(CHECK_REGISTRY)
106         @$(TESTS_ENVIRONMENT)                                   \
107         libtool --mode=execute                                  \
108         $(VALGRIND_PATH) -q --suppressions=$(srcdir)/gst.supp   \
109         --tool=memcheck --leak-check=yes --trace-children=yes   \
110         $*
111
112 # valgrind all tests
113 valgrind: $(TESTS)
114         @echo "Valgrinding tests ..."
115         $(TESTS_ENVIRONMENT) $(top_builddir)/tools/gst-register
116         @failed=0;                                                      \
117         for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do   \
118                 make $$t.valgrind;                                      \
119                 if test "$$?" -ne 0; then                               \
120                         echo "Valgrind error for test $$t";             \
121                         failed=`expr $$failed + 1`;                     \
122                 fi;                                                     \
123         done;                                                           \
124         if test "$$failed" -ne 0; then                                  \
125                 echo "$$failed tests had leaks under valgrind";         \
126                 false;                                                  \
127         fi