7bd67e8d70e7984e2f68e7674be6f6acc8505aad
[src/agl-compositor.git] / tests / meson.build
1 dep_pixman = dependency('pixman-1', version: '>= 0.25.2')
2
3 lib_test_runner = static_library(
4         'test-runner',
5         'weston-test-runner.c',
6         dependencies: [
7                 dep_wayland_client,
8                 libweston_dep,
9         ],
10         include_directories: common_inc,
11         install: false,
12 )
13
14 dep_test_runner = declare_dependency(
15         dependencies: dep_wayland_client,
16         link_with: lib_test_runner
17 )
18
19 lib_test_client = static_library(
20         'test-client',
21         [
22                 'weston-test-client-helper.c',
23                 'weston-test-fixture-compositor.c',
24                 '../shared/os-compatibility.c',
25                 '../shared/xalloc.c',
26                 weston_test_client_protocol_h,
27                 weston_test_protocol_c,
28                 viewporter_client_protocol_h,
29                 viewporter_protocol_c,
30                 agl_shell_client_protocol_h,
31                 agl_shell_protocol_c,
32                 xdg_shell_client_protocol_h,
33                 xdg_shell_protocol_c,
34         ],
35         include_directories: common_inc,
36         dependencies: [
37                 dep_wayland_client,
38                 deps_libweston,
39                 dep_libexec_compositor,
40                 dep_pixman,
41                 dependency('cairo'),
42         ],
43         install: false,
44 )
45 dep_test_client = declare_dependency(
46         link_with: lib_test_client,
47         sources: [
48                 viewporter_client_protocol_h,
49         ],
50         dependencies: [
51                 dep_wayland_client,
52                 dep_test_runner,
53                 dep_pixman,
54                 dependency('libudev', version: '>= 136'),
55         ]
56 )
57
58 tests = [
59 ]
60
61 env_modmap = ''
62 test_config_h = configuration_data()
63 test_config_h.set_quoted('WESTON_TEST_REFERENCE_PATH', meson.current_source_dir() + '/reference')
64 test_config_h.set_quoted('WESTON_MODULE_MAP', env_modmap)
65 test_config_h.set_quoted('WESTON_DATA_DIR', join_paths(meson.current_source_dir(), '..', 'data'))
66 message('Test suite plug-in path is ' + libweston_dep.get_pkgconfig_variable('libdir'))
67 test_config_h.set_quoted('TESTSUITE_PLUGIN_PATH', libweston_dep.get_pkgconfig_variable('libdir') + '/' + 'test-plugin.so')
68 configure_file(output: 'test-config.h', configuration: test_config_h)
69
70 foreach t : tests
71         t_name = 'test-' + t.get('name')
72         t_sources = t.get('sources', [t.get('name') + '-test.c'])
73         t_sources += weston_test_client_protocol_h
74
75         t_deps = [ dep_test_client, libweston_dep ]
76         t_deps += t.get('dep_objs', [])
77
78         t_exe = executable(
79                 t_name,
80                 t_sources,
81                 c_args: [
82                         '-DUNIT_TEST',
83                         '-DTHIS_TEST_NAME="' + t_name + '"',
84                 ],
85                 build_by_default: true,
86                 include_directories: common_inc,
87                 dependencies: t_deps,
88                 install: false,
89         )
90
91         test(t.get('name'), t_exe, depends: t.get('test_deps', []))
92 endforeach