• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1plugin_test_shell_desktop = shared_library(
2	'weston-test-desktop-shell',
3	'weston-test-desktop-shell.c',
4	include_directories: common_inc,
5	dependencies: [ dep_lib_desktop, dep_libweston_public ],
6	name_prefix: '',
7	install: false
8)
9env_modmap += 'weston-test-desktop-shell.so=@0@;'.format(plugin_test_shell_desktop.full_path())
10
11lib_test_runner = static_library(
12	'test-runner',
13	'weston-test-runner.c',
14	dependencies: [
15		dep_libweston_private_h_deps,
16		dep_wayland_client,
17	],
18	include_directories: common_inc,
19	install: false,
20)
21dep_test_runner = declare_dependency(
22	dependencies: dep_wayland_client,
23	link_with: lib_test_runner
24)
25
26lib_test_client = static_library(
27	'test-client',
28	[
29		'weston-test-client-helper.c',
30		'weston-test-fixture-compositor.c',
31		weston_test_client_protocol_h,
32		weston_test_protocol_c,
33		viewporter_client_protocol_h,
34		viewporter_protocol_c,
35	],
36	include_directories: common_inc,
37	dependencies: [
38		dep_libshared,
39		dep_wayland_client,
40		dep_libexec_weston,
41		dep_pixman,
42		dependency('cairo'),
43	],
44	install: false,
45)
46dep_test_client = declare_dependency(
47	link_with: lib_test_client,
48	sources: [
49		viewporter_client_protocol_h,
50	],
51	dependencies: [
52		dep_wayland_client,
53		dep_test_runner,
54		dep_pixman,
55		dependency('libudev', version: '>= 136'),
56	]
57)
58
59exe_plugin_test = shared_library(
60	'test-plugin',
61	'weston-test.c',
62	weston_test_server_protocol_h,
63	weston_test_protocol_c,
64	include_directories: common_inc,
65	dependencies: [
66		dep_libexec_weston,
67		dep_libweston_private,
68		dep_threads
69	],
70	name_prefix: '',
71	install: false,
72)
73
74deps_zuc = [ dep_libshared ]
75if get_option('test-junit-xml')
76	d = dependency('libxml-2.0', version: '>= 2.6', required: false)
77	if not d.found()
78		error('JUnit XML support requires libxml-2.0 >= 2.6 which was not found. Or, you can use \'-Dtest-junit-xml=false\'.')
79	endif
80	deps_zuc += d
81	config_h.set('ENABLE_JUNIT_XML', '1')
82endif
83
84lib_zuc = static_library(
85	'zunitc',
86	'../tools/zunitc/inc/zunitc/zunitc.h',
87	'../tools/zunitc/inc/zunitc/zunitc_impl.h',
88	'../tools/zunitc/src/zuc_base_logger.c',
89	'../tools/zunitc/src/zuc_base_logger.h',
90	'../tools/zunitc/src/zuc_collector.c',
91	'../tools/zunitc/src/zuc_collector.h',
92	'../tools/zunitc/src/zuc_context.h',
93	'../tools/zunitc/src/zuc_event.h',
94	'../tools/zunitc/src/zuc_event_listener.h',
95	'../tools/zunitc/src/zuc_junit_reporter.c',
96	'../tools/zunitc/src/zuc_junit_reporter.h',
97	'../tools/zunitc/src/zuc_types.h',
98	'../tools/zunitc/src/zunitc_impl.c',
99	include_directories: [ common_inc, include_directories('../tools/zunitc/inc') ],
100	dependencies: deps_zuc,
101)
102dep_zuc = declare_dependency(
103	link_with: lib_zuc,
104	dependencies: dep_libshared,
105	include_directories: include_directories('../tools/zunitc/inc')
106)
107
108lib_zucmain = static_library(
109	'zunitcmain',
110	'../tools/zunitc/src/main.c',
111	include_directories: [ common_inc, include_directories('../tools/zunitc/inc') ],
112	dependencies: [ dep_libshared, dep_zuc ],
113)
114dep_zucmain = declare_dependency(
115	link_with: lib_zucmain,
116	dependencies: dep_zuc
117)
118
119tests = [
120	{	'name': 'bad-buffer', },
121	{	'name': 'drm-smoke', },
122	{	'name': 'buffer-transforms', },
123	{	'name': 'devices', },
124	{	'name': 'event', },
125	{	'name': 'internal-screenshot', },
126	{
127		'name': 'keyboard',
128		'sources': [
129			'keyboard-test.c',
130			'input-timestamps-helper.c',
131			input_timestamps_unstable_v1_client_protocol_h,
132			input_timestamps_unstable_v1_protocol_c,
133		],
134	},
135	{
136		'name': 'linux-explicit-synchronization',
137		'sources': [
138			'linux-explicit-synchronization-test.c',
139			linux_explicit_synchronization_unstable_v1_client_protocol_h,
140			linux_explicit_synchronization_unstable_v1_protocol_c,
141		],
142	},
143	{	'name': 'output-transforms', },
144	{	'name': 'plugin-registry', },
145	{
146		'name': 'pointer',
147		'sources': [
148			'pointer-test.c',
149			'input-timestamps-helper.c',
150			input_timestamps_unstable_v1_client_protocol_h,
151			input_timestamps_unstable_v1_protocol_c,
152		],
153	},
154	{
155		'name': 'presentation',
156		'sources': [
157			'presentation-test.c',
158			presentation_time_client_protocol_h,
159			presentation_time_protocol_c,
160		],
161	},
162	{	'name': 'roles', },
163	{	'name': 'string', },
164	{	'name': 'subsurface', },
165	{	'name': 'subsurface-shot', },
166	{	'name': 'surface', },
167	{	'name': 'surface-global', },
168	{
169		'name': 'text',
170		'sources': [
171			'text-test.c',
172			text_input_unstable_v1_client_protocol_h,
173			text_input_unstable_v1_protocol_c,
174		],
175	},
176	{
177		'name': 'touch',
178		'sources': [
179			'touch-test.c',
180			'input-timestamps-helper.c',
181			input_timestamps_unstable_v1_client_protocol_h,
182			input_timestamps_unstable_v1_protocol_c,
183		],
184	},
185	{
186		'name': 'vertex-clip',
187		'dep_objs': dep_vertex_clipping,
188	},
189	{	'name': 'viewporter', },
190	{	'name': 'viewporter-shot', },
191]
192
193tests_standalone = [
194	['config-parser', [], [ dep_zucmain ]],
195	['matrix', [], [ dep_libm, dep_matrix_c ]],
196	['timespec', [], [ dep_zucmain ]],
197	['zuc',
198		[
199			'../tools/zunitc/test/fixtures_test.c',
200			'../tools/zunitc/test/zunitc_test.c'
201		],
202		[ dep_zucmain ]
203	],
204]
205
206if get_option('xwayland')
207	d = dependency('x11', required: false)
208	if not d.found()
209		error('Xwayland tests require libX11 which was not found. Or, you can use \'-Dxwayland=false\'.')
210	endif
211	tests += {
212		'name': 'xwayland',
213		'dep_objs': d,
214	}
215endif
216
217# Manual test plugin, not used in the automatic suite
218surface_screenshot_test = shared_library(
219	'test-surface-screenshot',
220	'surface-screenshot-test.c',
221	include_directories: common_inc,
222	dependencies: [ dep_libweston_private, dep_libshared ],
223	name_prefix: '',
224	install: false,
225)
226
227if get_option('shell-ivi')
228	ivi_layout_test_plugin = shared_library(
229		'test-ivi-layout',
230		[
231			'ivi-layout-test-plugin.c',
232			weston_test_server_protocol_h,
233			weston_test_protocol_c,
234		],
235		include_directories: common_inc,
236		dependencies: [ dep_libweston_private, dep_libexec_weston ],
237		name_prefix: '',
238		install: false,
239	)
240	env_modmap += 'test-ivi-layout.so=' + ivi_layout_test_plugin.full_path() + ';'
241
242	tests += [
243		{
244			'name': 'ivi-layout-client',
245			'sources': [
246				'ivi-layout-test-client.c',
247				ivi_application_client_protocol_h,
248				ivi_application_protocol_c,
249			],
250			'test_deps': [ ivi_layout_test_plugin ],
251		},
252		{	'name': 'ivi-layout-internal', },
253		{
254			'name': 'ivi-shell-app',
255			'sources': [
256				'ivi-shell-app-test.c',
257				ivi_application_client_protocol_h,
258				ivi_application_protocol_c,
259			],
260		},
261	]
262endif
263
264test_config_h = configuration_data()
265test_config_h.set_quoted('WESTON_TEST_REFERENCE_PATH', meson.current_source_dir() + '/reference')
266test_config_h.set_quoted('WESTON_MODULE_MAP', env_modmap)
267test_config_h.set_quoted('WESTON_DATA_DIR', join_paths(meson.current_source_dir(), '..', 'data'))
268test_config_h.set_quoted('TESTSUITE_PLUGIN_PATH', exe_plugin_test.full_path())
269test_config_h.set_quoted('TESTSUITE_IVI_CONFIG_PATH', join_paths(meson.current_build_dir(), '../ivi-shell/weston-ivi-test.ini'))
270test_config_h.set_quoted('TESTSUITE_INTERNAL_SCREENSHOT_CONFIG_PATH', join_paths(meson.current_source_dir(), 'internal-screenshot.ini'))
271configure_file(output: 'test-config.h', configuration: test_config_h)
272
273foreach t : tests
274	t_name = 'test-' + t.get('name')
275	t_sources = t.get('sources', [t.get('name') + '-test.c'])
276	t_sources += weston_test_client_protocol_h
277
278	t_deps = [ dep_test_client, dep_libweston_private_h ]
279	t_deps += t.get('dep_objs', [])
280
281	t_exe = executable(
282		t_name,
283		t_sources,
284		c_args: [
285			'-DUNIT_TEST',
286			'-DTHIS_TEST_NAME="' + t_name + '"',
287		],
288		build_by_default: true,
289		include_directories: common_inc,
290		dependencies: t_deps,
291		install: false,
292	)
293
294	test(t.get('name'), t_exe, depends: t.get('test_deps', []))
295endforeach
296
297# FIXME: the multiple loops is lame. rethink this.
298foreach t : tests_standalone
299	if t[0] != 'zuc'
300		srcs_t = [
301			'@0@-test.c'.format(t.get(0)),
302			weston_test_client_protocol_h,
303		]
304	else
305		srcs_t = []
306	endif
307
308	if t.length() > 1
309		srcs_t += t.get(1)
310	endif
311
312	if t.length() > 2
313		deps_t = t[2]
314	else
315		deps_t = [ dep_test_client ]
316	endif
317
318	exe_t = executable(
319		'test-@0@'.format(t.get(0)),
320		srcs_t,
321		c_args: [ '-DUNIT_TEST' ],
322		build_by_default: true,
323		include_directories: common_inc,
324		dependencies: deps_t,
325		install: false,
326	)
327
328	# matrix-test is a manual test
329	if t[0] != 'matrix'
330		test(t.get(0), exe_t)
331	endif
332endforeach
333
334if get_option('backend-drm')
335	executable(
336		'setbacklight',
337		'setbacklight.c',
338		dependencies: [
339			dep_backlight,
340			dep_libdrm,
341			dependency('libudev')
342		],
343		include_directories: common_inc,
344		install: false
345	)
346endif
347