target/m68k: implement rtr instruction
[qemu/ar7.git] / tests / meson.build
blob656d211e2595dd94d9cd79449a79fb520e00d199
1 py3 = import('python').find_installation()
3 qht_bench = executable('qht-bench',
4                        sources: 'qht-bench.c',
5                        dependencies: [qemuutil])
7 executable('atomic_add-bench',
8            sources: files('atomic_add-bench.c'),
9            dependencies: [qemuutil],
10            build_by_default: false)
12 executable('atomic64-bench',
13            sources: files('atomic64-bench.c'),
14            dependencies: [qemuutil],
15            build_by_default: false)
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',
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)
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')
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
69 libtestqapi = static_library('testqapi', sources: [genh, test_qapi_sources])
70 testqapi = declare_dependency(link_with: libtestqapi, sources: [genh, test_qapi_headers])
72 testblock = declare_dependency(dependencies: [block], sources: 'iothread.c')
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-opts-visitor': [testqapi],
90   'test-visitor-serialization': [testqapi],
91   'test-bitmap': [],
92   # all code tested by test-x86-cpuid is inside topology.h
93   'test-x86-cpuid': [],
94   'test-cutils': [],
95   'test-shift128': [],
96   'test-mul64': [],
97   # all code tested by test-int128 is inside int128.h
98   'test-int128': [],
99   'rcutorture': [],
100   'test-rcu-list': [],
101   'test-rcu-simpleq': [],
102   'test-rcu-tailq': [],
103   'test-rcu-slist': [],
104   'test-qdist': [],
105   'test-qht': [],
106   'test-bitops': [],
107   'test-bitcnt': [],
108   'test-qgraph': ['qtest/libqos/qgraph.c'],
109   'check-qom-interface': [qom],
110   'check-qom-proplist': [qom],
111   'test-qemu-opts': [],
112   'test-keyval': [testqapi],
113   'test-logging': [],
114   'test-uuid': [],
115   'ptimer-test': ['ptimer-test-stubs.c', meson.source_root() / 'hw/core/ptimer.c'],
116   'test-qapi-util': [],
119 if have_system or have_tools
120   tests += {
121     'test-qmp-event': [testqapi],
122   }
123 endif
125 test_deps = {
126   'test-qht-par': qht_bench,
129 benchs = {}
131 if have_block
132   tests += {
133     'test-coroutine': [testblock],
134     'test-aio': [testblock],
135     'test-aio-multithread': [testblock],
136     'test-throttle': [testblock],
137     'test-thread-pool': [testblock],
138     'test-hbitmap': [testblock],
139     'test-bdrv-drain': [testblock],
140     'test-bdrv-graph-mod': [testblock],
141     'test-blockjob': [testblock],
142     'test-blockjob-txn': [testblock],
143     'test-block-backend': [testblock],
144     'test-block-iothread': [testblock],
145     'test-write-threshold': [testblock],
146     'test-crypto-hash': [crypto],
147     'test-crypto-hmac': [crypto],
148     'test-crypto-cipher': [crypto],
149     'test-crypto-secret': [crypto, keyutils],
150     'test-authz-simple': [authz],
151     'test-authz-list': [authz],
152     'test-authz-listfile': [authz],
153     'test-io-task': [testblock],
154     'test-io-channel-socket': ['socket-helpers.c', 'io-channel-helpers.c', io],
155     'test-io-channel-file': ['io-channel-helpers.c', io],
156     'test-io-channel-command': ['io-channel-helpers.c', io],
157     'test-io-channel-buffer': ['io-channel-helpers.c', io],
158     'test-crypto-ivgen': [io],
159     'test-crypto-afsplit': [io],
160     'test-crypto-block': [io],
161   }
162   if 'CONFIG_GNUTLS' in config_host and \
163      'CONFIG_TASN1' in config_host and \
164      'CONFIG_POSIX' in config_host
165     tests += {
166       'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
167                                    tasn1, crypto, gnutls],
168       'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 'crypto-tls-psk-helpers.c',
169                                  tasn1, crypto, gnutls],
170       'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
171                               tasn1, io, crypto, gnutls]}
172   endif
173   if 'CONFIG_AUTH_PAM' in config_host
174     tests += {'test-authz-pam': [authz]}
175   endif
176   if 'CONFIG_QEMU_PRIVATE_XTS' in config_host
177     tests += {'test-crypto-xts': [crypto, io]}
178   endif
179   if 'CONFIG_POSIX' in config_host
180     tests += {'test-image-locking': [testblock]}
181   endif
182   if 'CONFIG_REPLICATION' in config_host
183     tests += {'test-replication': [testblock]}
184   endif
185   if 'CONFIG_NETTLE' in config_host or 'CONFIG_GCRYPT' in config_host
186     tests += {'test-crypto-pbkdf': [io]}
187   endif
188   if 'CONFIG_EPOLL_CREATE1' in config_host
189     tests += {'test-fdmon-epoll': [testblock]}
190   endif
191   benchs += {
192      'benchmark-crypto-hash': [crypto],
193      'benchmark-crypto-hmac': [crypto],
194      'benchmark-crypto-cipher': [crypto],
195   }
196 endif
198 if have_system
199   tests += {
200     'test-iov': [],
201     'test-qmp-cmds': [testqapi],
202     'test-xbzrle': [migration],
203     'test-timed-average': [],
204     'test-util-sockets': ['socket-helpers.c'],
205     'test-base64': [],
206     'test-bufferiszero': [],
207     'test-vmstate': [migration, io]
208   }
209   if 'CONFIG_INOTIFY1' in config_host
210     tests += {'test-util-filemonitor': []}
211   endif
213   # Some tests: test-char, test-qdev-global-props, and test-qga,
214   # are not runnable under TSan due to a known issue.
215   # https://github.com/google/sanitizers/issues/1116
216   if 'CONFIG_TSAN' not in config_host
217     if 'CONFIG_POSIX' in config_host
218         tests += {
219           'test-char': ['socket-helpers.c', qom, io, chardev]
220         }
221     endif
223     tests += {
224       'test-qdev-global-props': [qom, hwcore, testqapi]
225     }
226   endif
227 endif
229 if 'CONFIG_TSAN' not in config_host and \
230    'CONFIG_GUEST_AGENT' in config_host and \
231    'CONFIG_LINUX' in config_host
232   tests += {'test-qga': ['qtest/libqtest.c']}
233   test_deps += {'test-qga': qga}
234 endif
236 test_env = environment()
237 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
238 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
240 slow_tests = {
241   'test-crypto-tlscredsx509': 45,
242   'test-crypto-tlssession': 45
245 foreach test_name, extra: tests
246   src = [test_name + '.c']
247   deps = [qemuutil]
248   if extra.length() > 0
249     # use a sourceset to quickly separate sources and deps
250     test_ss = ss.source_set()
251     test_ss.add(extra)
252     src += test_ss.all_sources()
253     deps += test_ss.all_dependencies()
254   endif
255   exe = executable(test_name, src, genh, dependencies: deps)
257   test(test_name, exe,
258        depends: test_deps.get(test_name, []),
259        env: test_env,
260        args: ['--tap', '-k'],
261        protocol: 'tap',
262        timeout: slow_tests.get(test_name, 30),
263        priority: slow_tests.get(test_name, 30),
264        suite: ['unit'])
265 endforeach
267 foreach bench_name, deps: benchs
268   exe = executable(bench_name, bench_name + '.c',
269                    dependencies: [qemuutil] + deps)
270   benchmark(bench_name, exe,
271             args: ['--tap', '-k'],
272             protocol: 'tap',
273             timeout: 0,
274             suite: ['speed'])
275 endforeach
277 if have_tools and 'CONFIG_VHOST_USER' in config_host and 'CONFIG_LINUX' in config_host
278   executable('vhost-user-bridge',
279              sources: files('vhost-user-bridge.c'),
280              dependencies: [qemuutil, vhost_user])
281 endif
283 if have_system and 'CONFIG_POSIX' in config_host
284   subdir('qemu-iotests')
285 endif
287 test('decodetree', sh,
288      args: [ files('decode/check.sh'), config_host['PYTHON'], files('../scripts/decodetree.py') ],
289      workdir: meson.current_source_dir() / 'decode',
290      suite: 'decodetree')
292 if 'CONFIG_TCG' in config_all
293   subdir('fp')
294 endif
296 if not get_option('tcg').disabled()
297   if 'CONFIG_PLUGIN' in config_host
298     subdir('plugin')
299   endif
300 endif
302 subdir('qapi-schema')
303 subdir('qtest')
304 subdir('migration')