summaryrefslogtreecommitdiffstats
path: root/tests/meson.build
blob: 7bd67e8d70e7984e2f68e7674be6f6acc8505aad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
dep_pixman = dependency('pixman-1', version: '>= 0.25.2')

lib_test_runner = static_library(
	'test-runner',
	'weston-test-runner.c',
	dependencies: [
		dep_wayland_client,
		libweston_dep,
	],
	include_directories: common_inc,
	install: false,
)

dep_test_runner = declare_dependency(
	dependencies: dep_wayland_client,
	link_with: lib_test_runner
)

lib_test_client = static_library(
	'test-client',
	[
		'weston-test-client-helper.c',
		'weston-test-fixture-compositor.c',
		'../shared/os-compatibility.c',
		'../shared/xalloc.c',
		weston_test_client_protocol_h,
		weston_test_protocol_c,
		viewporter_client_protocol_h,
		viewporter_protocol_c,
		agl_shell_client_protocol_h,
		agl_shell_protocol_c,
		xdg_shell_client_protocol_h,
		xdg_shell_protocol_c,
	],
	include_directories: common_inc,
	dependencies: [
		dep_wayland_client,
		deps_libweston,
		dep_libexec_compositor,
		dep_pixman,
		dependency('cairo'),
	],
	install: false,
)
dep_test_client = declare_dependency(
	link_with: lib_test_client,
	sources: [
		viewporter_client_protocol_h,
	],
	dependencies: [
		dep_wayland_client,
		dep_test_runner,
		dep_pixman,
		dependency('libudev', version: '>= 136'),
	]
)

tests = [
]

env_modmap = ''
test_config_h = configuration_data()
test_config_h.set_quoted('WESTON_TEST_REFERENCE_PATH', meson.current_source_dir() + '/reference')
test_config_h.set_quoted('WESTON_MODULE_MAP', env_modmap)
test_config_h.set_quoted('WESTON_DATA_DIR', join_paths(meson.current_source_dir(), '..', 'data'))
message('Test suite plug-in path is ' + libweston_dep.get_pkgconfig_variable('libdir'))
test_config_h.set_quoted('TESTSUITE_PLUGIN_PATH', libweston_dep.get_pkgconfig_variable('libdir') + '/' + 'test-plugin.so')
configure_file(output: 'test-config.h', configuration: test_config_h)

foreach t : tests
	t_name = 'test-' + t.get('name')
	t_sources = t.get('sources', [t.get('name') + '-test.c'])
	t_sources += weston_test_client_protocol_h

	t_deps = [ dep_test_client, libweston_dep ]
	t_deps += t.get('dep_objs', [])

	t_exe = executable(
		t_name,
		t_sources,
		c_args: [
			'-DUNIT_TEST',
			'-DTHIS_TEST_NAME="' + t_name + '"',
		],
		build_by_default: true,
		include_directories: common_inc,
		dependencies: t_deps,
		install: false,
	)

	test(t.get('name'), t_exe, depends: t.get('test_deps', []))
endforeach