a85d70e483282426de07adb067b50ea620c0b267
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / tests / check / meson.build
1 have_registry = true # FIXME get_option('registry')
2
3 libparser = static_library('parser',
4   'elements/parser.c',
5   install : false,
6   dependencies : [gst_dep, gstcheck_dep],
7 )
8
9 libparser_dep = declare_dependency(link_with: libparser,
10   sources: ['elements/parser.h'])
11
12 # FIXME: automagic
13 exif_dep = dependency('libexif', version : '>= 0.6.16', required : false)
14
15 # Since nalutils API is internal, need to build it again
16 nalutils_dep = gstcodecparsers_dep.partial_dependency (compile_args: true, includes: true)
17
18 enable_gst_play_tests = get_option('gst_play_tests')
19 libsoup_dep = dependency('libsoup-2.4', version : '>=2.48', required : enable_gst_play_tests,
20   fallback : ['libsoup', 'libsoup_dep'])
21
22 # name, condition when to skip the test and extra dependencies
23 base_tests = [
24   [['elements/aesenc.c'], not aes_dep.found(), [aes_dep]],
25   [['elements/aesdec.c'], not aes_dep.found(), [aes_dep]],
26   [['elements/aiffparse.c'], get_option('aiff').disabled()],
27   [['elements/asfmux.c'], get_option('asfmux').disabled()],
28   [['elements/autoconvert.c'], get_option('autoconvert').disabled()],
29   [['elements/autovideoconvert.c'], get_option('autoconvert').disabled()],
30   [['elements/avwait.c'], get_option('timecode').disabled()],
31   [['elements/camerabin.c'], get_option('camerabin2').disabled()],
32   [['elements/ccconverter.c'], not closedcaption_dep.found(), [gstvideo_dep]],
33   [['elements/cccombiner.c'], not closedcaption_dep.found(), ],
34   [['elements/ccextractor.c'], not closedcaption_dep.found(), ],
35   [['elements/cudaconvert.c'], false, [gstgl_dep, gmodule_dep]],
36   [['elements/cudafilter.c'], false, [gstgl_dep, gmodule_dep]],
37   [['elements/d3d11colorconvert.c'], host_machine.system() != 'windows', ],
38   [['elements/gdpdepay.c'], get_option('gdp').disabled()],
39   [['elements/gdppay.c'], get_option('gdp').disabled()],
40   [['elements/h263parse.c'], false, [libparser_dep, gstcodecparsers_dep]],
41   [['elements/h264parse.c'], false, [libparser_dep, gstcodecparsers_dep]],
42   [['elements/h265parse.c'], false, [libparser_dep, gstcodecparsers_dep]],
43   [['elements/hlsdemux_m3u8.c'], not hls_dep.found(), [hls_dep]],
44   [['elements/id3mux.c'], get_option('id3tag').disabled()],
45   [['elements/interlace.c'], get_option('interlace').disabled()],
46   [['elements/jpeg2000parse.c'], false, [libparser_dep, gstcodecparsers_dep]],
47   [['elements/line21.c'], not closedcaption_dep.found(), ],
48   [['elements/mfvideosrc.c'], host_machine.system() != 'windows', ],
49   [['elements/mpegtsdemux.c'], get_option('mpegtsdemux').disabled(), [gstmpegts_dep]],
50   [['elements/mpegtsmux.c'], get_option('mpegtsmux').disabled(), [gstmpegts_dep]],
51   [['elements/mpeg4videoparse.c'], false, [libparser_dep, gstcodecparsers_dep]],
52   [['elements/mpegvideoparse.c'], false, [libparser_dep, gstcodecparsers_dep]],
53   [['elements/msdkh264enc.c'], not have_msdk, [msdk_dep]],
54   [['elements/mxfdemux.c'], get_option('mxf').disabled()],
55   [['elements/mxfmux.c'], get_option('mxf').disabled()],
56   [['elements/nvenc.c'], false, [gstgl_dep, gmodule_dep]],
57   [['elements/nvdec.c'], not gstgl_dep.found(), [gstgl_dep, gmodule_dep]],
58   [['elements/svthevcenc.c'], not svthevcenc_dep.found(), [svthevcenc_dep]],
59    [['elements/openjpeg.c'], not openjpeg_dep.found(), [openjpeg_dep]],
60   [['elements/pcapparse.c'], false, [libparser_dep]],
61   [['elements/pnm.c'], get_option('pnm').disabled()],
62   [['elements/proxysink.c'], get_option('proxy').disabled()],
63   [['elements/ristrtpext.c']],
64   [['elements/rtponvifparse.c'], get_option('onvif').disabled()],
65   [['elements/rtponviftimestamp.c'], get_option('onvif').disabled()],
66   [['elements/rtpsrc.c'], get_option('rtp').disabled()],
67   [['elements/rtpsink.c'], get_option('rtp').disabled()],
68   [['elements/srtp.c'], not srtp_dep.found(), [srtp_dep]],
69   [['elements/switchbin.c'], get_option('switchbin').disabled()],
70   [['elements/videoframe-audiolevel.c'], get_option('videoframe_audiolevel').disabled()],
71   [['elements/viewfinderbin.c']],
72   [['elements/voamrwbenc.c'], not voamrwbenc_dep.found(), [voamrwbenc_dep]],
73   [['elements/vp9parse.c'], false, [gstcodecparsers_dep]],
74   [['elements/av1parse.c'], false, [gstcodecparsers_dep]],
75   [['elements/wasapi.c'], host_machine.system() != 'windows', ],
76   [['elements/wasapi2.c'], host_machine.system() != 'windows', ],
77   [['libs/h264parser.c'], false, [gstcodecparsers_dep]],
78   [['libs/h265parser.c'], false, [gstcodecparsers_dep]],
79   [['libs/insertbin.c'], false, [gstinsertbin_dep]],
80   [['libs/isoff.c'], false, [gstisoff_dep]],
81   [['libs/nalutils.c', '../../gst-libs/gst/codecparsers/nalutils.c'], false, [nalutils_dep]],
82   [['libs/mpegts.c'], false, [gstmpegts_dep]],
83   [['libs/mpegvideoparser.c'], false, [gstcodecparsers_dep]],
84   [['libs/planaraudioadapter.c'], false, [gstbadaudio_dep]],
85   [['libs/play.c'], not enable_gst_play_tests, [gstplay_dep, libsoup_dep]],
86   [['libs/vc1parser.c'], false, [gstcodecparsers_dep]],
87   [['libs/vp8parser.c'], false, [gstcodecparsers_dep]],
88   [['libs/vp9parser.c'], false, [gstcodecparsers_dep]],
89   [['libs/av1parser.c'], false, [gstcodecparsers_dep]],
90   [['libs/h264bitwriter.c'], false, [gstcodecparsers_dep]],
91   [['libs/h265bitwriter.c'], false, [gstcodecparsers_dep]],
92   [['libs/vkmemory.c'], not gstvulkan_dep.found(), [gstvulkan_dep]],
93   [['elements/vkcolorconvert.c'], not gstvulkan_dep.found(), [gstvulkan_dep]],
94   [['libs/vkwindow.c'], not gstvulkan_dep.found(), [gstvulkan_dep]],
95   [['libs/vkdevice.c'], not gstvulkan_dep.found(), [gstvulkan_dep]],
96   [['elements/vkdeviceprovider.c'], not gstvulkan_dep.found(), [gstvulkan_dep]],
97   [['libs/vkcommandpool.c'], not gstvulkan_dep.found(), [gstvulkan_dep]],
98   [['libs/vkimage.c'], not gstvulkan_dep.found(), [gstvulkan_dep]],
99   [['libs/vkinstance.c'], not gstvulkan_dep.found(), [gstvulkan_dep]],
100   [['libs/d3d11device.cpp'], not gstd3d11_dep.found(), [gstd3d11_dep]],
101 ]
102
103 # FIXME: unistd dependency, unstable or not tested yet on windows
104 if host_machine.system() != 'windows'
105   base_tests += [
106     [['elements/assrender.c'], not ass_dep.found(), [ass_dep]],
107     [['elements/avtpaafpay.c'], not avtp_dep.found(), [avtp_dep]],
108     [['elements/avtpaafdepay.c'], not avtp_dep.found(), [avtp_dep]],
109     [['elements/avtpcrfbase.c'], not avtp_dep.found(), [avtp_dep]],
110     [['elements/avtpcrfcheck.c'], not avtp_dep.found(), [avtp_dep], ['../../ext/avtp/gstavtpcrfutil.c']],
111     [['elements/avtpcrfsync.c'], not avtp_dep.found(), [avtp_dep], ['../../ext/avtp/gstavtpcrfutil.c', '../../ext/avtp/gstavtpcrfbase.c']],
112     [['elements/avtpcrfutil.c'], not avtp_dep.found(), [avtp_dep], ['../../ext/avtp/gstavtpcrfutil.c', '../../ext/avtp/gstavtpcrfbase.c']],
113     [['elements/avtpcvfpay.c'], not avtp_dep.found(), [avtp_dep]],
114     [['elements/avtpcvfdepay.c'], not avtp_dep.found(), [avtp_dep]],
115     [['elements/avtpsink.c'], not avtp_dep.found(), [avtp_dep]],
116     [['elements/avtpsrc.c'], not avtp_dep.found(), [avtp_dep]],
117     [['elements/clockselect.c'], get_option('debugutils').disabled()],
118     [['elements/curlhttpsink.c'], not curl_dep.found(), [curl_dep]],
119     [['elements/curlhttpsrc.c'], not curl_dep.found(), [curl_dep, gio_dep]],
120     [['elements/curlfilesink.c'],
121         not curl_dep.found() or not cdata.has('HAVE_UNISTD_H'), [curl_dep]],
122     [['elements/curlftpsink.c'], not curl_dep.found(), [curl_dep]],
123     [['elements/curlsmtpsink.c'], not curl_dep.found(), [curl_dep]],
124     [['elements/dash_mpd.c'], not xml2_dep.found(), [xml2_dep]],
125     [['elements/dtls.c'], not libcrypto_dep.found(), [libcrypto_dep]],
126     [['elements/faac.c'],
127         not faac_dep.found() or not cc.has_header_symbol('faac.h', 'faacEncOpen') or not cdata.has('HAVE_UNISTD_H'),
128         [faac_dep]],
129     [['elements/faad.c'],
130         not faad_dep.found() or not have_faad_2_7 or not cdata.has('HAVE_UNISTD_H'),
131         [faad_dep]],
132     [['elements/jifmux.c'],
133         not exif_dep.found() or not cdata.has('HAVE_UNISTD_H'), [exif_dep]],
134     [['elements/jpegparse.c'], not cdata.has('HAVE_UNISTD_H')],
135     [['elements/kate.c'],
136         not kate_dep.found() or not cdata.has('HAVE_UNISTD_H'), [kate_dep]],
137     [['elements/netsim.c']],
138     [['elements/shm.c'], not shm_enabled, shm_deps],
139     [['elements/voaacenc.c'],
140         not voaac_dep.found() or not cdata.has('HAVE_UNISTD_H'), [voaac_dep]],
141     [['elements/webrtcbin.c'], not libnice_dep.found(), [gstwebrtc_dep]],
142     [['elements/x265enc.c'], not x265_dep.found(), [x265_dep]],
143     [['elements/zbar.c'], not zbar_dep.found(), [zbar_dep]],
144     [['elements/zxing.c'], not zxing_dep.found(), [zxing_dep]],
145   ]
146 endif
147
148 # linux only tests
149 if host_machine.system() == 'linux'
150   base_tests += [
151     [['elements/vapostproc.c'], not gstva_dep.found(), [gstva_dep]],
152     [['elements/vacompositor.c'], not gstva_dep.found(), [gstva_dep]],
153   ]
154 endif
155
156 test_defines = [
157   '-UG_DISABLE_ASSERT',
158   '-UG_DISABLE_CAST_CHECKS',
159   '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_STATE_IGNORE_ELEMENTS"',
160   '-DGST_TEST_FILES_PATH="' + meson.current_source_dir() + '/../files"',
161   '-DTEST_PATH="' + meson.current_build_dir() + '/media"',
162   '-DDASH_MPD_DATADIR=' + meson.current_source_dir() + '/elements/dash_mpd_data',
163   '-DGST_USE_UNSTABLE_API',
164 ]
165
166 test_deps = [gst_dep, gstapp_dep, gstbase_dep,
167              gstbasecamerabin_dep, gstphotography_dep,
168              gstpbutils_dep, gstcontroller_dep, gstaudio_dep,
169              gstvideo_dep, gstrtp_dep, gsturidownloader_dep,
170              gstcheck_dep, gio_dep, gsttag_dep]
171
172 pluginsdirs = [  ]
173
174 if gst_dep.type_name() == 'pkgconfig'
175   pbase = dependency('gstreamer-plugins-base-' + api_version)
176
177   pluginsdirs = [gst_dep.get_variable('pluginsdir'),
178                  pbase.get_variable('pluginsdir')]
179   gst_plugin_scanner_dir = gst_dep.get_variable('pluginscannerdir')
180 else
181   gst_plugin_scanner_dir = subproject('gstreamer').get_variable('gst_scanner_dir')
182 endif
183 gst_plugin_scanner_path = join_paths(gst_plugin_scanner_dir, 'gst-plugin-scanner')
184
185 extra_args = []
186 # XXX: our MinGW 32bits toolchain complians when ComPtr is in use
187 if host_system == 'windows' and cc.get_id() != 'msvc'
188   mingw_args = cc.get_supported_arguments([
189     '-Wno-redundant-decls',
190   ])
191
192   extra_args += mingw_args
193 endif
194
195 foreach t : base_tests
196   fnames = t.get(0)
197   test_name = fnames[0].split('.').get(0).underscorify()
198   skip_test = false
199   extra_deps = [ ]
200
201   if t.length() >= 3
202     extra_deps = t.get(2)
203   endif
204
205   if t.length() >= 2
206     skip_test = t.get(1)
207   endif
208
209   extra_sources = t.get(3, [ ])
210
211   if not skip_test
212     exe = executable(test_name, fnames, extra_sources,
213       include_directories : [configinc],
214       c_args : gst_plugins_bad_args + test_defines + extra_args,
215       cpp_args : gst_plugins_bad_args + test_defines + extra_args,
216       dependencies : [libm] + test_deps + extra_deps,
217     )
218
219     env = environment()
220     env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
221     env.set('CK_DEFAULT_TIMEOUT', '20')
222     env.set('GST_STATE_IGNORE_ELEMENTS', '')
223     env.set('GST_PLUGIN_PATH_1_0', [meson.global_build_root()] + pluginsdirs)
224     env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(test_name)))
225     env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer', 'gst-plugins-base',
226       'gst-plugins-good', 'gst-plugins-ugly','gst-libav', 'libnice',
227       'gst-plugins-bad@' + meson.project_build_root())
228     env.set('GST_PLUGIN_SCANNER_1_0', gst_plugin_scanner_path)
229     test(test_name, exe, env: env, timeout: 3 * 60)
230   endif
231 endforeach
232
233 # orc tests
234 orc_tests = [
235   ['orc_bayer', files('../../gst/bayer/gstbayerorc.orc')],
236   ['orc_fieldanalysis', files('../../gst/fieldanalysis/gstfieldanalysisorc.orc')],
237   ['orc_gaudieffects', files('../../gst/gaudieffects/gstgaudieffectsorc.orc')],
238   ['orc_scenechange', files('../../gst/videofilters/gstscenechangeorc.orc')],
239 ]
240
241 orc_test_dep = dependency('', required : false)
242 if have_orcc
243   # FIXME: there should really just be a separate orc-test-0.4.pc file for this
244   if orc_dep.type_name() == 'pkgconfig'
245     orc_test_dep = cc.find_library('orc-test-0.4', required : false)
246   else
247     orc_test_dep = dependency('', fallback: ['orc', 'orc_test_dep'], required: false)
248   endif
249 endif
250
251 if have_orcc and orc_test_dep.found()
252   foreach t : orc_tests
253     tname = t[0]
254     torcfile = t[1]
255     tcfilename = '@0@.c'.format(tname)
256     test_c = custom_target(tcfilename,
257       output: tcfilename,
258       input: torcfile,
259       command: [orcc, '--include', 'stdint.h', '--test', '-o', '@OUTPUT@', '@INPUT@'])
260     test_exe = executable(tname, test_c, dependencies: [orc_dep, orc_test_dep])
261     test(tname, test_exe)
262   endforeach
263 endif
264
265 if enable_gst_play_tests
266   subdir ('media')
267 endif