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