]>
Commit | Line | Data |
---|---|---|
279588d4 MAL |
1 | py3 = import('python').find_installation() |
2 | ||
a9726a90 | 3 | qht_bench = executable('qht-bench', |
279588d4 | 4 | sources: 'qht-bench.c', |
a9726a90 MAL |
5 | dependencies: [qemuutil]) |
6 | ||
a52f4a7a MAL |
7 | executable('atomic_add-bench', |
8 | sources: files('atomic_add-bench.c'), | |
9 | dependencies: [qemuutil], | |
10 | build_by_default: false) | |
11 | ||
12 | executable('atomic64-bench', | |
13 | sources: files('atomic64-bench.c'), | |
14 | dependencies: [qemuutil], | |
15 | build_by_default: false) | |
16 | ||
37e27776 MAL |
17 | test_qapi_outputs = [ |
18 | 'qapi-builtin-types.c', | |
19 | 'qapi-builtin-types.h', | |
20 | 'qapi-builtin-visit.c', | |
21 | 'qapi-builtin-visit.h', | |
22 | 'test-qapi-commands-sub-sub-module.c', | |
23 | 'test-qapi-commands-sub-sub-module.h', | |
24 | 'test-qapi-commands.c', | |
25 | 'test-qapi-commands.h', | |
26 | 'test-qapi-emit-events.c', | |
27 | 'test-qapi-emit-events.h', | |
28 | 'test-qapi-events-sub-sub-module.c', | |
29 | 'test-qapi-events-sub-sub-module.h', | |
30 | 'test-qapi-events.c', | |
31 | 'test-qapi-events.h', | |
32 | 'test-qapi-init-commands.c', | |
33 | 'test-qapi-init-commands.h', | |
34 | 'test-qapi-introspect.c', | |
35 | 'test-qapi-introspect.h', | |
36 | 'test-qapi-types-sub-sub-module.c', | |
37 | 'test-qapi-types-sub-sub-module.h', | |
38 | 'test-qapi-types.c', | |
39 | 'test-qapi-types.h', | |
40 | 'test-qapi-visit-sub-sub-module.c', | |
41 | 'test-qapi-visit-sub-sub-module.h', | |
42 | 'test-qapi-visit.c', | |
43 | 'test-qapi-visit.h', | |
44 | ] | |
45 | ||
46 | test_qapi_files = custom_target('Test QAPI files', | |
47 | output: test_qapi_outputs, | |
48 | input: files('qapi-schema/qapi-schema-test.json', | |
49 | 'qapi-schema/include/sub-module.json', | |
50 | 'qapi-schema/sub-sub-module.json'), | |
51 | command: [ qapi_gen, '-o', meson.current_build_dir(), | |
52 | '-b', '-p', 'test-', '@INPUT0@' ], | |
53 | depend_files: qapi_gen_depends) | |
54 | ||
55 | # meson doesn't like generated output in other directories | |
56 | # perhaps change qapi_gen to replace / with _, like Meson itself does? | |
57 | subdir('include') | |
58 | ||
97d6efd0 PB |
59 | test_qapi_sources = [] |
60 | test_qapi_headers = [] | |
61 | i = 0 | |
62 | foreach o: test_qapi_files.to_list() + test_qapi_files_extra.to_list() | |
63 | if o.full_path().endswith('.h') | |
64 | test_qapi_headers += o | |
65 | endif | |
66 | test_qapi_sources += o | |
67 | endforeach | |
68 | ||
69 | libtestqapi = static_library('testqapi', sources: [genh, test_qapi_sources]) | |
70 | testqapi = declare_dependency(link_with: libtestqapi, sources: [genh, test_qapi_headers]) | |
37e27776 | 71 | |
279588d4 MAL |
72 | testblock = declare_dependency(dependencies: [block], sources: 'iothread.c') |
73 | ||
74 | tests = { | |
75 | 'check-block-qdict': [], | |
76 | 'check-qdict': [], | |
77 | 'check-qnum': [], | |
78 | 'check-qstring': [], | |
79 | 'check-qlist': [], | |
80 | 'check-qnull': [], | |
81 | 'check-qobject': [], | |
82 | 'check-qjson': [], | |
83 | 'check-qlit': [], | |
84 | 'test-qobject-output-visitor': [testqapi], | |
85 | 'test-clone-visitor': [testqapi], | |
86 | 'test-qobject-input-visitor': [testqapi], | |
87 | 'test-string-input-visitor': [testqapi], | |
88 | 'test-string-output-visitor': [testqapi], | |
89 | 'test-qmp-event': [testqapi], | |
90 | 'test-opts-visitor': [testqapi], | |
91 | 'test-visitor-serialization': [testqapi], | |
92 | 'test-bitmap': [], | |
93 | # all code tested by test-x86-cpuid is inside topology.h | |
94 | 'test-x86-cpuid': [], | |
95 | 'test-cutils': [], | |
96 | 'test-shift128': [], | |
97 | 'test-mul64': [], | |
98 | # all code tested by test-int128 is inside int128.h | |
99 | 'test-int128': [], | |
100 | 'rcutorture': [], | |
101 | 'test-rcu-list': [], | |
102 | 'test-rcu-simpleq': [], | |
103 | 'test-rcu-tailq': [], | |
104 | 'test-rcu-slist': [], | |
105 | 'test-qdist': [], | |
106 | 'test-qht': [], | |
107 | 'test-bitops': [], | |
108 | 'test-bitcnt': [], | |
109 | 'test-qgraph': ['qtest/libqos/qgraph.c'], | |
110 | 'check-qom-interface': [qom], | |
111 | 'check-qom-proplist': [qom], | |
112 | 'test-qemu-opts': [], | |
113 | 'test-keyval': [testqapi], | |
114 | 'test-logging': [], | |
115 | 'test-uuid': [], | |
116 | 'ptimer-test': ['ptimer-test-stubs.c', meson.source_root() / 'hw/core/ptimer.c'], | |
117 | 'test-qapi-util': [], | |
118 | } | |
119 | ||
120 | test_deps = { | |
121 | 'test-qht-par': qht_bench, | |
122 | } | |
123 | ||
9ed7247a PB |
124 | benchs = {} |
125 | ||
279588d4 MAL |
126 | if have_block |
127 | tests += { | |
128 | 'test-coroutine': [testblock], | |
129 | 'test-aio': [testblock], | |
130 | 'test-aio-multithread': [testblock], | |
131 | 'test-throttle': [testblock], | |
132 | 'test-thread-pool': [testblock], | |
133 | 'test-hbitmap': [testblock], | |
134 | 'test-bdrv-drain': [testblock], | |
135 | 'test-bdrv-graph-mod': [testblock], | |
136 | 'test-blockjob': [testblock], | |
137 | 'test-blockjob-txn': [testblock], | |
138 | 'test-block-backend': [testblock], | |
139 | 'test-block-iothread': [testblock], | |
140 | 'test-write-threshold': [testblock], | |
141 | 'test-crypto-hash': [crypto], | |
142 | 'test-crypto-hmac': [crypto], | |
143 | 'test-crypto-cipher': [crypto], | |
144 | 'test-crypto-secret': [crypto, keyutils], | |
145 | 'test-authz-simple': [authz], | |
146 | 'test-authz-list': [authz], | |
147 | 'test-authz-listfile': [authz], | |
148 | 'test-io-task': [testblock], | |
149 | 'test-io-channel-socket': ['socket-helpers.c', 'io-channel-helpers.c', io], | |
150 | 'test-io-channel-file': ['io-channel-helpers.c', io], | |
151 | 'test-io-channel-command': ['io-channel-helpers.c', io], | |
152 | 'test-io-channel-buffer': ['io-channel-helpers.c', io], | |
153 | 'test-crypto-ivgen': [io], | |
154 | 'test-crypto-afsplit': [io], | |
155 | 'test-crypto-block': [io], | |
156 | } | |
157 | if 'CONFIG_GNUTLS' in config_host and \ | |
00650e6e YL |
158 | 'CONFIG_TASN1' in config_host and \ |
159 | 'CONFIG_POSIX' in config_host | |
279588d4 MAL |
160 | tests += { |
161 | 'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', | |
162 | tasn1, crypto], | |
163 | 'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 'crypto-tls-psk-helpers.c', | |
164 | tasn1, crypto], | |
165 | 'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', | |
166 | tasn1, io, crypto]} | |
167 | endif | |
168 | if 'CONFIG_AUTH_PAM' in config_host | |
169 | tests += {'test-authz-pam': [authz]} | |
170 | endif | |
171 | if 'CONFIG_QEMU_PRIVATE_XTS' in config_host | |
172 | tests += {'test-crypto-xts': [crypto, io]} | |
173 | endif | |
174 | if 'CONFIG_POSIX' in config_host | |
175 | tests += {'test-image-locking': [testblock]} | |
176 | endif | |
177 | if 'CONFIG_REPLICATION' in config_host | |
178 | tests += {'test-replication': [testblock]} | |
179 | endif | |
180 | if 'CONFIG_NETTLE' in config_host or 'CONFIG_GCRYPT' in config_host | |
181 | tests += {'test-crypto-pbkdf': [io]} | |
182 | endif | |
ed7db34b SH |
183 | if 'CONFIG_EPOLL_CREATE1' in config_host |
184 | tests += {'test-fdmon-epoll': [testblock]} | |
185 | endif | |
9ed7247a PB |
186 | benchs += { |
187 | 'benchmark-crypto-hash': [crypto], | |
188 | 'benchmark-crypto-hmac': [crypto], | |
189 | 'benchmark-crypto-cipher': [crypto], | |
190 | } | |
279588d4 MAL |
191 | endif |
192 | ||
193 | if have_system | |
194 | tests += { | |
195 | 'test-iov': [], | |
196 | 'test-qmp-cmds': [testqapi], | |
197 | 'test-xbzrle': [migration], | |
198 | 'test-timed-average': [], | |
199 | 'test-util-sockets': ['socket-helpers.c'], | |
200 | 'test-base64': [], | |
201 | 'test-bufferiszero': [], | |
202 | 'test-vmstate': [migration, io] | |
203 | } | |
204 | if 'CONFIG_INOTIFY1' in config_host | |
205 | tests += {'test-util-filemonitor': []} | |
206 | endif | |
207 | ||
208 | # Some tests: test-char, test-qdev-global-props, and test-qga, | |
209 | # are not runnable under TSan due to a known issue. | |
210 | # https://github.com/google/sanitizers/issues/1116 | |
211 | if 'CONFIG_TSAN' not in config_host | |
2d898800 YL |
212 | if 'CONFIG_POSIX' in config_host |
213 | tests += { | |
214 | 'test-char': ['socket-helpers.c', qom, io, chardev] | |
215 | } | |
216 | endif | |
217 | ||
279588d4 | 218 | tests += { |
279588d4 MAL |
219 | 'test-qdev-global-props': [qom, hwcore, testqapi] |
220 | } | |
221 | endif | |
222 | endif | |
223 | ||
224 | if 'CONFIG_TSAN' not in config_host and \ | |
225 | 'CONFIG_GUEST_AGENT' in config_host and \ | |
226 | 'CONFIG_LINUX' in config_host | |
227 | tests += {'test-qga': ['qtest/libqtest.c']} | |
228 | test_deps += {'test-qga': qga} | |
229 | endif | |
230 | ||
231 | test_env = environment() | |
232 | test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) | |
233 | test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) | |
234 | ||
235 | foreach test_name, extra: tests | |
236 | src = [test_name + '.c'] | |
237 | deps = [qemuutil] | |
238 | if extra.length() > 0 | |
239 | # use a sourceset to quickly separate sources and deps | |
240 | test_ss = ss.source_set() | |
241 | test_ss.add(extra) | |
242 | src += test_ss.all_sources() | |
243 | deps += test_ss.all_dependencies() | |
244 | endif | |
8a5701e5 | 245 | exe = executable(test_name, src, genh, dependencies: deps) |
279588d4 MAL |
246 | |
247 | test(test_name, exe, | |
248 | depends: test_deps.get(test_name, []), | |
249 | env: test_env, | |
250 | args: ['--tap', '-k'], | |
251 | protocol: 'tap', | |
252 | suite: ['unit']) | |
253 | endforeach | |
254 | ||
9ed7247a PB |
255 | foreach bench_name, deps: benchs |
256 | exe = executable(bench_name, bench_name + '.c', | |
257 | dependencies: [qemuutil] + deps) | |
258 | benchmark(bench_name, exe, | |
259 | args: ['--tap', '-k'], | |
260 | protocol: 'tap', | |
261 | suite: ['speed']) | |
262 | endforeach | |
89d4dc8f | 263 | |
27d551c0 | 264 | if have_tools and 'CONFIG_VHOST_USER' in config_host and 'CONFIG_LINUX' in config_host |
89d4dc8f MAL |
265 | executable('vhost-user-bridge', |
266 | sources: files('vhost-user-bridge.c'), | |
0df750e9 | 267 | dependencies: [qemuutil, vhost_user]) |
89d4dc8f MAL |
268 | endif |
269 | ||
d3ca592b PB |
270 | if have_system and 'CONFIG_POSIX' in config_host |
271 | subdir('qemu-iotests') | |
272 | endif | |
273 | ||
ce1c1e7a PB |
274 | test('decodetree', sh, |
275 | args: [ files('decode/check.sh'), config_host['PYTHON'], files('../scripts/decodetree.py') ], | |
276 | workdir: meson.current_source_dir() / 'decode', | |
277 | suite: 'decodetree') | |
3941996b | 278 | |
7f808687 AB |
279 | subdir('fp') |
280 | ||
1badb709 | 281 | if not get_option('tcg').disabled() |
ffac93df PB |
282 | if 'CONFIG_PLUGIN' in config_host |
283 | subdir('plugin') | |
284 | endif | |
3941996b | 285 | endif |
3afe7ab0 PB |
286 | |
287 | subdir('qapi-schema') | |
a2ce7dbd | 288 | subdir('qtest') |
4fbcdcd7 | 289 | subdir('migration') |