07ad657af668278c0d87d3a838b40c7dfd8e1dc6
[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/gsttagsetter                        \
143         gst/gsttask                             \
144         gst/gsttoc                              \
145         gst/gsttocsetter                        \
146         gst/gstvalue                            \
147         generic/states                          \
148         $(PARSE_CHECKS)                         \
149         $(REGISTRY_CHECKS)                      \
150         $(LIBSABI_CHECKS)                       \
151         libs/adapter                            \
152         libs/bitreader                          \
153         libs/bytereader                         \
154         libs/bytewriter                         \
155         libs/bitreader-noinline         \
156         libs/bytereader-noinline        \
157         libs/bytewriter-noinline        \
158         libs/flowcombiner                       \
159         libs/sparsefile                         \
160         libs/collectpads                        \
161         libs/gstharness                         \
162         libs/gstnetclientclock                  \
163         libs/gstnettimeprovider                 \
164         libs/gsttestclock                       \
165         libs/transform1                         \
166         libs/transform2                         \
167         tools/gstinspect
168
169 # failing tests
170 noinst_PROGRAMS =
171
172 # elements to ignore for the state tests
173 # STATE_IGNORE_ELEMENTS =
174
175 TESTS = $(check_PROGRAMS)
176
177 noinst_HEADERS = \
178         gst/capslist.h \
179         gst/struct_arm.h \
180         gst/struct_i386.h \
181         gst/struct_hppa.h \
182         gst/struct_ppc32.h \
183         gst/struct_ppc64.h \
184         gst/struct_sparc.h \
185         gst/struct_x86_64.h \
186         libs/struct_arm.h \
187         libs/struct_i386.h \
188         libs/struct_hppa.h \
189         libs/struct_ppc32.h \
190         libs/struct_ppc64.h \
191         libs/struct_sparc.h \
192         libs/struct_x86_64.h
193
194 EXTRA_DIST = \
195         libs/test_transform.c
196
197 AM_CFLAGS = $(GST_OBJ_CFLAGS) -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS \
198         -DGST_CHECK_TEST_ENVIRONMENT_BEACON="\"GST_STATE_IGNORE_ELEMENTS\""
199 AM_CXXFLAGS = $(GST_OBJ_CXXFLAGS) -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS \
200         -DGST_CHECK_TEST_ENVIRONMENT_BEACON="\"GST_STATE_IGNORE_ELEMENTS\""
201 LDADD = $(top_builddir)/libs/gst/check/libgstcheck-@GST_API_VERSION@.la \
202         $(top_builddir)/libs/gst/base/libgstbase-@GST_API_VERSION@.la \
203         $(GST_OBJ_LIBS)
204
205 gst_gstcpp_SOURCES = gst/gstcpp.cc
206
207 libs_gstlibscpp_SOURCES = libs/gstlibscpp.cc
208
209 gst_gstutils_LDADD = $(LDADD) $(GSL_LIBS) $(GMP_LIBS)
210
211 gst_gstprintf_LDADD = \
212         $(top_builddir)/gst/printf/libgstprintf.la \
213         $(LDADD)
214
215 elements_fdsrc_CFLAGS=$(GST_OBJ_CFLAGS) $(AM_CFLAGS) \
216         -DTESTFILE=\"$(top_srcdir)/configure.ac\"
217 elements_filesrc_CFLAGS=$(GST_OBJ_CFLAGS) $(AM_CFLAGS) \
218         -DTESTFILE=\"$(top_srcdir)/configure.ac\"
219
220 libs_controller_LDADD = \
221         $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_API_VERSION@.la \
222         $(LDADD)
223 libs_gstnetclientclock_LDADD = \
224         $(top_builddir)/libs/gst/net/libgstnet-@GST_API_VERSION@.la \
225         $(LDADD)
226 libs_gstnettimeprovider_LDADD = \
227         $(top_builddir)/libs/gst/net/libgstnet-@GST_API_VERSION@.la \
228         $(GIO_LIBS) $(LDADD)
229
230 # valgrind testing
231 # these just need valgrind fixing, period
232 VALGRIND_TO_FIX = \
233         gst/gstinfo \
234         pipelines/parse-launch \
235         tools/gstinspect
236
237 VALGRIND_IGNORE = \
238         pipelines/stress
239
240 # these need fixing because the threads cause segfaults under valgrind
241 TESTS_THREADED =                                \
242         gst/gstminiobject                       \
243         gst/gstobject
244
245 VALGRIND_TESTS_DISABLE =                                        \
246         $(TESTS_THREADED)                                       \
247         $(VALGRIND_IGNORE)                                      \
248         $(VALGRIND_TO_FIX)
249
250 # indexers does not get tested yet
251 COVERAGE_DIRS = \
252         gst \
253         libs/gst/base \
254         libs/gst/controller \
255         libs/gst/check \
256         libs/gst/net \
257         plugins/elements
258 COVERAGE_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov))
259 COVERAGE_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_FILES))
260 COVERAGE_OUT_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov.out))
261 COVERAGE_OUT_FILES_REL = $(subst $(top_builddir)/,,$(COVERAGE_OUT_FILES))
262
263 debug:
264         echo $(COVERAGE_FILES)
265         echo $(COVERAGE_FILES_REL)
266
267 .PHONY: coverage
268 if GST_GCOV_ENABLED
269 # we rebuild a registry and do gst-inspect so that all the get/set codepaths
270 # are also covered
271 coverage:
272         for file in `find $(top_builddir) -name '*.gcda'`; do rm $$file; done
273         -rm $(CHECK_REGISTRY)
274         echo "Inspecting all elements"
275         for e in `$(GST_INSPECT) | head -n -2 | cut -d: -f2`; do $(GST_INSPECT) $$e > /dev/null 2>&1; done
276         make check
277         make coverage-report
278 else
279 coverage:
280         echo "You need to configure with --enable-gcov to get coverage data"
281         exit 1
282 endif
283
284 coverage-report:
285         rm -r coverage
286         for dir in $(COVERAGE_DIRS); do                                 \
287           mkdir -p coverage/$$dir;                                      \
288           make -C $(top_builddir)/$$dir gcov;                           \
289         done
290         for dir in $(COVERAGE_DIRS); do                                 \
291             files="`ls $(top_builddir)/$$dir/*.gcov.out 2> /dev/null`"; \
292           if test ! -z "$$files"; then                                  \
293             perl $(top_srcdir)/common/coverage/coverage-report.pl       \
294               $(top_builddir)/$$dir/*.gcov.out >                        \
295               coverage/$$dir/index.xml;                                 \
296             xsltproc $(top_srcdir)/common/coverage/coverage-report.xsl  \
297               coverage/$$dir/index.xml > coverage/$$dir/index.html;     \
298           fi; \
299         done
300         for file in $(COVERAGE_FILES_REL); do                           \
301           echo Generating coverage/$$file.html;                         \
302           perl $(top_srcdir)/common/coverage/coverage-report-entry.pl   \
303             $(top_builddir)/$$file > coverage/$$file.html;              \
304         done