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