24c0b58eada289bc394bf337c6f5913a470a27cb
[platform/upstream/gstreamer.git] / testsuite / meson.build
1 runtests = find_program('runtests.py')
2
3 tests = [
4     ['Test gst', 'test_gst.py'],
5     ['Test fundamentals', 'test_types.py'],
6 ]
7
8 pluginsdirs = []
9 if not meson.is_subproject()
10   pkgconfig = find_program('pkg-config')
11   runcmd = run_command(pkgconfig, '--variable=pluginsdir',
12       'gstreamer-' + api_version)
13   if runcmd.returncode() == 0
14       pluginsdirs = runcmd.stdout().split()
15   else
16     error('Could not determine GStreamer core plugins directory for unit tests.')
17   endif
18 endif
19
20 runcmd = run_command(python3, '-c', '''with open("@0@/mesonconfig.py", "w") as f:
21     f.write("path='@1@'")'''.format(
22   meson.current_source_dir(), join_paths(meson.current_build_dir(), '../')))
23
24 if runcmd.returncode() != 0
25     error('Could not configure testsuite config file.' + runcmd.stderr())
26 endif
27
28 foreach i: tests
29     test_name = i.get(0)
30     env = environment()
31     env.set('GST_PLUGIN_PATH_1_0', meson.build_root())
32     env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
33     foreach plugindir: pluginsdirs
34       env.append('GST_PLUGIN_PATH_1_0', plugindir)
35     endforeach
36     env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), i.get(1)))
37     test(test_name, runtests, args: [i.get(1)], env: env)
38 endforeach