Merging gst-docs
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-base / tests / check / meson.build
1 have_registry = true # FIXME get_option('registry')
2
3 # name, condition when to skip the test and extra dependencies
4 base_tests = [
5   [ 'gst/typefindfunctions.c', not have_registry ],
6   [ 'libs/audio.c' ],
7   [ 'libs/audiocdsrc.c' ],
8   [ 'libs/audiodecoder.c' ],
9   [ 'libs/audioencoder.c' ],
10   [ 'libs/audiosink.c' ],
11   [ 'libs/baseaudiovisualizer.c' ],
12   [ 'libs/discoverer.c' ],
13   [ 'libs/fft.c' ],
14   [ 'libs/libsabi.c', false, [ gstgl_dep ] ],
15   [ 'libs/mikey.c' ],
16   [ 'libs/navigation.c' ],
17   [ 'libs/pbutils.c' ],
18   [ 'libs/profile.c' ],
19   [ 'libs/rtp.c' ],
20   [ 'libs/rtpbasedepayload.c' ],
21   [ 'libs/rtpbasepayload.c' ],
22   [ 'libs/rtphdrext.c' ],
23   [ 'libs/rtpmeta.c' ],
24   [ 'libs/rtsp.c' ],
25   [ 'libs/sdp.c' ],
26   [ 'libs/tag.c' ],
27   [ 'libs/video.c' ],
28   [ 'libs/videoanc.c' ],
29   [ 'libs/videoencoder.c' ],
30   [ 'libs/videodecoder.c' ],
31   [ 'libs/videotimecode.c' ],
32   [ 'libs/xmpwriter.c' ],
33   [ 'elements/adder.c' ],
34   [ 'elements/appsink.c' ],
35   [ 'elements/appsrc.c' ],
36   [ 'elements/audioconvert.c' ],
37   [ 'elements/audiointerleave.c' ],
38   [ 'elements/audiomixer.c', false, [ gst_controller_dep ] ],
39   [ 'elements/audiorate.c' ],
40   [ 'elements/audiotestsrc.c' ],
41   [ 'elements/audioresample.c' ],
42   [ 'elements/compositor.c' ],
43   [ 'elements/decodebin.c' ],
44   [ 'elements/overlaycomposition.c' ],
45   [ 'elements/playbin.c' ],
46   [ 'elements/playsink.c' ],
47   [ 'elements/streamsynchronizer.c' ],
48   [ 'elements/subparse.c' ],
49   [ 'elements/urisourcebin.c' ],
50   [ 'elements/videoconvert.c' ],
51   [ 'elements/videorate.c' ],
52   [ 'elements/videoscale.c' ],
53   [ 'elements/videotestsrc.c' ],
54   [ 'elements/volume.c', false, [ gst_controller_dep ] ],
55   [ 'generic/clock-selection.c' ],
56   [ 'generic/states.c', false, [ gmodule_dep ] ],
57   [ 'pipelines/simple-launch-lines.c' ],
58   [ 'pipelines/basetime.c' ],
59   [ 'pipelines/capsfilter-renegotiation.c' ],
60   [ 'pipelines/gio.c' ],
61   [ 'pipelines/streamsynchronizer.c' ],
62 ]
63
64 # FIXME: unistd dependency, unstable or not tested yet on windows
65 if host_machine.system() != 'windows'
66   base_tests += [
67     [ 'libs/allocators.c', host_machine.system() != 'linux' ],
68     [ 'libs/rtspconnection.c' ],
69     [ 'elements/libvisual.c', not is_variable('libvisual_dep') or not libvisual_dep.found() ],
70     [ 'elements/encodebin.c', not theoraenc_dep.found() or not vorbisenc_dep.found() ],
71     [ 'elements/multifdsink.c', not core_conf.has('HAVE_SYS_SOCKET_H') or not core_conf.has('HAVE_UNISTD_H') ],
72     # FIXME: multisocketsink test on windows/msvc
73     [ 'elements/multisocketsink.c', not core_conf.has('HAVE_SYS_SOCKET_H') or not core_conf.has('HAVE_UNISTD_H') ],
74     [ 'elements/playbin-complex.c', not ogg_dep.found() ],
75     [ 'elements/textoverlay.c', not pango_dep.found() ],
76     [ 'elements/vorbisdec.c', not vorbis_dep.found(), [ vorbis_dep, vorbisenc_dep ] ],
77     [ 'elements/vorbistag.c', not vorbisenc_dep.found(), [ vorbis_dep, vorbisenc_dep ] ],
78     [ 'pipelines/oggmux.c', not ogg_dep.found(), [ ogg_dep, ] ],
79     # FIXME: tcp test on windows/msvc
80     [ 'pipelines/tcp.c', not core_conf.has('HAVE_SYS_SOCKET_H') or not core_conf.has('HAVE_UNISTD_H'), [giounix_dep] ],
81     [ 'pipelines/theoraenc.c', not theoraenc_dep.found(), [ theoraenc_dep ] ],
82     [ 'pipelines/vorbisenc.c', not vorbisenc_dep.found() ],
83     [ 'pipelines/vorbisdec.c', not vorbisenc_dep.found() ],
84   ]
85 endif
86
87 # FIXME: Unstable on Windows
88 if build_gstgl and host_machine.system() != 'windows'
89   base_tests += [
90     [ 'libs/gstglapi.c', not build_gstgl, [gstgl_dep]],
91     [ 'libs/gstglcolorconvert.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
92     [ 'libs/gstglcontext.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
93     [ 'libs/gstglfeature.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
94     [ 'libs/gstglformat.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
95     [ 'libs/gstglheaders.c', not build_gstgl, [gstgl_dep]],
96     [ 'libs/gstglmatrix.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
97     [ 'libs/gstglmemory.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
98     [ 'libs/gstglquery.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
99     [ 'libs/gstglshader.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
100     [ 'libs/gstglsl.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
101     [ 'libs/gstglslstage.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
102     [ 'libs/gstglupload.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
103     [ 'elements/glimagesink.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
104     [ 'elements/glbin.c', not build_gstgl ],
105     [ 'pipelines/gl-launch-lines.c', not build_gstgl ],
106     [ 'elements/glfilter.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
107     [ 'elements/glstereo.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
108     [ 'elements/glmixer.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
109   ]
110 endif
111
112 # Make sure our headers are C++ clean
113 if have_cxx
114   base_tests += [
115     [ 'libs/gstlibscpp.cc', false, [  ] ],
116   ]
117 endif
118
119 test_defines = [
120   '-UG_DISABLE_ASSERT',
121   '-UG_DISABLE_CAST_CHECKS',
122   '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"',
123   '-DGST_TEST_FILES_PATH="' + meson.current_source_dir() + '/../files"',
124   '-DGST_TEST_FILE="' + meson.current_source_dir() + '/../files/partialframe.mjpeg"', # for libs/discoverer
125   '-DGST_USE_UNSTABLE_API',
126 ]
127
128 valgrind_dep = dependency('valgrind', required: false)
129 if valgrind_dep.found()
130   test_defines += ['-DHAVE_VALGRIND']
131 endif
132
133 if build_gstgl
134   test_defines += ['-DTEST_GST_GL_ABI_CHECK']
135 endif
136
137 test_deps = [gst_dep, gst_base_dep, gst_net_dep, gst_check_dep, audio_dep,
138   video_dep, pbutils_dep, rtp_dep, rtsp_dep, tag_dep, allocators_dep, app_dep,
139   fft_dep, riff_dep, sdp_dep, gio_dep, valgrind_dep] + glib_deps
140
141 foreach t : base_tests
142   fname = t.get(0)
143   test_name = fname.split('.').get(0).underscorify()
144   skip_test = false
145   extra_deps = [ ]
146
147   if t.length() >= 3
148     extra_deps = t.get(2)
149   endif
150
151   if t.length() >= 2
152     skip_test = t.get(1)
153   endif
154
155   if not skip_test
156     exe = executable(test_name, fname,
157       include_directories : [configinc],
158       c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines,
159       cpp_args : gst_plugins_base_args,
160       dependencies : [libm] + test_deps + extra_deps,
161     )
162
163     env = environment()
164     env.set('GST_PLUGIN_PATH_1_0', meson.build_root(), pluginsdirs)
165     env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
166     env.set('GST_STATE_IGNORE_ELEMENTS', 'cdio cdparanoiasrc libvisual_ alsasrc alsasink')
167     env.set('CK_DEFAULT_TIMEOUT', '20')
168     env.set('GST_TAG_LICENSE_TRANSLATIONS_DICT', join_paths(gst_tag_dir, 'license-translations.dict'))
169     env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer',
170         'gst-plugins-base@' + meson.build_root())
171     env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(test_name)))
172     env.set('GST_PLUGIN_SCANNER_1_0', gst_plugin_scanner_path)
173     test(test_name, exe, env: env, timeout: 3 * 60)
174   endif
175 endforeach
176
177 # videoscale tests (split in groups)
178 foreach group : [1, 2, 3, 4, 5, 6]
179   vscale_test_name = 'elements-videoscale-@0@'.format(group)
180   exe = executable(vscale_test_name, join_paths('elements', 'videoscale.c'),
181       include_directories : [configinc],
182       c_args : ['-DHAVE_CONFIG_H=1', '-DVSCALE_TEST_GROUP=@0@'.format(group) ] + test_defines,
183       dependencies : [libm] + test_deps + extra_deps)
184
185   # TODO Use env.copy when it is in meson
186   env = environment()
187   env.set('GST_PLUGIN_PATH_1_0', meson.build_root(), pluginsdirs)
188   env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
189   env.set('GST_STATE_IGNORE_ELEMENTS', 'cdio cdparanoiasrc libvisual_ alsasrc alsasink')
190   env.set('CK_DEFAULT_TIMEOUT', '20')
191   env.set('GST_TAG_LICENSE_TRANSLATIONS_DICT', join_paths(gst_tag_dir, 'license-translations.dict'))
192   env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer',
193       'gst-plugins-base@' + meson.build_root())
194   env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(vscale_test_name)))
195   env.set('GST_PLUGIN_SCANNER_1_0', gst_plugin_scanner_path)
196
197   test(vscale_test_name, exe, env: env, timeout: 3 * 60)
198 endforeach
199
200 # orc tests
201 orc_tests = [
202   ['orc_audio', files('../../gst-libs/gst/audio/gstaudiopack.orc')],
203   ['orc_video', files('../../gst-libs/gst/video/video-orc.orc')],
204   ['orc_adder', files('../../gst/adder/gstadderorc.orc')],
205   ['orc_audiomixer', files('../../gst/audiomixer/gstaudiomixerorc.orc')],
206   ['orc_compositor', files('../../gst/compositor/compositororc.orc')],
207   ['orc_volume', files('../../gst/volume/gstvolumeorc.orc')],
208   ['orc_videotestsrc', files('../../gst/videotestsrc/gstvideotestsrcorc.orc')],
209 ]
210
211 orc_test_dep = dependency('', required : false)
212 if have_orcc
213   # FIXME: there should really just be a separate orc-test-0.4.pc file for this
214   if orc_dep.type_name() == 'pkgconfig'
215     orc_test_dep = cc.find_library('orc-test-0.4', required : false)
216   endif
217   if not orc_test_dep.found()
218     orc_test_dep = dependency('', fallback: ['orc', 'orc_test_dep'], required: false)
219   endif
220 endif
221
222 if have_orcc and orc_test_dep.found()
223   foreach t : orc_tests
224     tname = t[0]
225     torcfile = t[1]
226     tcfilename = '@0@.c'.format(tname)
227     test_c = custom_target(tcfilename,
228       output: tcfilename,
229       input: torcfile,
230       command: [orcc, '--include', 'stdint.h', '--test', '-o', '@OUTPUT@', '@INPUT@'])
231     test_exe = executable(tname, test_c, dependencies: [orc_dep, orc_test_dep])
232     test(tname, test_exe)
233   endforeach
234 endif