d89c6f69161dc9a6b19c2014dc1ec3afbe54f3a5
[platform/upstream/gstreamer.git] / tests / check / meson.build
1 have_registry = true # FIXME not get_option('disable_registry')
2
3 # name, condition when to skip the test and extra dependencies
4 base_tests = [
5   [ 'gst/typefindfunctions.c', not have_registry ],
6   [ 'libs/allocators.c', host_machine.system() != 'linux' ],
7   [ 'libs/audio.c' ],
8   [ 'libs/audiocdsrc.c' ],
9   [ 'libs/audiodecoder.c' ],
10   [ 'libs/audioencoder.c' ],
11   [ 'libs/baseaudiovisualizer.c' ],
12   [ 'libs/discoverer.c' ],
13   [ 'libs/fft.c' ],
14   [ 'libs/libsabi.c' ],
15   [ 'libs/mikey.c' ],
16   [ 'libs/navigation.c' ],
17   [ 'libs/pbutils.c' ],
18   [ 'libs/profile.c' ],
19   [ 'libs/rtpbasedepayload.c' ],
20   [ 'libs/rtpbasepayload.c' ],
21   [ 'libs/rtp.c' ],
22   [ 'libs/rtsp.c' ],
23   [ 'libs/rtspconnection.c' ],
24   [ 'libs/sdp.c' ],
25   [ 'libs/tag.c' ],
26   [ 'libs/video.c' ],
27   [ 'libs/videoencoder.c' ],
28   [ 'libs/videodecoder.c' ],
29   [ 'libs/videotimecode.c' ],
30   [ 'libs/xmpwriter.c' ],
31   [ 'elements/adder.c' ],
32   [ 'elements/appsink.c' ],
33   [ 'elements/appsrc.c' ],
34   [ 'elements/audioconvert.c' ],
35   [ 'elements/audiointerleave.c' ],
36   [ 'elements/audiomixer.c', false, [ gst_controller_dep ] ],
37   [ 'elements/audiorate.c' ],
38   [ 'elements/audiotestsrc.c' ],
39   [ 'elements/audioresample.c' ],
40   [ 'elements/libvisual.c', not is_variable('libvisual_dep') or not libvisual_dep.found() ],
41   [ 'elements/decodebin.c' ],
42   [ 'elements/encodebin.c', not theoraenc_dep.found() or not vorbisenc_dep.found() ],
43   [ 'elements/multifdsink.c', not core_conf.has('HAVE_SYS_SOCKET_H') or not core_conf.has('HAVE_UNISTD_H') ],
44   # FIXME: multisocketsink test on windows/msvc
45   [ 'elements/multisocketsink.c', not core_conf.has('HAVE_SYS_SOCKET_H') or not core_conf.has('HAVE_UNISTD_H') ],
46   [ 'elements/playbin.c' ],
47   [ 'elements/playbin-complex.c', not ogg_dep.found() ],
48   [ 'elements/playsink.c' ],
49   [ 'elements/streamsynchronizer.c' ],
50   [ 'elements/subparse.c' ],
51   [ 'elements/textoverlay.c', not pango_dep.found() ],
52   [ 'elements/videoconvert.c' ],
53   [ 'elements/videorate.c' ],
54   [ 'elements/videoscale.c' ],
55   [ 'elements/videotestsrc.c' ],
56   [ 'elements/volume.c', false, [ gst_controller_dep ] ],
57   [ 'elements/vorbisdec.c', not vorbis_dep.found(), [ vorbis_dep, vorbisenc_dep ] ],
58   [ 'elements/vorbistag.c', not vorbisenc_dep.found(), [ vorbis_dep, vorbisenc_dep ] ],
59   [ 'generic/clock-selection.c' ],
60   [ 'generic/states.c', false, [ gmodule_dep ] ],
61   [ 'pipelines/simple-launch-lines.c' ],
62   [ 'pipelines/basetime.c' ],
63   [ 'pipelines/capsfilter-renegotiation.c' ],
64   [ 'pipelines/gio.c' ],
65   [ 'pipelines/oggmux.c', not ogg_dep.found(), [ ogg_dep, ] ],
66   [ 'pipelines/streamsynchronizer.c' ],
67   # FIXME: tcp test on windows/msvc
68   [ 'pipelines/tcp.c', not core_conf.has('HAVE_SYS_SOCKET_H') or not core_conf.has('HAVE_UNISTD_H'), [giounix_dep] ],
69   [ 'pipelines/theoraenc.c', not theoraenc_dep.found(), [ theoraenc_dep ] ],
70   [ 'pipelines/vorbisenc.c', not vorbisenc_dep.found() ],
71   [ 'pipelines/vorbisdec.c', not vorbisenc_dep.found(),],
72 ]
73
74 if build_gstgl
75   base_tests += [
76     [ 'libs/gstglcolorconvert.c', not build_gstgl, [gstgl_dep]],
77     [ 'libs/gstglcontext.c', not build_gstgl, [gstgl_dep]],
78     [ 'libs/gstglformat.c', not build_gstgl, [gstgl_dep]],
79     [ 'libs/gstglheaders.c', not build_gstgl, [gstgl_dep]],
80     [ 'libs/gstglmatrix.c', not build_gstgl, [gstgl_dep]],
81     [ 'libs/gstglmemory.c', not build_gstgl, [gstgl_dep]],
82     [ 'libs/gstglquery.c', not build_gstgl, [gstgl_dep]],
83     [ 'libs/gstglshader.c', not build_gstgl, [gstgl_dep]],
84     [ 'libs/gstglsl.c', not build_gstgl, [gstgl_dep]],
85     [ 'libs/gstglslstage.c', not build_gstgl, [gstgl_dep]],
86     [ 'libs/gstglupload.c', not build_gstgl, [gstgl_dep]],
87     [ 'elements/glimagesink.c', not build_gstgl, [gstgl_dep]],
88     [ 'elements/glbin.c', not build_gstgl ],
89     [ 'pipelines/gl-launch-lines.c', not build_gstgl ],
90   ]
91 endif
92
93 # Make sure our headers are C++ clean
94 if have_cxx
95   base_tests += [
96     [ 'libs/gstlibscpp.cc', false, [  ] ],
97   ]
98 endif
99
100 # FIXME: enable orc testing
101 #orc_tests = [
102 #  'orc/video',
103 #  'orc/audio',
104 #  'orc/adder',
105 #  'orc/volume',
106 #  'orc/videotestsrc'
107 #]
108
109 test_defines = [
110   '-UG_DISABLE_ASSERT',
111   '-UG_DISABLE_CAST_CHECKS',
112   '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"',
113   '-DGST_TEST_FILES_PATH="' + meson.current_source_dir() + '/../files"',
114   '-DGST_TEST_FILE="' + meson.current_source_dir() + '/../files/partialframe.mjpeg"', # for libs/discoverer
115   '-DGST_USE_UNSTABLE_API',
116 ]
117
118 test_deps = [gst_dep, gst_base_dep, gst_net_dep, gst_check_dep, audio_dep,
119   video_dep, pbutils_dep, rtp_dep, rtsp_dep, tag_dep, allocators_dep, app_dep,
120   fft_dep, riff_dep, sdp_dep, gio_dep] + glib_deps
121
122 pluginsdirs = [  ]
123 if gst_dep.type_name() == 'pkgconfig'
124   pluginsdirs = [gst_dep.get_pkgconfig_variable('pluginsdir')]
125 endif
126
127 foreach t : base_tests
128   fname = t.get(0)
129   test_name = fname.split('.').get(0).underscorify()
130   skip_test = false
131   extra_deps = [ ]
132
133   if t.length() >= 3
134     extra_deps = t.get(2)
135   endif
136
137   if t.length() >= 2
138     skip_test = t.get(1)
139   endif
140
141   if not skip_test
142     exe = executable(test_name, fname,
143       include_directories : [configinc],
144       c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines,
145       cpp_args : gst_plugins_base_args,
146       dependencies : [libm] + test_deps + extra_deps,
147     )
148
149     env = environment()
150     env.set('GST_PLUGIN_PATH_1_0',
151         meson.build_root(), '@0@/@1@'.format(get_option('prefix'), plugins_install_dir),
152         pluginsdirs)
153     env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
154     env.set('GST_STATE_IGNORE_ELEMENTS', 'cdio cdparanoiasrc libvisual_ alsasrc alsasink')
155     env.set('CK_DEFAULT_TIMEOUT', '20')
156     env.set('GST_TAG_LICENSE_TRANSLATIONS_DICT', gst_tag_dir + '/license-translations.dict')
157     env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer',
158         'gst-plugins-base@' + meson.build_root(), separator: ':')
159     env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), test_name))
160     test(test_name, exe, env: env, timeout: 3 * 60)
161   endif
162 endforeach
163
164 # videoscale tests (split in groups)
165 foreach group : [1, 2, 3, 4, 5, 6]
166   vscale_test_name = 'elements-videoscale-@0@'.format(group)
167   exe = executable(vscale_test_name, 'elements/videoscale.c',
168       include_directories : [configinc],
169       c_args : ['-DHAVE_CONFIG_H=1', '-DVSCALE_TEST_GROUP=@0@'.format(group) ] + test_defines,
170       dependencies : [libm] + test_deps + extra_deps)
171
172   # TODO Use env.copy when it is in meson
173   env = environment()
174   env.set('GST_PLUGIN_PATH_1_0',
175       meson.build_root(), '@0@/@1@'.format(get_option('prefix'), plugins_install_dir),
176       pluginsdirs)
177   env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
178   env.set('GST_STATE_IGNORE_ELEMENTS', 'cdio cdparanoiasrc libvisual_ alsasrc alsasink')
179   env.set('CK_DEFAULT_TIMEOUT', '20')
180   env.set('GST_TAG_LICENSE_TRANSLATIONS_DICT', gst_tag_dir + '/license-translations.dict')
181   env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer',
182       'gst-plugins-base@' + meson.build_root(), separator: ':')
183   env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), test_name))
184
185   test(vscale_test_name, exe, env: env, timeout: 3 * 60)
186 endforeach