check/: I wrote a test!
[platform/upstream/gstreamer.git] / tests / 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/gstevents                           \
41         gst/gstghostpad                         \
42         gst/gstiterator                         \
43         gst/gstmessage                          \
44         gst/gstminiobject                       \
45         gst/gstobject                           \
46         gst/gstpad                              \
47         gst/gstsystemclock                      \
48         gst/gststructure                        \
49         gst/gsttag                              \
50         gst/gstvalue                            \
51         elements/gstfakesrc                     \
52         pipelines/simple_launch_lines           \
53         pipelines/cleanup                       \
54         states/sinks                            \
55         gst-libs/controller                     \
56         gst-libs/gdp
57
58 check_PROGRAMS = $(TESTS)
59
60 noinst_LTLIBRARIES = libgstcheck.la
61
62 libgstcheck_la_SOURCES = gstcheck.c
63 libgstcheck_la_LIBADD = $(GST_OBJ_LIBS)
64 noinst_HEADERS = gstcheck.h gst/capslist.h
65
66 AM_CFLAGS = $(GST_OBJ_CFLAGS) $(CHECK_CFLAGS)
67 LDADD = $(GST_OBJ_LIBS) $(CHECK_LIBS) libgstcheck.la
68
69 gst_libs_gdp_SOURCES = \
70         gst-libs/gdp.c \
71         $(top_srcdir)/libs/gst/dataprotocol/dataprotocol.c
72 # remove GST_ENABLE_NEW when dataprotocol has been declared API-stable
73 gst_libs_gdp_CFLAGS = $(AM_CFLAGS) -DGST_ENABLE_NEW
74
75 gst_libs_controller_LDADD = $(GST_OBJ_LIBS) $(CHECK_LIBS) libgstcheck.la \
76         $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la
77
78 # valgrind testing
79
80 # these just need fixing, period
81 TESTS_TO_FIX =                                  \
82         gst/gstghostpad                         \
83         gst/gstiterator                         \
84         gst/gstmessage                          \
85         gst/gstsystemclock                      \
86         gst/gsttag                              \
87         pipelines/cleanup                       \
88         pipelines/simple_launch_lines
89
90 # these need fixing because the threads cause segfaults under valgrind
91 TESTS_THREADED =                                \
92         gst/gstminiobject                       \
93         gst/gstobject
94
95 VALGRIND_TESTS_DISABLE =                        \
96         $(top_builddir)/tools/gst-register      \
97         $(TESTS_THREADED)                       \
98         $(TESTS_TO_FIX)
99
100 if HAVE_VALGRIND
101 # hangs spectacularly on some machines, so let's not do this by default yet
102 check-local-disabled:
103         make valgrind
104 else
105 check-local-disabled:
106         @true
107 endif
108
109 # run any given test by running make test.check
110 %.check: % $(CHECK_REGISTRY)
111         @$(TESTS_ENVIRONMENT)                                   \
112         $*
113
114
115 # valgrind any given test by running make test.valgrind
116 %.valgrind: % $(CHECK_REGISTRY)
117         @$(TESTS_ENVIRONMENT)                                   \
118         libtool --mode=execute                                  \
119         $(VALGRIND_PATH) -q --suppressions=$(srcdir)/gst.supp   \
120         --tool=memcheck --leak-check=yes --trace-children=yes   \
121         $*
122
123 # valgrind all tests
124 valgrind: $(TESTS)
125         @echo "Valgrinding tests ..."
126         $(TESTS_ENVIRONMENT) $(top_builddir)/tools/gst-register
127         @failed=0;                                                      \
128         for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do   \
129                 make $$t.valgrind;                                      \
130                 if test "$$?" -ne 0; then                               \
131                         echo "Valgrind error for test $$t";             \
132                         failed=`expr $$failed + 1`;                     \
133                 fi;                                                     \
134         done;                                                           \
135         if test "$$failed" -ne 0; then                                  \
136                 echo "$$failed tests had leaks under valgrind";         \
137                 false;                                                  \
138         fi