0626837fa977df48bacc7727536b4b3b28b3a816
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-good / tests / check / meson.build
1 valgrind_dep = dependency('valgrind', required: false).partial_dependency(compile_args : true)
2 if valgrind_dep.found()
3   cdata.set('HAVE_VALGRIND', 1)
4 endif
5
6 # internal helper lib for unit testing audio parsers
7 libparser = static_library('libparser', 'elements/parser.c',
8   c_args : gst_plugins_good_args + ['-DGST_USE_UNSTABLE_API'],
9   include_directories : [configinc],
10   dependencies : [gstcheck_dep],
11   install : false)
12
13 libparser_dep = declare_dependency(link_with : libparser,
14   dependencies : gstcheck_dep)
15
16 # name, condition when to skip the test and extra dependencies
17 good_tests = [
18   [ 'elements/audioamplify', get_option('audiofx').disabled(), [gstfft_dep] ],
19   [ 'elements/audiochebband', get_option('audiofx').disabled(), [gstfft_dep] ],
20   [ 'elements/audiocheblimit', get_option('audiofx').disabled(), [gstfft_dep] ],
21   [ 'elements/audiodynamic', get_option('audiofx').disabled(), [gstfft_dep] ],
22   [ 'elements/audioecho', get_option('audiofx').disabled(), [gstfft_dep] ],
23   [ 'elements/audiofirfilter', get_option('audiofx').disabled(), [gstfft_dep] ],
24   [ 'elements/audioiirfilter', get_option('audiofx').disabled(), [gstfft_dep] ],
25   [ 'elements/audioinvert', get_option('audiofx').disabled(), [gstfft_dep] ],
26   [ 'elements/audiopanorama', get_option('audiofx').disabled(), [gstfft_dep] ],
27   [ 'elements/audiowsincband', get_option('audiofx').disabled(), [gstfft_dep] ],
28   [ 'elements/audiowsinclimit', get_option('audiofx').disabled(), [gstfft_dep] ],
29   [ 'elements/alphacolor', get_option('alpha').disabled()],
30   [ 'elements/alpha', get_option('alpha').disabled()],
31   [ 'elements/avimux', get_option('avi').disabled(), [gstriff_dep] ],
32   [ 'elements/avisubtitle', get_option('avi').disabled(), [gstriff_dep] ],
33   [ 'elements/capssetter', get_option('debugutils').disabled()],
34   [ 'elements/aacparse', get_option('audioparsers').disabled(), [libparser_dep] ],
35   [ 'elements/ac3parse', get_option('audioparsers').disabled(), [libparser_dep] ],
36   [ 'elements/amrparse', get_option('audioparsers').disabled(), [libparser_dep] ],
37   [ 'elements/flacparse', get_option('audioparsers').disabled(), [libparser_dep] ],
38   [ 'elements/mpegaudioparse', get_option('audioparsers').disabled(), [libparser_dep] ],
39   [ 'elements/autodetect', get_option('autodetect').disabled()],
40   [ 'elements/deinterlace', get_option('deinterlace').disabled()],
41   [ 'elements/dtmf', get_option('dtmf').disabled()],
42   [ 'elements/flvdemux', get_option('flv').disabled()],
43   [ 'elements/flvmux', get_option('flv').disabled()],
44   [ 'elements/hlsdemux_m3u8' , not hls_dep.found() or not adaptivedemux2_dep.found(), [hls_dep, adaptivedemux2_dep] ],
45   [ 'elements/mulawdec', get_option('law').disabled()],
46   [ 'elements/mulawenc', get_option('law').disabled()],
47   [ 'elements/icydemux', get_option('icydemux').disabled()],
48   [ 'elements/id3demux', get_option('id3demux').disabled()],
49   [ 'elements/imagefreeze', get_option('imagefreeze').disabled()],
50   [ 'elements/deinterleave', get_option('interleave').disabled()],
51   [ 'elements/interleave', get_option('interleave').disabled()],
52   [ 'elements/level', get_option('level').disabled()],
53   [ 'elements/matroskademux', get_option('matroska').disabled(), [gstriff_dep] ],
54   [ 'elements/matroskamux', get_option('matroska').disabled(), [gstriff_dep] ],
55   [ 'elements/matroskaparse', get_option('matroska').disabled(), [gstriff_dep] ],
56   [ 'elements/multifile', get_option('multifile').disabled()],
57   [ 'elements/splitmuxsink', get_option('multifile').disabled()],
58   [ 'elements/splitmuxsinktimecode', get_option('multifile').disabled()],
59   [ 'elements/splitmuxsrc', get_option('multifile').disabled()],
60   [ 'elements/qtmux', get_option('isomp4').disabled(), [gstriff_dep, zlib_dep] ],
61   [ 'elements/qtdemux', get_option('isomp4').disabled(), [gstriff_dep, zlib_dep] ],
62   [ 'elements/rganalysis', get_option('replaygain').disabled()],
63   [ 'elements/rglimiter', get_option('replaygain').disabled()],
64   [ 'elements/rgvolume', get_option('replaygain').disabled()],
65   [ 'elements/spectrum', get_option('spectrum').disabled(), [gstfft_dep] ],
66   [ 'elements/shapewipe', get_option('shapewipe').disabled()],
67   [ 'elements/udpsink', get_option('udp').disabled()],
68   [ 'elements/udpsrc', get_option('udp').disabled()],
69   [ 'elements/videobox', get_option('videobox').disabled()],
70   [ 'elements/videocrop', get_option('videocrop').disabled()],
71   [ 'elements/videofilter', get_option('videofilter').disabled()],
72   [ 'elements/videoflip', get_option('videofilter').disabled()],
73   [ 'elements/videomixer', get_option('videomixer').disabled()],
74   [ 'elements/aspectratiocrop', get_option('videocrop').disabled()],
75   [ 'pipelines/wavenc', get_option('wavenc').disabled()],
76   [ 'elements/wavparse', get_option('wavparse').disabled(), [gstriff_dep] ],
77   [ 'elements/wavpackparse', get_option('audioparsers').disabled()],
78   [ 'elements/xingmux', get_option('xingmux').disabled()],
79   [ 'elements/y4menc', get_option('y4m').disabled()],
80   [ 'pipelines/effectv', get_option('effectv').disabled()],
81   [ 'elements/equalizer', get_option('equalizer').disabled()],
82   [ 'pipelines/simple-launch-lines' ],
83   [ 'pipelines/tagschecking' ],
84   [ 'generic/states' ],
85 ]
86
87 if not get_option('rtp').disabled() and not get_option('rtpmanager').disabled()
88   good_tests += [
89     [ 'elements/rtphdrext-colorspace' ],
90     [ 'elements/rtph261', ],
91     [ 'elements/rtph263' ],
92     [ 'elements/rtph264' ],
93     [ 'elements/rtph265' ],
94     [ 'elements/rtpopus' ],
95     [ 'elements/rtpvp8' ],
96     [ 'elements/rtpvp9' ],
97     [ 'elements/rtpbin' ],
98     [ 'elements/rtpbin_buffer_list' ],
99     [ 'elements/rtpcollision' ],
100     [ 'elements/rtpfunnel' ],
101     [ 'elements/rtphdrextclientaudiolevel', false, [gstsdp_dep, gstaudio_dep] ],
102     [ 'elements/rtphdrextsdes', false, [gstrtp_dep, gstsdp_dep] ],
103     [ 'elements/rtpjitterbuffer' ],
104     [ 'elements/rtpjpeg' ],
105
106     [ 'elements/rtptimerqueue', false, [gstrtp_dep],
107       ['../../gst/rtpmanager/rtptimerqueue.c']],
108
109     [ 'elements/rtpmux' ],
110     [ 'elements/rtpptdemux' ],
111     [ 'elements/rtprtx' ],
112     [ 'elements/rtpsession' ],
113     [ 'elements/rtpstorage', false, [],  ['../../gst/rtp/gstrtpstorage.c',
114                                         '../../gst/rtp/gstrtpelement.c',
115                                         '../../gst/rtp/gstrtputils.c',
116                                         '../../gst/rtp/rtpstorage.c',
117                                         '../../gst/rtp/rtpstoragestream.c']],
118     [ 'elements/rtpred' ],
119     [ 'elements/rtpulpfec' ],
120     [ 'elements/rtpssrcdemux' ],
121     [ 'elements/rtp-payloading' ],
122     [ 'elements/rtpst2022-1-fecdec' ],
123     [ 'elements/rtpst2022-1-fecenc' ],
124   ]
125 endif
126
127 # FIXME: valgrind elements/rtp-payloading - needs fixing
128 # elements/videocrop should be disabled since it takes way too long in valgrind
129
130 libsoup2_dep = dependency('libsoup-2.4', version : '>=2.48',
131                           required : false, fallback : ['libsoup', 'libsoup_dep'],
132                           default_options: ['sysprof=disabled'])
133 libsoup3_dep = dependency('libsoup-3.0', required : false,
134                            fallback : ['libsoup3', 'libsoup_dep'])
135
136 # FIXME: unistd dependency or not tested yet on windows
137 if host_machine.system() != 'windows'
138   good_tests += [
139     [ 'elements/dash_mpd', not adaptivedemux2_dep.found(), [adaptivedemux2_dep] ],
140     [ 'pipelines/flacdec', not flac_dep.found() ],
141     [ 'elements/gdkpixbufsink', not gdkpixbuf_dep.found(), [gdkpixbuf_dep] ],
142     [ 'elements/gdkpixbufoverlay', not gdkpixbuf_dep.found() ],
143     [ 'elements/jpegdec', not jpeglib.found() ],
144     [ 'elements/jpegenc', not jpeglib.found() ],
145     [ 'elements/mpg123audiodec', not mpg123_dep.found(), [gstfft_dep]],
146     [ 'elements/souphttpsrc', not libsoup2_dep.found(), [libsoup2_dep], [], 'elements/souphttpsrc2'],
147     [ 'elements/souphttpsrc', not libsoup3_dep.found(), [libsoup3_dep], [], 'elements/souphttpsrc3'],
148     [ 'elements/id3v2mux', not taglib_dep.found() ],
149     [ 'elements/apev2mux', not taglib_dep.found() ],
150     [ 'elements/vp8enc', not vpx_dep.found() or not have_vp8_encoder ],
151     [ 'elements/vp8dec', not vpx_dep.found() or not have_vp8_decoder ],
152     [ 'elements/vp9enc', not vpx_dep.found() or not have_vp9_encoder ],
153     [ 'pipelines/lame', not lame_dep.found() ],
154     [ 'elements/wavpackdec', not wavpack_dep.found() ],
155     [ 'elements/wavpackenc', not wavpack_dep.found() ],
156     [ 'pipelines/wavpack', not wavpack_dep.found() ],
157   ]
158 endif
159
160 test_defines = [
161   '-UG_DISABLE_ASSERT',
162   '-UG_DISABLE_CAST_CHECKS',
163   '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"',
164   '-DGST_TEST_FILES_PATH="' + meson.current_source_dir() + '/../files"',
165   '-DGST_USE_UNSTABLE_API',
166 ]
167
168 pluginsdirs = []
169 if gst_dep.type_name() == 'pkgconfig'
170   pbase = dependency('gstreamer-plugins-base-' + api_version, required: true)
171   pluginsdirs = [gst_dep.get_variable('pluginsdir'),
172                  pbase.get_variable('pluginsdir')]
173   gst_plugin_scanner_dir = gst_dep.get_variable('pluginscannerdir')
174 else
175   gst_plugin_scanner_dir = subproject('gstreamer').get_variable('gst_scanner_dir')
176 endif
177 gst_plugin_scanner_path = join_paths(gst_plugin_scanner_dir, 'gst-plugin-scanner')
178
179 # fake device drivers: we could run hardware element tests against dummy drivers
180 # v4l2: vivo (part of normal kernel)
181 #   modprobe vivo;
182 #   gst-launch v4l2src device="/dev/video1" ! xvimagesink;
183 #   rmmod vivo
184 #
185 # alsa: snd-dummy (part of normal alsa, not removable)
186 #   modprobe snd-dummy;
187 #   gst-launch alsasrc device="hw:2" ! fakesink
188 #   gst-launch fakesrc ! alsasink device="hw:2"
189 #
190 # need a way to figure out value for the device property
191 state_ignore_elements = '''aasink autoaudiosrc autoaudiosink autovideosrc
192  autovideosink cacasink cairotextoverlay gtkglsink gtksink jackaudiosrc
193  jackaudiosink osssrc osssink osxaudiosink osxaudiosrc osxvideosrc osxvideosink
194  pulsesink pulsesrc pulsemixer v4l2src'''
195
196 # FIXME: check, also + PTHREAD_CFLAGS
197 test_deps = [gst_dep, gstbase_dep, gstnet_dep, gstcheck_dep, gstaudio_dep,
198   gstvideo_dep, gstpbutils_dep, gstrtp_dep, gstrtsp_dep, gsttag_dep,
199   gstapp_dep, gio_dep, valgrind_dep]
200
201 # FIXME: add valgrind suppression common/gst.supp gst-plugins-good.supp
202 foreach t : good_tests
203   fname = '@0@.c'.format(t.get(0))
204   test_name = t.get(4, t.get(0)).underscorify()
205   extra_sources = t.get(3, [ ])
206   extra_deps = t.get(2, [ ])
207   skip_test = t.get(1, false)
208   if not skip_test
209     env = environment()
210     env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
211     env.set('GST_STATE_IGNORE_ELEMENTS', state_ignore_elements)
212     env.set('CK_DEFAULT_TIMEOUT', '20')
213     env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer', 'gst-plugins-base',
214       'timecode', 'gst-plugins-good@' + meson.project_build_root())
215     env.set('GST_PLUGIN_PATH_1_0', [meson.global_build_root()] + pluginsdirs)
216     env.set('GSETTINGS_BACKEND', 'memory')
217
218     env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(test_name)))
219     env.set('GST_PLUGIN_SCANNER_1_0', gst_plugin_scanner_path)
220     exe = executable(test_name, fname, extra_sources,
221       include_directories : [configinc, libsinc],
222       c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines,
223       dependencies : [libm] + test_deps + extra_deps,
224     )
225     test(test_name, exe, env: env, timeout: 3 * 60)
226   endif
227 endforeach
228
229 # orc tests
230 orc_tests = [
231   ['orc_audiopanorama', files('../../gst/audiofx/audiopanoramaorc.orc')],
232   ['orc_deinterlace', files('../../gst/deinterlace/tvtime.orc')],
233   ['orc_videomixer', files('../../gst/videomixer/videomixerorc.orc')],
234   ['orc_videobox', files('../../gst/videobox/gstvideoboxorc.orc')],
235 ]
236
237 orc_test_dep = dependency('', required : false)
238 if have_orcc
239   # FIXME: there should really just be a separate orc-test-0.4.pc file for this
240   if orc_dep.type_name() == 'pkgconfig'
241     orc_test_dep = cc.find_library('orc-test-0.4', required : false)
242   else
243     orc_test_dep = dependency('', fallback: ['orc', 'orc_test_dep'], required: false)
244   endif
245 endif
246
247 if have_orcc and orc_test_dep.found()
248   foreach t : orc_tests
249     tname = t[0]
250     torcfile = t[1]
251     tcfilename = '@0@.c'.format(tname)
252     test_c = custom_target(tcfilename,
253       output: tcfilename,
254       input: torcfile,
255       command: [orcc, '--include', 'stdint.h', '--test', '-o', '@OUTPUT@', '@INPUT@'])
256     test_exe = executable(tname, test_c, dependencies: [orc_dep, orc_test_dep])
257     test(tname, test_exe)
258   endforeach
259 endif