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