0d592585822f6b21ba43f62272a4f5c86773bd76
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-ugly / tests / check / meson.build
1 # name, condition when to skip the test and extra dependencies
2 ugly_tests = [
3   [ 'elements/x264enc', not x264_dep.found(), [ x264_dep, gmodule_dep ] ],
4   [ 'elements/xingmux' ],
5   [ 'generic/states' ],
6 ]
7
8 # FIXME: unistd dependency or not tested yet on windows
9 if host_machine.system() != 'windows'
10   ugly_tests += [
11     [ 'elements/amrnbenc', not amrnb_dep.found() ],
12     [ 'elements/mpeg2dec', not mpeg2_dep.found() or not cdata.has('HAVE_UNISTD_H'), [ gstvideo_dep ] ],
13   ]
14 endif
15
16 test_defines = [
17   '-UG_DISABLE_ASSERT',
18   '-UG_DISABLE_CAST_CHECKS',
19   '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"',
20   '-DGST_TEST_FILES_PATH="' + meson.current_source_dir() + '/../files"',
21   '-DGST_USE_UNSTABLE_API',
22 ]
23
24 pluginsdirs = []
25 if gst_dep.type_name() == 'pkgconfig'
26   pbase = dependency('gstreamer-plugins-base-' + api_version, required: true)
27   pluginsdirs = [gst_dep.get_variable('pluginsdir'),
28                  pbase.get_variable('pluginsdir')]
29   gst_plugin_scanner_dir = gst_dep.get_variable('pluginscannerdir')
30 else
31   gst_plugin_scanner_dir = subproject('gstreamer').get_variable('gst_scanner_dir')
32 endif
33 gst_plugin_scanner_path = join_paths(gst_plugin_scanner_dir, 'gst-plugin-scanner')
34
35 test_deps = [gst_dep, gstbase_dep, gstcheck_dep, gstaudio_dep, gstapp_dep,
36              gstfft_dep, gstvideo_dep, gstpbutils_dep]
37
38 libm = cc.find_library('m', required : false)
39
40 # FIXME: valgrind_args: add suppressions $(top_srcdir)/common/gst.supp $(srcdir)/gst-plugins-ugly.supp
41
42 no_warn_args = []
43 foreach arg : [
44   '-Wno-missing-prototypes',
45   '-Wno-missing-declarations',
46   '-Wno-old-style-definition']
47   if cc.has_argument(arg)
48     no_warn_args += [arg]
49   endif
50 endforeach
51
52 foreach t : ugly_tests
53   fname = '@0@.c'.format(t.get(0))
54   test_name = t.get(0).underscorify()
55   extra_deps = [ ]
56   if t.length() == 3
57     extra_deps = t.get(2)
58     skip_test = t.get(1)
59   elif t.length() == 2
60     skip_test = t.get(1)
61   else
62     skip_test = false
63   endif
64   if not skip_test
65     exe = executable(test_name, fname,
66       include_directories : [configinc],
67       c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines + no_warn_args,
68       dependencies : [libm] + test_deps + extra_deps,
69     )
70
71     env = environment()
72     env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
73     env.set('CK_DEFAULT_TIMEOUT', '20')
74     env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer', 'gst-plugins-base',
75       'gst-plugins-good', 'gst-plugins-ugly@' + meson.project_build_root())
76     env.set('GST_PLUGIN_PATH_1_0', [meson.global_build_root()] + pluginsdirs)
77     env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(test_name)))
78     env.set('GST_PLUGIN_SCANNER_1_0', gst_plugin_scanner_path)
79     test(test_name, exe, env: env, timeout: 3 * 60)
80   endif
81 endforeach