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