tests: skip unit tests for dependency-less elements that have been disabled
[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, gstglx11_dep, gstglwayland_dep, gstglegl_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', get_option('adder').disabled()],
34   [ 'elements/appsink.c', get_option('app').disabled()],
35   [ 'elements/appsrc.c', get_option('app').disabled()],
36   [ 'elements/audioconvert.c', get_option('audioconvert').disabled()],
37   [ 'elements/audiointerleave.c', get_option('audiomixer').disabled()],
38   [ 'elements/audiomixer.c', get_option('audiomixer').disabled(), [ gst_controller_dep ] ],
39   [ 'elements/audiorate.c', get_option('audiorate').disabled()],
40   [ 'elements/audiotestsrc.c', get_option('audiotestsrc').disabled()],
41   [ 'elements/audioresample.c', get_option('audioresample').disabled()],
42   [ 'elements/compositor.c', get_option('compositor').disabled()],
43   [ 'elements/decodebin.c', get_option('playback').disabled()],
44   [ 'elements/overlaycomposition.c', get_option('overlaycomposition').disabled()],
45   [ 'elements/playbin.c', get_option('playback').disabled()],
46   [ 'elements/playsink.c', get_option('playback').disabled()],
47   [ 'elements/streamsynchronizer.c', get_option('playback').disabled()],
48   [ 'elements/subparse.c', get_option('subparse').disabled()],
49   [ 'elements/urisourcebin.c', get_option('playback').disabled()],
50   [ 'elements/videoconvert.c', get_option('videoconvertscale').disabled()],
51   [ 'elements/videorate.c', get_option('videorate').disabled()],
52   [ 'elements/videoscale.c', get_option('videoconvertscale').disabled()],
53   [ 'elements/videotestsrc.c', get_option('videotestsrc').disabled()],
54   [ 'elements/volume.c', get_option('volume').disabled(), [ 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, gstglx11_dep, gstglwayland_dep, gstglegl_dep]],
96     [ 'libs/gstglmatrix.c', not build_gstgl, [gstgl_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     [ 'libs/gstglvideomixerelement.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
104     [ 'elements/glimagesink.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
105     [ 'elements/glbin.c', not build_gstgl ],
106     [ 'pipelines/gl-launch-lines.c', not build_gstgl ],
107     [ 'elements/glfilter.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
108     [ 'elements/glstereo.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
109     [ 'elements/glmixer.c', not build_gstgl, [gstgl_dep, gstglproto_dep]],
110   ]
111 endif
112
113 # Make sure our headers are C++ clean
114 if have_cxx
115   base_tests += [
116     [ 'libs/gstlibscpp.cc', false, [  ] ],
117   ]
118 endif
119
120 test_defines = [
121   '-UG_DISABLE_ASSERT',
122   '-UG_DISABLE_CAST_CHECKS',
123   '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"',
124   '-DGST_TEST_FILES_PATH="' + meson.current_source_dir() + '/../files"',
125   '-DGST_TEST_FILE="' + meson.current_source_dir() + '/../files/partialframe.mjpeg"', # for libs/discoverer
126   '-DGST_USE_UNSTABLE_API',
127 ]
128
129 valgrind_dep = dependency('valgrind', required: false)
130 if valgrind_dep.found()
131   test_defines += ['-DHAVE_VALGRIND']
132 endif
133
134 if build_gstgl
135   test_defines += ['-DTEST_GST_GL_ABI_CHECK']
136 endif
137
138 test_deps = [gst_dep, gst_base_dep, gst_net_dep, gst_check_dep, audio_dep,
139   video_dep, pbutils_dep, rtp_dep, rtsp_dep, tag_dep, allocators_dep, app_dep,
140   fft_dep, riff_dep, sdp_dep, gio_dep, valgrind_dep]
141
142 foreach t : base_tests
143   fname = t.get(0)
144   test_name = fname.split('.').get(0).underscorify()
145   skip_test = false
146   extra_deps = [ ]
147
148   if t.length() >= 3
149     extra_deps = t.get(2)
150   endif
151
152   if t.length() >= 2
153     skip_test = t.get(1)
154   endif
155
156   if not skip_test
157     exe = executable(test_name, fname,
158       include_directories : [configinc],
159       c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines,
160       cpp_args : gst_plugins_base_args,
161       dependencies : [libm] + test_deps + extra_deps,
162     )
163
164     env = environment()
165     env.set('GST_PLUGIN_PATH_1_0', meson.global_build_root(), pluginsdirs)
166     env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
167     env.set('GST_STATE_IGNORE_ELEMENTS', 'cdio cdparanoiasrc libvisual_ alsasrc alsasink')
168     env.set('CK_DEFAULT_TIMEOUT', '20')
169     env.set('GST_TAG_LICENSE_TRANSLATIONS_DICT', join_paths(gst_tag_dir, 'license-translations.dict'))
170     env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer',
171         'gst-plugins-base@' + meson.project_build_root())
172     env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(test_name)))
173     env.set('GST_PLUGIN_SCANNER_1_0', gst_plugin_scanner_path)
174     test(test_name, exe, env: env, timeout: 3 * 60)
175   endif
176 endforeach
177
178 # videoscale tests (split in groups)
179 foreach group : [1, 2, 3, 4, 5, 6]
180   vscale_test_name = 'elements-videoscale-@0@'.format(group)
181   exe = executable(vscale_test_name, join_paths('elements', 'videoscale.c'),
182       include_directories : [configinc],
183       c_args : ['-DHAVE_CONFIG_H=1', '-DVSCALE_TEST_GROUP=@0@'.format(group) ] + test_defines,
184       dependencies : [libm] + test_deps + extra_deps)
185
186   # TODO Use env.copy when it is in meson
187   env = environment()
188   env.set('GST_PLUGIN_PATH_1_0', meson.global_build_root(), pluginsdirs)
189   env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
190   env.set('GST_STATE_IGNORE_ELEMENTS', 'cdio cdparanoiasrc libvisual_ alsasrc alsasink')
191   env.set('CK_DEFAULT_TIMEOUT', '20')
192   env.set('GST_TAG_LICENSE_TRANSLATIONS_DICT', join_paths(gst_tag_dir, 'license-translations.dict'))
193   env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer',
194       'gst-plugins-base@' + meson.project_build_root())
195   env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(vscale_test_name)))
196   env.set('GST_PLUGIN_SCANNER_1_0', gst_plugin_scanner_path)
197
198   test(vscale_test_name, exe, env: env, timeout: 3 * 60)
199 endforeach
200
201 # orc tests
202 orc_tests = [
203   ['orc_audio', files('../../gst-libs/gst/audio/gstaudiopack.orc')],
204   ['orc_video', files('../../gst-libs/gst/video/video-orc.orc')],
205   ['orc_adder', files('../../gst/adder/gstadderorc.orc')],
206   ['orc_audiomixer', files('../../gst/audiomixer/gstaudiomixerorc.orc')],
207   ['orc_compositor', files('../../gst/compositor/compositororc.orc')],
208   ['orc_volume', files('../../gst/volume/gstvolumeorc.orc')],
209   ['orc_videotestsrc', files('../../gst/videotestsrc/gstvideotestsrcorc.orc')],
210 ]
211
212 orc_test_dep = dependency('', required : false)
213 if have_orcc
214   # FIXME: there should really just be a separate orc-test-0.4.pc file for this
215   if orc_dep.type_name() == 'pkgconfig'
216     orc_test_dep = cc.find_library('orc-test-0.4', required : false)
217   endif
218   if not orc_test_dep.found()
219     orc_test_dep = dependency('', fallback: ['orc', 'orc_test_dep'], required: false)
220   endif
221 endif
222
223 if have_orcc and orc_test_dep.found()
224   foreach t : orc_tests
225     tname = t[0]
226     torcfile = t[1]
227     tcfilename = '@0@.c'.format(tname)
228     test_c = custom_target(tcfilename,
229       output: tcfilename,
230       input: torcfile,
231       command: [orcc, '--include', 'stdint.h', '--test', '-o', '@OUTPUT@', '@INPUT@'])
232     test_exe = executable(tname, test_c, dependencies: [orc_dep, orc_test_dep])
233     test(tname, test_exe)
234   endforeach
235 endif