summaryrefslogtreecommitdiff
path: root/tests/check/meson.build
blob: 113c4f6150d4219ca91301dfc4f7126ceebbdd0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
have_registry = true # FIXME not get_option('disable_registry')

# name, condition when to skip the test and extra dependencies
base_tests = [
  [ 'gst/typefindfunctions.c', not have_registry ],
  [ 'libs/allocators.c', host_machine.system() != 'linux' ],
  [ 'libs/audio.c' ],
  [ 'libs/audiocdsrc.c' ],
  [ 'libs/audiodecoder.c' ],
  [ 'libs/audioencoder.c' ],
  [ 'libs/baseaudiovisualizer.c' ],
  [ 'libs/discoverer.c' ],
  [ 'libs/fft.c' ],
  [ 'libs/libsabi.c' ],
  [ 'libs/mikey.c' ],
  [ 'libs/navigation.c' ],
  [ 'libs/pbutils.c' ],
  [ 'libs/profile.c' ],
  [ 'libs/rtpbasedepayload.c' ],
  [ 'libs/rtpbasepayload.c' ],
  [ 'libs/rtp.c' ],
  [ 'libs/rtsp.c' ],
  [ 'libs/rtspconnection.c' ],
  [ 'libs/sdp.c' ],
  [ 'libs/tag.c' ],
  [ 'libs/video.c' ],
  [ 'libs/videoencoder.c' ],
  [ 'libs/videotimecode.c' ],
  [ 'libs/xmpwriter.c' ],
  [ 'elements/adder.c' ],
  [ 'elements/appsink.c' ],
  [ 'elements/appsrc.c' ],
  [ 'elements/audioconvert.c' ],
  [ 'elements/audiorate.c' ],
  [ 'elements/audiotestsrc.c' ],
  [ 'elements/audioresample.c' ],
  [ 'elements/libvisual.c', not is_variable('libvisual_dep') or not libvisual_dep.found() ],
  [ 'elements/decodebin.c' ],
  [ 'elements/encodebin.c', not theoraenc_dep.found() or not vorbisenc_dep.found() ],
  [ 'elements/multifdsink.c', not core_conf.has('HAVE_SYS_SOCKET_H') or not core_conf.has('HAVE_UNISTD_H') ],
  # FIXME: multisocketsink test on windows/msvc
  [ 'elements/multisocketsink.c', not core_conf.has('HAVE_SYS_SOCKET_H') or not core_conf.has('HAVE_UNISTD_H') ],
  [ 'elements/playbin.c' ],
  [ 'elements/playbin-complex.c', not ogg_dep.found() ],
  [ 'elements/playsink.c' ],
  [ 'elements/streamsynchronizer.c' ],
  [ 'elements/subparse.c' ],
  [ 'elements/textoverlay.c', not pango_dep.found() ],
  [ 'elements/videoconvert.c' ],
  [ 'elements/videorate.c' ],
  [ 'elements/videoscale.c' ],
  [ 'elements/videotestsrc.c' ],
  [ 'elements/volume.c', false, [ gst_controller_dep ] ],
  [ 'elements/vorbisdec.c', not vorbis_dep.found(), [ vorbis_dep, vorbisenc_dep ] ],
  [ 'elements/vorbistag.c', not vorbisenc_dep.found(), [ vorbis_dep, vorbisenc_dep ] ],
  [ 'generic/clock-selection.c' ],
  [ 'generic/states.c', false, [ gmodule_dep ] ],
  [ 'pipelines/simple-launch-lines.c' ],
  [ 'pipelines/basetime.c' ],
  [ 'pipelines/capsfilter-renegotiation.c' ],
  [ 'pipelines/gio.c' ],
  [ 'pipelines/oggmux.c', not ogg_dep.found(), [ ogg_dep, ] ],
  [ 'pipelines/streamsynchronizer.c' ],
  # FIXME: tcp test on windows/msvc
  [ 'pipelines/tcp.c', not core_conf.has('HAVE_SYS_SOCKET_H') or not core_conf.has('HAVE_UNISTD_H'), [giounix_dep] ],
  [ 'pipelines/theoraenc.c', not theoraenc_dep.found(), [ theoraenc_dep ] ],
  [ 'pipelines/vorbisenc.c', not vorbisenc_dep.found() ],
  [ 'pipelines/vorbisdec.c', not vorbisenc_dep.found(),],
]

if build_gstgl
  base_tests += [
    [ 'libs/gstglcolorconvert.c', not build_gstgl, [gstgl_dep]],
    [ 'libs/gstglcontext.c', not build_gstgl, [gstgl_dep]],
    [ 'libs/gstglheaders.c', not build_gstgl, [gstgl_dep]],
    [ 'libs/gstglmatrix.c', not build_gstgl, [gstgl_dep]],
    [ 'libs/gstglmemory.c', not build_gstgl, [gstgl_dep]],
    [ 'libs/gstglquery.c', not build_gstgl, [gstgl_dep]],
    [ 'libs/gstglshader.c', not build_gstgl, [gstgl_dep]],
    [ 'libs/gstglsl.c', not build_gstgl, [gstgl_dep]],
    [ 'libs/gstglslstage.c', not build_gstgl, [gstgl_dep]],
    [ 'libs/gstglupload.c', not build_gstgl, [gstgl_dep]],
    [ 'elements/glimagesink.c', not build_gstgl, [gstgl_dep]],
    [ 'elements/glbin.c', not build_gstgl ],
    [ 'pipelines/gl-launch-lines.c', not build_gstgl ],
  ]
endif

# Make sure our headers are C++ clean
if have_cxx
  base_tests += [
    [ 'libs/gstlibscpp.cc', false, [  ] ],
  ]
endif

# FIXME: enable orc testing
#orc_tests = [
#  'orc/video',
#  'orc/audio',
#  'orc/adder',
#  'orc/volume',
#  'orc/videotestsrc'
#]

test_defines = [
  '-UG_DISABLE_ASSERT',
  '-UG_DISABLE_CAST_CHECKS',
  '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"',
  '-DGST_TEST_FILES_PATH="' + meson.current_source_dir() + '/../files"',
  '-DGST_TEST_FILE="' + meson.current_source_dir() + '/../files/partialframe.mjpeg"', # for libs/discoverer
  '-DGST_USE_UNSTABLE_API',
]

test_deps = [gst_dep, gst_base_dep, gst_net_dep, gst_check_dep, audio_dep,
  video_dep, pbutils_dep, rtp_dep, rtsp_dep, tag_dep, allocators_dep, app_dep,
  fft_dep, riff_dep, sdp_dep, gio_dep] + glib_deps

pluginsdirs = [  ]
if gst_dep.type_name() == 'pkgconfig'
  pluginsdirs = [gst_dep.get_pkgconfig_variable('pluginsdir')]
endif

foreach t : base_tests
  fname = t.get(0)
  test_name = fname.split('.').get(0).underscorify()
  skip_test = false
  extra_deps = [ ]

  if t.length() >= 3
    extra_deps = t.get(2)
  endif

  if t.length() >= 2
    skip_test = t.get(1)
  endif

  if not skip_test
    exe = executable(test_name, fname,
      include_directories : [configinc],
      c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines,
      cpp_args : gst_plugins_base_args,
      dependencies : [libm] + test_deps + extra_deps,
    )

    env = environment()
    env.set('GST_PLUGIN_PATH_1_0',
        meson.build_root(), '@0@/@1@'.format(get_option('prefix'), plugins_install_dir),
        pluginsdirs)
    env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
    env.set('GST_STATE_IGNORE_ELEMENTS', 'cdio cdparanoiasrc libvisual_ alsasrc alsasink')
    env.set('CK_DEFAULT_TIMEOUT', '20')
    env.set('GST_TAG_LICENSE_TRANSLATIONS_DICT', gst_tag_dir + '/license-translations.dict')
    env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer',
        'gst-plugins-base@' + meson.build_root(), separator: ':')
    env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), test_name))
    test(test_name, exe, env: env, timeout: 3 * 60)
  endif
endforeach

# videoscale tests (split in groups)
foreach group : [1, 2, 3, 4, 5, 6]
  vscale_test_name = 'elements-videoscale-@0@'.format(group)
  exe = executable(vscale_test_name, 'elements/videoscale.c',
      include_directories : [configinc],
      c_args : ['-DHAVE_CONFIG_H=1', '-DVSCALE_TEST_GROUP=@0@'.format(group) ] + test_defines,
      dependencies : [libm] + test_deps + extra_deps)

  # TODO Use env.copy when it is in meson
  env = environment()
  env.set('GST_PLUGIN_PATH_1_0',
      meson.build_root(), '@0@/@1@'.format(get_option('prefix'), plugins_install_dir),
      pluginsdirs)
  env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
  env.set('GST_STATE_IGNORE_ELEMENTS', 'cdio cdparanoiasrc libvisual_ alsasrc alsasink')
  env.set('CK_DEFAULT_TIMEOUT', '20')
  env.set('GST_TAG_LICENSE_TRANSLATIONS_DICT', gst_tag_dir + '/license-translations.dict')
  env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer',
      'gst-plugins-base@' + meson.build_root(), separator: ':')
  env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), test_name))

  test(vscale_test_name, exe, env: env, timeout: 3 * 60)
endforeach