93ad5e7b11c29947c8c935b11ed209881e2f5966
[platform/upstream/gst-plugins-ugly.git] / tests / check / meson.build
1 # name, condition when to skip the test and extra dependencies
2 ugly_tests = [
3   [ 'elements/xingmux' ],
4 ]
5
6 # FIXME: unistd dependency or not tested yet on windows
7 if host_machine.system() != 'windows'
8   ugly_tests += [
9     [ 'elements/amrnbenc', not amrnb_dep.found() ],
10     [ 'elements/mpeg2dec', not mpeg2_dep.found() or not cdata.has('HAVE_UNISTD_H'), [ gstvideo_dep ] ],
11     [ 'elements/x264enc', not x264_dep.found() or not cdata.has('HAVE_UNISTD_H') ],
12     [ 'generic/states', not cdata.has('HAVE_UNISTD_H') ],
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 : false)
27   pluginsdirs = [gst_dep.get_pkgconfig_variable('pluginsdir'),
28                  pbase.get_pkgconfig_variable('pluginsdir')]
29 endif
30
31 test_deps = [gst_dep, gstbase_dep, gstcheck_dep, gstaudio_dep, gstapp_dep, gstfft_dep]
32
33 libm = cc.find_library('m', required : false)
34
35 # FIXME: valgrind_args: add suppressions $(top_srcdir)/common/gst.supp $(srcdir)/gst-plugins-ugly.supp
36
37 no_warn_args = []
38 foreach arg : [
39   '-Wno-missing-prototypes',
40   '-Wno-missing-declarations',
41   '-Wno-old-style-definition']
42   if cc.has_argument(arg)
43     no_warn_args += [arg]
44   endif
45 endforeach
46
47 foreach t : ugly_tests
48   fname = '@0@.c'.format(t.get(0))
49   test_name = t.get(0).underscorify()
50   extra_deps = [ ]
51   if t.length() == 3
52     extra_deps = t.get(2)
53     skip_test = t.get(1)
54   elif t.length() == 2
55     skip_test = t.get(1)
56   else
57     skip_test = false
58   endif
59   if not skip_test
60     exe = executable(test_name, fname,
61       include_directories : [configinc],
62       c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines + no_warn_args,
63       dependencies : [libm] + test_deps + extra_deps,
64     )
65
66     env = environment()
67     env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
68     env.set('CK_DEFAULT_TIMEOUT', '20')
69     env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer', 'gst-plugins-base',
70       'gst-plugins-good', 'gst-plugins-ugly@' + meson.build_root())
71     env.set('GST_PLUGIN_PATH_1_0', [meson.build_root()] + pluginsdirs)
72     env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), test_name))
73     env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(test_name)))
74     test(test_name, exe, env: env, timeout: 3 * 60)
75   endif
76 endforeach