efcacb2932c409be94362af6dda5892bd8ff62c4
[platform/upstream/gstreamer.git] / tests / check / Makefile.am
1 include $(top_srcdir)/common/check.mak
2
3 CHECK_REGISTRY = $(top_builddir)/tests/check/test-registry.reg
4
5 GST_TOOLS_DIR = $(top_builddir)/tools
6
7 REGISTRY_ENVIRONMENT = \
8         GST_REGISTRY=$(CHECK_REGISTRY)
9
10 TESTS_ENVIRONMENT = \
11         GST_STATE_IGNORE_ELEMENTS="$(STATE_IGNORE_ELEMENTS)"    \
12         $(REGISTRY_ENVIRONMENT)                                 \
13         GST_PLUGIN_SCANNER=$(top_builddir)/libs/gst/helpers/gst-plugin-scanner \
14         GST_PLUGIN_SYSTEM_PATH=                                 \
15         GST_PLUGIN_PATH=$(top_builddir)/plugins
16
17 plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
18
19 # override to _not_ install the test plugins
20 install-pluginLTLIBRARIES:
21
22 # the core dumps of some machines have PIDs appended, test registry and
23 # profiling data
24 CLEANFILES = core core.* test-registry.* *.gcno *.gcda
25
26 SUPPRESSIONS = $(top_srcdir)/common/gst.supp
27
28 clean-local: clean-local-check
29
30 if GST_DISABLE_PARSE
31 PARSE_CHECKS = pipelines/parse-disabled
32 else
33 PARSE_CHECKS = pipelines/simple-launch-lines pipelines/cleanup pipelines/parse-launch
34 endif
35
36 # Do not run the abi test in case any option which causes the API to change has
37 # been used
38 if !GST_DISABLE_LOADSAVE
39 if !GST_DISABLE_REGISTRY
40 if !GST_DISABLE_TRACE
41 ABI_CHECKS = gst/gstabi
42 endif
43 endif
44 endif
45
46 if HAVE_CXX
47 CXX_CHECKS = gst/gstcpp libs/gstlibscpp
48 else
49 CXX_CHECKS =
50 endif
51
52 # if it's calling gst_element_factory_make(), it will probably not work without
53 # a registry
54 if GST_DISABLE_REGISTRY
55 REGISTRY_CHECKS =
56 else
57 REGISTRY_CHECKS =                               \
58         gst/gst                                 \
59         gst/gstbin                              \
60         gst/gstchildproxy                       \
61         gst/gstelement                          \
62         gst/gstelementfactory                   \
63         gst/gstevent                            \
64         gst/gstghostpad                         \
65         gst/gstindex                            \
66         gst/gstinterface                        \
67         gst/gstplugin                           \
68         gst/gstpreset                           \
69         gst/gstquery                            \
70         gst/gstregistry                         \
71         gst/gsturi                              \
72         gst/gstutils                            \
73         generic/sinks                           \
74         elements/capsfilter                     \
75         elements/fakesink                       \
76         elements/fakesrc                        \
77         elements/fdsrc                          \
78         elements/filesink                       \
79         elements/filesrc                        \
80         elements/funnel                         \
81         elements/identity                       \
82         elements/multiqueue                     \
83         elements/selector                       \
84         elements/tee                            \
85         elements/queue                          \
86         elements/queue2                         \
87         elements/valve                          \
88         libs/basesrc                            \
89         libs/basesink                           \
90         libs/controller                         \
91         libs/typefindhelper                     \
92         pipelines/seek                          \
93         pipelines/stress                        \
94         pipelines/queue-error
95 endif
96
97 check_PROGRAMS =                                \
98         $(ABI_CHECKS)                           \
99         gst/gstatomicqueue                      \
100         gst/gstbuffer                           \
101         gst/gstbufferlist                       \
102         gst/gstbus                              \
103         gst/gstcaps                             \
104         $(CXX_CHECKS)                           \
105         gst/gstdatetime                         \
106         gst/gstinfo                             \
107         gst/gstiterator                         \
108         gst/gstmessage                          \
109         gst/gstminiobject                       \
110         gst/gstobject                           \
111         gst/gstpad                              \
112         gst/gstparamspecs                       \
113         gst/gstpoll                             \
114         gst/gstsegment                          \
115         gst/gstsystemclock                      \
116         gst/gstclock                            \
117         gst/gststructure                        \
118         gst/gsttag                              \
119         gst/gsttagsetter                        \
120         gst/gsttask                             \
121         gst/gsttoc                              \
122         gst/gstvalue                            \
123         generic/states                          \
124         $(PARSE_CHECKS)                         \
125         $(REGISTRY_CHECKS)                      \
126         libs/libsabi                            \
127         libs/gdp                                \
128         libs/adapter                            \
129         libs/bitreader                          \
130         libs/bytereader                         \
131         libs/bytewriter                         \
132         libs/gstnetclientclock                  \
133         libs/gstnettimeprovider                 \
134         libs/transform1
135
136 # failing tests
137 noinst_PROGRAMS =                               \
138         gst/gstpipeline                         \
139         libs/collectpads
140
141 # elements to ignore for the state tests
142 # STATE_IGNORE_ELEMENTS =
143
144 TESTS = $(check_PROGRAMS)
145
146 noinst_HEADERS = \
147         gst/capslist.h \
148         gst/struct_arm.h \
149         gst/struct_i386.h \
150         gst/struct_hppa.h \
151         gst/struct_ppc32.h \
152         gst/struct_ppc64.h \
153         gst/struct_sparc.h \
154         gst/struct_x86_64.h \
155         libs/struct_arm.h \
156         libs/struct_i386.h \
157         libs/struct_hppa.h \
158         libs/struct_ppc32.h \
159         libs/struct_ppc64.h \
160         libs/struct_sparc.h \
161         libs/struct_x86_64.h
162
163 EXTRA_DIST = \
164         libs/test_transform.c
165
166 AM_CFLAGS = $(GST_OBJ_CFLAGS) -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS
167 AM_CXXFLAGS = $(GST_OBJ_CXXFLAGS) -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS
168 LDADD = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \
169         $(top_builddir)/libs/gst/base/libgstbase-@GST_MAJORMINOR@.la \
170         $(GST_OBJ_LIBS)
171
172 gst_gstcpp_SOURCES = gst/gstcpp.cc
173
174 libs_gstlibscpp_SOURCES = libs/gstlibscpp.cc
175
176 gst_gstutils_LDADD = $(LDADD) $(GSL_LIBS) $(GMP_LIBS)
177
178 libs_gdp_SOURCES = \
179         libs/gdp.c
180 libs_gdp_LDADD = \
181         $(top_builddir)/libs/gst/dataprotocol/libgstdataprotocol-@GST_MAJORMINOR@.la \
182         $(LDADD)
183
184 elements_fdsrc_CFLAGS=$(GST_OBJ_CFLAGS) $(AM_CFLAGS) \
185         -DTESTFILE=\"$(top_srcdir)/configure.ac\"
186 elements_filesrc_CFLAGS=$(GST_OBJ_CFLAGS) $(AM_CFLAGS) \
187         -DTESTFILE=\"$(top_srcdir)/configure.ac\"
188
189 libs_controller_LDADD = \
190         $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la \
191         $(LDADD)
192 libs_gstnetclientclock_LDADD = \
193         $(top_builddir)/libs/gst/net/libgstnet-@GST_MAJORMINOR@.la \
194         $(LDADD)
195 libs_gstnettimeprovider_LDADD = \
196         $(top_builddir)/libs/gst/net/libgstnet-@GST_MAJORMINOR@.la \
197         $(LDADD)
198
199 # valgrind testing
200 # these just need valgrind fixing, period
201 VALGRIND_TO_FIX = \
202         gst/gstinfo \
203         libs/collectpads \
204         pipelines/parse-launch
205
206 VALGRIND_IGNORE = \
207         pipelines/stress
208
209 # these need fixing because the threads cause segfaults under valgrind
210 TESTS_THREADED =                                \
211         gst/gstminiobject                       \
212         gst/gstobject
213
214 VALGRIND_TESTS_DISABLE =                                        \
215         $(TESTS_THREADED)                                       \
216         $(VALGRIND_IGNORE)                                      \
217         $(VALGRIND_TO_FIX)
218
219 # indexers does not get tested yet
220 COVERAGE_DIRS = \
221         gst \
222         libs/gst/base \
223         libs/gst/controller \
224         libs/gst/check \
225         libs/gst/dataprotocol \
226         libs/gst/net \
227         plugins/elements
228 COVERAGE_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov))
229 COVERAGE_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_FILES))
230 COVERAGE_OUT_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov.out))
231 COVERAGE_OUT_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_OUT_FILES))
232
233 debug:
234         echo $(COVERAGE_FILES)
235         echo $(COVERAGE_FILES_REL)
236
237 .PHONY: coverage
238 if GST_GCOV_ENABLED
239 # we rebuild a registry and do gst-inspect so that all the get/set codepaths
240 # are also covered
241 coverage:
242         for file in `find $(top_builddir) -name '*.gcda'`; do rm $$file; done
243         -rm $(CHECK_REGISTRY)
244         echo "Inspecting all elements"
245         for e in `$(GST_INSPECT) | head -n -2 | cut -d: -f2`; do $(GST_INSPECT) $$e > /dev/null 2>&1; done
246         make check
247         make coverage-report
248 else
249 coverage:
250         echo "You need to configure with --enable-gcov to get coverage data"
251         exit 1
252 endif
253
254 coverage-report:
255         rm -r coverage
256         for dir in $(COVERAGE_DIRS); do                                 \
257           mkdir -p coverage/$$dir;                                      \
258           make -C $(top_builddir)/$$dir gcov;                           \
259         done
260         for dir in $(COVERAGE_DIRS); do                                 \
261             files="`ls $(top_builddir)/$$dir/*.gcov.out 2> /dev/null`"; \
262           if test ! -z "$$files"; then                                  \
263             perl $(top_srcdir)/common/coverage/coverage-report.pl       \
264               $(top_builddir)/$$dir/*.gcov.out >                        \
265               coverage/$$dir/index.xml;                                 \
266             xsltproc $(top_srcdir)/common/coverage/coverage-report.xsl  \
267               coverage/$$dir/index.xml > coverage/$$dir/index.html;     \
268           fi; \
269         done
270         
271         for file in $(COVERAGE_FILES_REL); do                           \
272           echo Generating coverage/$$file.html;                         \
273           perl $(top_srcdir)/common/coverage/coverage-report-entry.pl   \
274             $(top_builddir)/$$file > coverage/$$file.html;              \
275         done