4819e67cbe4210867e85b492ba9349168bf9d52c
[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     { 'name': 'agl-client-shell' },
60 ]
61
62 env_modmap = ''
63 test_config_h = configuration_data()
64 test_config_h.set_quoted('WESTON_TEST_REFERENCE_PATH', meson.current_source_dir() + '/reference')
65 test_config_h.set_quoted('WESTON_MODULE_MAP', env_modmap)
66 test_config_h.set_quoted('WESTON_DATA_DIR', join_paths(meson.current_source_dir(), '..', 'data'))
67 message('Test suite plug-in path is ' + libweston_dep.get_pkgconfig_variable('libdir'))
68 test_config_h.set_quoted('TESTSUITE_PLUGIN_PATH', libweston_dep.get_pkgconfig_variable('libdir') + '/' + 'test-plugin.so')
69 configure_file(output: 'test-config.h', configuration: test_config_h)
70
71 foreach t : tests
72         t_name = 'test-' + t.get('name')
73         t_sources = t.get('sources', [t.get('name') + '-test.c'])
74         t_sources += weston_test_client_protocol_h
75
76         t_deps = [ dep_test_client, libweston_dep ]
77         t_deps += t.get('dep_objs', [])
78
79         t_exe = executable(
80                 t_name,
81                 t_sources,
82                 c_args: [
83                         '-DUNIT_TEST',
84                         '-DTHIS_TEST_NAME="' + t_name + '"',
85                 ],
86                 build_by_default: true,
87                 include_directories: common_inc,
88                 dependencies: t_deps,
89                 install: false,
90         )
91
92         test(t.get('name'), t_exe, depends: t.get('test_deps', []))
93 endforeach