• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1test_runner = static_library(
2	'test-runner',
3	sources: [
4		'test-runner.c',
5		'test-helpers.c',
6		'test-compositor.c'
7	],
8	include_directories: [ root_inc, src_inc ],
9	dependencies: [
10		cc.find_library('dl', required: false),
11		dependency('threads'),
12		ffi_dep,
13		wayland_util_dep,
14		wayland_private_dep,
15		wayland_client_dep,
16		wayland_server_dep
17	]
18)
19
20test_runner_dep = declare_dependency(
21	link_with: test_runner,
22	include_directories: [ src_inc ],
23	dependencies: [
24		dependency('threads'),
25		cc.find_library('dl', required: false)
26	]
27)
28
29tests_protocol_xml = files('../protocol/tests.xml')
30
31tests_server_protocol_h = custom_target(
32	'test server protocol header',
33	command: [ wayland_scanner_for_build, '-s', 'server-header', '@INPUT@', '@OUTPUT@' ],
34	input: tests_protocol_xml,
35	output: 'tests-server-protocol.h'
36)
37
38tests_client_protocol_c = custom_target(
39	'test client protocol header',
40	command: [ wayland_scanner_for_build, '-s', 'client-header', '@INPUT@', '@OUTPUT@' ],
41	input: tests_protocol_xml,
42	output: 'tests-client-protocol.h'
43)
44
45tests_protocol_c = custom_target(
46	'test protocol source',
47	command: [ wayland_scanner_for_build, '-s', 'public-code', '@INPUT@', '@OUTPUT@' ],
48	input: tests_protocol_xml,
49	output: 'tests-protocol.c'
50)
51
52benchmark(
53	'fixed-benchmark',
54	executable(
55		'fixed-benchmark',
56		'fixed-benchmark.c',
57		dependencies: [ test_runner_dep, rt_dep ]
58	)
59)
60
61executable(
62	'exec-fd-leak-checker',
63	'exec-fd-leak-checker.c',
64	dependencies: test_runner_dep
65)
66
67test(
68	'cpp-compile-test',
69	executable(
70		'cpp-compile-test',
71		'cpp-compile-test.cpp',
72		wayland_server_protocol_h,
73		include_directories: src_inc
74	)
75)
76
77sed_path = find_program('sed').path()
78
79if get_option('scanner')
80	test(
81		'scanner-test',
82		find_program('scanner-test.sh'),
83		env: [
84			'TEST_DATA_DIR=@0@/data'.format(meson.current_source_dir()),
85			'TEST_OUTPUT_DIR=@0@/output'.format(meson.current_build_dir()),
86			'SED=@0@'.format(sed_path),
87			'WAYLAND_SCANNER=@0@'.format(wayland_scanner.full_path()),
88		],
89	)
90endif
91
92tests = {
93	'array-test': [],
94	'client-test': [ wayland_server_protocol_h ],
95	'display-test': [
96		wayland_client_protocol_h,
97		wayland_server_protocol_h,
98		tests_server_protocol_h,
99		tests_client_protocol_c,
100		tests_protocol_c,
101	],
102	'connection-test': [
103		wayland_client_protocol_h,
104		wayland_server_protocol_h,
105	],
106	'event-loop-test': [ wayland_server_protocol_h ],
107	'fixed-test': [],
108	'interface-test': [ wayland_client_protocol_h ],
109	'list-test': [],
110	'map-test': [],
111	'sanity-test' : [
112		wayland_client_protocol_h,
113		wayland_server_protocol_h,
114	],
115	'socket-test': [
116		wayland_client_protocol_h,
117		wayland_server_protocol_h,
118	],
119	'queue-test': [
120		wayland_client_protocol_h,
121		wayland_server_protocol_h,
122	],
123	'signal-test': [ wayland_server_protocol_h ],
124	'newsignal-test': [
125		# wayland-server.c is needed here to access wl_priv_* functions
126		files('../src/wayland-server.c'),
127		wayland_server_protocol_h,
128	],
129	'resources-test': [ wayland_server_protocol_h ],
130	'message-test': [
131		wayland_client_protocol_h,
132		wayland_server_protocol_h,
133	],
134	'compositor-introspection-test': [
135		wayland_client_protocol_h,
136		wayland_server_protocol_h,
137	],
138	'protocol-logger-test': [
139		wayland_client_protocol_h,
140		wayland_server_protocol_h,
141	],
142	'headers-test': [
143		wayland_client_protocol_h,
144		wayland_server_protocol_h,
145		'headers-protocol-test.c',
146		wayland_client_protocol_core_h,
147		wayland_server_protocol_core_h,
148		'headers-protocol-core-test.c',
149	],
150	'os-wrappers-test': [],
151}
152
153foreach test_name, test_extra_sources: tests
154	test_sources = [ test_name + '.c' ] + test_extra_sources
155	test_deps = [test_runner_dep]
156	bin = executable(test_name, test_sources, dependencies: test_deps)
157	test(
158		test_name,
159		bin,
160		env: [
161			'TEST_SRC_DIR=@0@'.format(meson.current_source_dir()),
162			'TEST_BUILD_DIR=@0@'.format(meson.current_build_dir()),
163		],
164	)
165endforeach
166