560b5b1f67c9c433aaec1742dd4066fbcd15b385
[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 AM_TESTS_ENVIRONMENT = \
11         GST_STATE_IGNORE_ELEMENTS="$(STATE_IGNORE_ELEMENTS)"    \
12         $(REGISTRY_ENVIRONMENT)                                 \
13         GST_PLUGIN_SCANNER_1_0=$(top_builddir)/libs/gst/helpers/gst-plugin-scanner \
14         GST_PLUGIN_SYSTEM_PATH_1_0=                                     \
15         GST_PLUGIN_PATH_1_0=$(top_builddir)/plugins
16
17 plugindir = $(libdir)/gstreamer-@GST_API_VERSION@
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 # These tests don't even build any longer:
31 #   gst/gstindex.c
32
33 if GST_DISABLE_PARSE
34 PARSE_CHECKS = pipelines/parse-disabled
35 else
36 PARSE_CHECKS = pipelines/simple-launch-lines pipelines/cleanup pipelines/parse-launch
37 endif
38
39 # Do not run the abi test in case any option which causes the API to change has
40 # been used
41 if !GST_DISABLE_REGISTRY
42 if !GST_DISABLE_TRACE
43 ABI_CHECKS = gst/gstabi
44 endif
45 endif
46
47 if !GST_DISABLE_GST_DEBUG
48 PRINTF_CHECKS = gst/gstprintf
49 else
50 PRINTF_CHECKS =
51 endif
52
53 LIBSABI_CHECKS = libs/libsabi
54
55 if HAVE_CXX
56 CXX_CHECKS = gst/gstcpp libs/gstlibscpp
57 else
58 CXX_CHECKS =
59 endif
60
61 # if it's calling gst_element_factory_make(), it will probably not work without
62 # a registry
63 if GST_DISABLE_REGISTRY
64 REGISTRY_CHECKS =
65 else
66 REGISTRY_CHECKS =                               \
67         gst/gst                                 \
68         gst/gstbin                              \
69         gst/gstchildproxy                       \
70         gst/gstcontext                          \
71         gst/gstcontroller                       \
72         gst/gstelement                          \
73         gst/gstelementfactory                   \
74         gst/gstevent                            \
75         gst/gstghostpad                         \
76         gst/gstplugin                           \
77         gst/gstpreset                           \
78         gst/gstprotection                       \
79         gst/gstquery                            \
80         gst/gstregistry                         \
81         gst/gsturi                              \
82         gst/gstutils                            \
83         generic/sinks                           \
84         elements/capsfilter                     \
85         elements/concat                         \
86         elements/fakesink                       \
87         elements/fakesrc                        \
88         elements/fdsrc                          \
89         elements/filesink                       \
90         elements/filesrc                        \
91         elements/funnel                         \
92         elements/identity                       \
93         elements/multiqueue                     \
94         elements/selector                       \
95         elements/tee                            \
96         elements/queue                          \
97         elements/queue2                         \
98         elements/valve                          \
99         elements/streamiddemux                  \
100         libs/baseparse                          \
101         libs/basesrc                            \
102         libs/basesink                           \
103         libs/sparsefile                         \
104         libs/controller                         \
105         libs/queuearray                         \
106         libs/typefindhelper                     \
107         pipelines/seek                          \
108         pipelines/stress                        \
109         pipelines/queue-error
110 endif
111
112 check_PROGRAMS =                                \
113         $(ABI_CHECKS)                           \
114         gst/gstatomicqueue                      \
115         gst/gstbuffer                           \
116         gst/gstbufferlist                       \
117         gst/gstbufferpool                       \
118         gst/gstmeta                             \
119         gst/gstmemory                           \
120         gst/gstbus                              \
121         gst/gstcaps                             \
122         gst/gstcapsfeatures                     \
123         $(CXX_CHECKS)                           \
124         gst/gstdatetime                         \
125         gst/gstdevice                           \
126         gst/gstinfo                             \
127         gst/gstiterator                         \
128         gst/gstmessage                          \
129         gst/gstminiobject                       \
130         gst/gstobject                           \
131         gst/gstpad                              \
132         gst/gstparamspecs                       \
133         gst/gstpipeline                         \
134         gst/gstpoll                             \
135         gst/gstprotection                       \
136         $(PRINTF_CHECKS)                        \
137         gst/gstsegment                          \
138         gst/gstsystemclock                      \
139         gst/gstclock                            \
140         gst/gststructure                        \
141         gst/gsttag                              \
142         gst/gsttracerrecord                             \
143         gst/gsttagsetter                        \
144         gst/gsttask                             \
145         gst/gsttoc                              \
146         gst/gsttocsetter                        \
147         gst/gstvalue                            \
148         generic/states                          \
149         $(PARSE_CHECKS)                         \
150         $(REGISTRY_CHECKS)                      \
151         $(LIBSABI_CHECKS)                       \
152         libs/adapter                            \
153         libs/bitreader                          \
154         libs/bytereader                         \
155         libs/bytewriter                         \
156         libs/bitreader-noinline         \
157         libs/bytereader-noinline        \
158         libs/bytewriter-noinline        \
159         libs/flowcombiner                       \
160         libs/sparsefile                         \
161         libs/collectpads                        \
162         libs/gstharness                         \
163         libs/gstnetclientclock                  \
164         libs/gstnettimeprovider                 \
165         libs/gsttestclock                       \
166         libs/transform1                         \
167         libs/transform2                         \
168         tools/gstinspect
169
170 # failing tests
171 noinst_PROGRAMS =
172
173 # elements to ignore for the state tests
174 # STATE_IGNORE_ELEMENTS =
175
176 TESTS = $(check_PROGRAMS)
177
178 noinst_HEADERS = \
179         gst/capslist.h \
180         gst/struct_arm.h \
181         gst/struct_i386.h \
182         gst/struct_hppa.h \
183         gst/struct_ppc32.h \
184         gst/struct_ppc64.h \
185         gst/struct_sparc.h \
186         gst/struct_x86_64.h \
187         libs/struct_arm.h \
188         libs/struct_i386.h \
189         libs/struct_hppa.h \
190         libs/struct_ppc32.h \
191         libs/struct_ppc64.h \
192         libs/struct_sparc.h \
193         libs/struct_x86_64.h
194
195 EXTRA_DIST = \
196         libs/test_transform.c
197
198 AM_CFLAGS = $(GST_OBJ_CFLAGS) -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS \
199         -DGST_CHECK_TEST_ENVIRONMENT_BEACON="\"GST_STATE_IGNORE_ELEMENTS\""
200 AM_CXXFLAGS = $(GST_OBJ_CXXFLAGS) -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS \
201         -DGST_CHECK_TEST_ENVIRONMENT_BEACON="\"GST_STATE_IGNORE_ELEMENTS\""
202 LDADD = $(top_builddir)/libs/gst/check/libgstcheck-@GST_API_VERSION@.la \
203         $(top_builddir)/libs/gst/base/libgstbase-@GST_API_VERSION@.la \
204         $(GST_OBJ_LIBS)
205
206 gst_gstcpp_SOURCES = gst/gstcpp.cc
207
208 libs_gstlibscpp_SOURCES = libs/gstlibscpp.cc
209
210 gst_gsttracerrecord_CFLAGS = $(GST_OBJ_CFLAGS) $(AM_CFLAGS) -DGST_USE_UNSTABLE_API
211
212 gst_gstutils_LDADD = $(LDADD) $(GSL_LIBS) $(GMP_LIBS)
213
214 gst_gstprintf_LDADD = \
215         $(top_builddir)/gst/printf/libgstprintf.la \
216         $(LDADD)
217
218 elements_fdsrc_CFLAGS=$(GST_OBJ_CFLAGS) $(AM_CFLAGS) \
219         -DTESTFILE=\"$(top_srcdir)/configure.ac\"
220 elements_filesrc_CFLAGS=$(GST_OBJ_CFLAGS) $(AM_CFLAGS) \
221         -DTESTFILE=\"$(top_srcdir)/configure.ac\"
222
223 libs_controller_LDADD = \
224         $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_API_VERSION@.la \
225         $(LDADD)
226 libs_gstnetclientclock_LDADD = \
227         $(top_builddir)/libs/gst/net/libgstnet-@GST_API_VERSION@.la \
228         $(LDADD)
229 libs_gstnettimeprovider_LDADD = \
230         $(top_builddir)/libs/gst/net/libgstnet-@GST_API_VERSION@.la \
231         $(GIO_LIBS) $(LDADD)
232
233 # valgrind testing
234 # these just need valgrind fixing, period
235 VALGRIND_TO_FIX = \
236         gst/gstinfo \
237         pipelines/parse-launch \
238         tools/gstinspect
239
240 VALGRIND_IGNORE = \
241         pipelines/stress
242
243 # these need fixing because the threads cause segfaults under valgrind
244 TESTS_THREADED =                                \
245         gst/gstminiobject                       \
246         gst/gstobject
247
248 VALGRIND_TESTS_DISABLE =                                        \
249         $(TESTS_THREADED)                                       \
250         $(VALGRIND_IGNORE)                                      \
251         $(VALGRIND_TO_FIX)
252
253 # indexers does not get tested yet
254 COVERAGE_DIRS = \
255         gst \
256         libs/gst/base \
257         libs/gst/controller \
258         libs/gst/check \
259         libs/gst/net \
260         plugins/elements
261 COVERAGE_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov))
262 COVERAGE_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_FILES))
263 COVERAGE_OUT_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov.out))
264 COVERAGE_OUT_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_OUT_FILES))
265
266 debug:
267         echo $(COVERAGE_FILES)
268         echo $(COVERAGE_FILES_REL)
269
270 .PHONY: coverage
271 if GST_GCOV_ENABLED
272 # we rebuild a registry and do gst-inspect so that all the get/set codepaths
273 # are also covered
274 coverage:
275         for file in `find $(top_builddir) -name '*.gcda'`; do rm $$file; done
276         -rm $(CHECK_REGISTRY)
277         echo "Inspecting all elements"
278         for e in `$(GST_INSPECT) | head -n -2 | cut -d: -f2`; do $(GST_INSPECT) $$e > /dev/null 2>&1; done
279         make check
280         make coverage-report
281 else
282 coverage:
283         echo "You need to configure with --enable-gcov to get coverage data"
284         exit 1
285 endif
286
287 coverage-report:
288         rm -r coverage
289         for dir in $(COVERAGE_DIRS); do                                 \
290           mkdir -p coverage/$$dir;                                      \
291           make -C $(top_builddir)/$$dir gcov;                           \
292         done
293         for dir in $(COVERAGE_DIRS); do                                 \
294             files="`ls $(top_builddir)/$$dir/*.gcov.out 2> /dev/null`"; \
295           if test ! -z "$$files"; then                                  \
296             perl $(top_srcdir)/common/coverage/coverage-report.pl       \
297               $(top_builddir)/$$dir/*.gcov.out >                        \
298               coverage/$$dir/index.xml;                                 \
299             xsltproc $(top_srcdir)/common/coverage/coverage-report.xsl  \
300               coverage/$$dir/index.xml > coverage/$$dir/index.html;     \
301           fi; \
302         done
303         for file in $(COVERAGE_FILES_REL); do                           \
304           echo Generating coverage/$$file.html;                         \
305           perl $(top_srcdir)/common/coverage/coverage-report-entry.pl   \
306             $(top_builddir)/$$file > coverage/$$file.html;              \
307         done