meson.build 8.11 KB
Newer Older
1 2
valgrind_dep = dependency('valgrind', required: false).partial_dependency(compile_args : true)
if valgrind_dep.found()
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
3 4 5 6 7
  cdata.set('HAVE_VALGRIND', 1)
endif

# internal helper lib for unit testing audio parsers
libparser = static_library('libparser', 'elements/parser.c',
8 9 10
  c_args : gst_plugins_good_args + ['-DGST_USE_UNSTABLE_API'],
  include_directories : [configinc],
  dependencies : [gstcheck_dep],
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
11
  install : false)
12

Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
13 14
libparser_dep = declare_dependency(link_with : libparser,
  dependencies : gstcheck_dep)
15

Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
16 17
# name, condition when to skip the test and extra dependencies
good_tests = [
18
  [ 'elements/audioamplify', false, [gstfft_dep] ],
19 20
  [ 'elements/audiochebband', false, [gstfft_dep] ],
  [ 'elements/audiocheblimit', false, [gstfft_dep] ],
21
  [ 'elements/audiodynamic', false, [gstfft_dep] ],
22 23 24
  [ 'elements/audioecho', false, [gstfft_dep] ],
  [ 'elements/audiofirfilter', false, [gstfft_dep] ],
  [ 'elements/audioiirfilter', false, [gstfft_dep] ],
25 26
  [ 'elements/audioinvert', false, [gstfft_dep] ],
  [ 'elements/audiopanorama', false, [gstfft_dep] ],
27 28
  [ 'elements/audiowsincband', false, [gstfft_dep] ],
  [ 'elements/audiowsinclimit', false, [gstfft_dep] ],
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
29 30
  [ 'elements/alphacolor' ],
  [ 'elements/alpha' ],
31 32 33
  [ 'elements/avimux', false, [gstriff_dep] ],
  [ 'elements/avisubtitle', false, [gstriff_dep] ],
  [ 'elements/capssetter' ],
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
  [ 'elements/aacparse', false, [libparser_dep] ],
  [ 'elements/ac3parse', false, [libparser_dep] ],
  [ 'elements/amrparse', false, [libparser_dep] ],
  [ 'elements/flacparse', false, [libparser_dep] ],
  [ 'elements/mpegaudioparse', false, [libparser_dep] ],
  [ 'elements/autodetect' ],
  [ 'elements/deinterlace' ],
  [ 'elements/dtmf' ],
  [ 'elements/flvdemux' ],
  [ 'elements/flvmux' ],
  [ 'elements/mulawdec' ],
  [ 'elements/mulawenc' ],
  [ 'elements/icydemux' ],
  [ 'elements/id3demux' ],
  [ 'elements/imagefreeze' ],
  [ 'elements/deinterleave' ],
  [ 'elements/interleave' ],
51
  [ 'elements/level' ],
52
  [ 'elements/matroskademux', false, [gstriff_dep] ],
53
  [ 'elements/matroskamux', false, [gstriff_dep] ],
54
  [ 'elements/matroskaparse', false, [gstriff_dep] ],
55 56 57 58
  [ 'elements/multifile' ],
  [ 'elements/splitmux', ],
  [ 'elements/qtmux', false, [gstriff_dep, zlib_dep] ],
  [ 'elements/qtdemux', false, [gstriff_dep, zlib_dep] ],
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
59 60 61 62 63
  [ 'elements/rganalysis' ],
  [ 'elements/rglimiter' ],
  [ 'elements/rgvolume' ],
  [ 'elements/rtph261' ],
  [ 'elements/rtph263' ],
64
  [ 'elements/rtph264' ],
65
  [ 'elements/rtph265' ],
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
66 67 68 69
  [ 'elements/rtpvp9' ],
  [ 'elements/rtpbin' ],
  [ 'elements/rtpbin_buffer_list' ],
  [ 'elements/rtpcollision' ],
70
  [ 'elements/rtpfunnel' ],
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
71 72 73 74
  [ 'elements/rtpjitterbuffer' ],
  [ 'elements/rtpmux' ],
  [ 'elements/rtprtx' ],
  [ 'elements/rtpsession' ],
75 76 77
  [ 'elements/rtpstorage' ],
  [ 'elements/rtpred' ],
  [ 'elements/rtpulpfec' ],
78
  [ 'elements/rtpssrcdemux' ],
79 80 81
  [ 'elements/rtp-payloading' ],
  [ 'elements/spectrum', false, [gstfft_dep] ],
  [ 'elements/shapewipe' ],
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
82
  [ 'elements/udpsink' ],
83 84 85 86 87
  [ 'elements/udpsrc' ],
  [ 'elements/videobox' ],
  [ 'elements/videocrop' ],
  [ 'elements/videofilter' ],
  [ 'elements/videomixer' ],
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
88 89
  [ 'elements/aspectratiocrop' ],
  [ 'pipelines/wavenc' ],
90
  [ 'elements/wavparse', false, [gstriff_dep] ],
91 92
  [ 'elements/wavpackparse', ],
  [ 'elements/y4menc' ],
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
93 94 95 96
  [ 'pipelines/effectv' ],
  [ 'elements/equalizer' ],
  [ 'pipelines/simple-launch-lines' ],
  [ 'pipelines/tagschecking' ],
97
  [ 'generic/states' ],
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
98 99 100 101 102
]

# FIXME: valgrind elements/rtp-payloading - needs fixing
# elements/videocrop should be disabled since it takes way too long in valgrind

103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
# FIXME: unistd dependency or not tested yet on windows
if host_machine.system() != 'windows'
  good_tests += [
    [ 'pipelines/flacdec', not flac_dep.found() ],
    [ 'elements/gdkpixbufsink', not gdkpixbuf_dep.found(), [gdkpixbuf_dep] ],
    [ 'elements/gdkpixbufoverlay', not gdkpixbuf_dep.found() ],
    [ 'elements/jpegdec', not jpeglib.found() ],
    [ 'elements/jpegenc', not jpeglib.found() ],
    [ 'elements/mpg123audiodec', not mpg123_dep.found(),  [gstfft_dep]],
    [ 'elements/souphttpsrc', not libsoup_dep.found(), [libsoup_dep] ],
    [ 'elements/id3v2mux', not taglib_dep.found() ],
    [ 'elements/apev2mux', not taglib_dep.found() ],
    [ 'elements/vp8enc', not vpx_dep.found() or not have_vp8_encoder ],
    [ 'elements/vp8dec', not vpx_dep.found() or not have_vp8_decoder ],
    [ 'elements/vp9enc', not vpx_dep.found() or not have_vp9_encoder ],
    [ 'pipelines/lame', not lame_dep.found() ],
    [ 'elements/wavpackdec', not wavpack_dep.found() ],
    [ 'elements/wavpackenc', not wavpack_dep.found() ],
    [ 'pipelines/wavpack', not wavpack_dep.found() ],
  ]
endif

Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
125 126 127 128 129 130 131 132 133 134 135 136
foo='''
if HAVE_ORC
check_orc = orc/deinterlace orc/videomixer orc/videobox
else
check_orc =
endif
'''

test_defines = [
  '-UG_DISABLE_ASSERT',
  '-UG_DISABLE_CAST_CHECKS',
  '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"',
137
  '-DGST_TEST_FILES_PATH="' + meson.current_source_dir() + '/../files"',
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
138 139 140
  '-DGST_USE_UNSTABLE_API',
]

141 142 143 144 145
pluginsdirs = []
if gst_dep.type_name() == 'pkgconfig'
  pbase = dependency('gstreamer-plugins-base-' + api_version, required : false)
  pluginsdirs = [gst_dep.get_pkgconfig_variable('pluginsdir'),
                 pbase.get_pkgconfig_variable('pluginsdir')]
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
endif

# fake device drivers: we could run hardware element tests against dummy drivers
# v4l2: vivo (part of normal kernel)
#   modprobe vivo;
#   gst-launch v4l2src device="/dev/video1" ! xvimagesink;
#   rmmod vivo
#
# alsa: snd-dummy (part of normal alsa, not removable)
#   modprobe snd-dummy;
#   gst-launch alsasrc device="hw:2" ! fakesink
#   gst-launch fakesrc ! alsasink device="hw:2"
#
# need a way to figure out value for the device property
state_ignore_elements = '''aasink autoaudiosrc autoaudiosink autovideosrc
 autovideosink cacasink cairotextoverlay jackaudiosrc jackaudiosink
 osssrc osssink osxaudiosink osxaudiosrc osxvideosrc osxvideosink
 pulsesink pulsesrc pulsemixer v4l2src'''

# FIXME: check, also + PTHREAD_CFLAGS
test_deps = [gst_dep, gstbase_dep, gstnet_dep, gstcheck_dep, gstaudio_dep,
  gstvideo_dep, gstpbutils_dep, gstrtp_dep, gstrtsp_dep, gsttag_dep,
168
  gstapp_dep, gio_dep, valgrind_dep] + glib_deps
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
169 170 171

# FIXME: add valgrind suppression common/gst.supp gst-plugins-good.supp
foreach t : good_tests
172 173
  fname = '@0@.c'.format(t.get(0))
  test_name = t.get(0).underscorify()
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
174 175 176 177 178 179 180 181 182 183
  extra_deps = [ ]
  if t.length() == 3
    extra_deps = t.get(2)
    skip_test = t.get(1)
  elif t.length() == 2
    skip_test = t.get(1)
  else
    skip_test = false
  endif
  if not skip_test
184 185 186 187 188
    env = environment()
    env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
    env.set('GST_STATE_IGNORE_ELEMENTS', state_ignore_elements)
    env.set('CK_DEFAULT_TIMEOUT', '20')
    env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer', 'gst-plugins-base',
189
      'gst-plugins-good@' + meson.build_root())
190
    env.set('GST_PLUGIN_PATH_1_0', [meson.build_root()] + pluginsdirs)
191 192
    env.set('GSETTINGS_BACKEND', 'memory')

193
    env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(test_name)))
194
    exe = executable(test_name, fname,
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
195 196 197 198
      include_directories : [configinc],
      c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines,
      dependencies : [libm] + test_deps + extra_deps,
    )
199
    test(test_name, exe, env: env, timeout: 3 * 60)
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
200 201 202
  endif
endforeach

203 204 205 206 207 208
# orc tests
orc_tests = [
  ['orc_deinterlace', files('../../gst/deinterlace/tvtime.orc')],
  ['orc_videomixer', files('../../gst/videomixer/videomixerorc.orc')],
  ['orc_videobox', files('../../gst/videobox/gstvideoboxorc.orc')],
]
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
209

210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
if have_orcc
  # FIXME: there should really just be a separate orc-test-0.4.pc file for this
  if orc_dep.type_name() == 'pkgconfig'
    orc_test_dep = cc.find_library('orc-test-0.4', dependencies: orc_dep)
  else
    orc_test_dep = dependency('', fallback: ['orc', 'orc_test_dep'])
  endif
  foreach t : orc_tests
    tname = t[0]
    torcfile = t[1]
    tcfilename = '@0@.c'.format(tname)
    test_c = custom_target(tcfilename,
      output: tcfilename,
      input: torcfile,
      command: [orcc, '--include', 'stdint.h', '--test', '-o', '@OUTPUT@', '@INPUT@'])
    test_exe = executable(tname, test_c, dependencies: [orc_dep, orc_test_dep])
    test(tname, test_exe)
  endforeach
endif