]> git.proxmox.com Git - mirror_qemu.git/blob - tests/unit/meson.build
Merge tag 'pull-target-arm-20230530-1' of https://git.linaro.org/people/pmaydell...
[mirror_qemu.git] / tests / unit / meson.build
1
2 testblock = declare_dependency(dependencies: [block], sources: 'iothread.c')
3
4 tests = {
5 'check-block-qdict': [],
6 'check-qdict': [],
7 'check-qnum': [],
8 'check-qstring': [],
9 'check-qlist': [],
10 'check-qnull': [],
11 'check-qobject': [],
12 'check-qjson': [],
13 'check-qlit': [],
14 'test-error-report': [],
15 'test-qobject-output-visitor': [testqapi],
16 'test-clone-visitor': [testqapi],
17 'test-qobject-input-visitor': [testqapi],
18 'test-forward-visitor': [testqapi],
19 'test-string-input-visitor': [testqapi],
20 'test-string-output-visitor': [testqapi],
21 'test-opts-visitor': [testqapi],
22 'test-visitor-serialization': [testqapi],
23 'test-bitmap': [],
24 # all code tested by test-x86-cpuid is inside topology.h
25 'test-x86-cpuid': [],
26 'test-cutils': [],
27 'test-div128': [],
28 'test-shift128': [],
29 'test-mul64': [],
30 # all code tested by test-int128 is inside int128.h
31 'test-int128': [],
32 'rcutorture': [],
33 'test-rcu-list': [],
34 'test-rcu-simpleq': [],
35 'test-rcu-tailq': [],
36 'test-rcu-slist': [],
37 'test-qdist': [],
38 'test-qht': [],
39 'test-qtree': [],
40 'test-bitops': [],
41 'test-bitcnt': [],
42 'test-qgraph': ['../qtest/libqos/qgraph.c'],
43 'check-qom-interface': [qom],
44 'check-qom-proplist': [qom],
45 'test-qemu-opts': [],
46 'test-keyval': [testqapi],
47 'test-logging': [],
48 'test-uuid': [],
49 'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'],
50 'test-qapi-util': [],
51 'test-interval-tree': [],
52 'test-xs-node': [qom],
53 }
54
55 if have_system or have_tools
56 tests += {
57 'test-qmp-event': [testqapi],
58 }
59
60 if seccomp.found()
61 tests += {'test-seccomp': ['../../softmmu/qemu-seccomp.c', seccomp]}
62 endif
63 endif
64
65 if have_block
66 tests += {
67 'test-coroutine': [testblock],
68 'test-aio': [testblock],
69 'test-aio-multithread': [testblock],
70 'test-throttle': [testblock],
71 'test-thread-pool': [testblock],
72 'test-hbitmap': [testblock],
73 'test-bdrv-drain': [testblock],
74 'test-bdrv-graph-mod': [testblock],
75 'test-blockjob': [testblock],
76 'test-blockjob-txn': [testblock],
77 'test-block-backend': [testblock],
78 'test-block-iothread': [testblock],
79 'test-write-threshold': [testblock],
80 'test-crypto-hash': [crypto],
81 'test-crypto-hmac': [crypto],
82 'test-crypto-cipher': [crypto],
83 'test-crypto-akcipher': [crypto],
84 'test-crypto-secret': [crypto, keyutils],
85 'test-crypto-der': [crypto],
86 'test-authz-simple': [authz],
87 'test-authz-list': [authz],
88 'test-authz-listfile': [authz],
89 'test-io-task': [testblock],
90 'test-io-channel-socket': ['socket-helpers.c', 'io-channel-helpers.c', io],
91 'test-io-channel-file': ['io-channel-helpers.c', io],
92 'test-io-channel-command': ['io-channel-helpers.c', io],
93 'test-io-channel-buffer': ['io-channel-helpers.c', io],
94 'test-io-channel-null': [io],
95 'test-crypto-ivgen': [io],
96 'test-crypto-afsplit': [io],
97 'test-crypto-block': [io],
98 }
99 if gnutls.found() and \
100 tasn1.found() and \
101 'CONFIG_POSIX' in config_host
102 tests += {
103 'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
104 tasn1, crypto, gnutls],
105 'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 'crypto-tls-psk-helpers.c',
106 tasn1, crypto, gnutls],
107 'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
108 tasn1, io, crypto, gnutls]}
109 endif
110 if pam.found()
111 tests += {'test-authz-pam': [authz]}
112 endif
113 if xts == 'private'
114 tests += {'test-crypto-xts': [crypto, io]}
115 endif
116 if 'CONFIG_POSIX' in config_host
117 tests += {
118 'test-image-locking': [testblock],
119 'test-nested-aio-poll': [testblock],
120 }
121 endif
122 if config_host_data.get('CONFIG_REPLICATION')
123 tests += {'test-replication': [testblock]}
124 endif
125 if nettle.found() or gcrypt.found()
126 tests += {'test-crypto-pbkdf': [io]}
127 endif
128 if config_host_data.get('CONFIG_EPOLL_CREATE1')
129 tests += {'test-fdmon-epoll': [testblock]}
130 endif
131 endif
132
133 if have_system
134 tests += {
135 'test-iov': [],
136 'test-qmp-cmds': [testqapi],
137 'test-xbzrle': [migration],
138 'test-timed-average': [],
139 'test-util-sockets': ['socket-helpers.c'],
140 'test-base64': [],
141 'test-bufferiszero': [],
142 'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'],
143 'test-vmstate': [migration, io],
144 'test-yank': ['socket-helpers.c', qom, io, chardev]
145 }
146 if config_host_data.get('CONFIG_INOTIFY1')
147 tests += {'test-util-filemonitor': []}
148 endif
149
150 # Some tests: test-char, test-qdev-global-props, and test-qga,
151 # are not runnable under TSan due to a known issue.
152 # https://github.com/google/sanitizers/issues/1116
153 if not get_option('tsan')
154 if 'CONFIG_POSIX' in config_host
155 tests += {
156 'test-char': ['socket-helpers.c', qom, io, chardev]
157 }
158 endif
159
160 tests += {
161 'test-qdev-global-props': [qom, hwcore]
162 }
163 endif
164 endif
165
166 if have_ga and targetos == 'linux'
167 tests += {'test-qga': ['../qtest/libqmp.c']}
168 test_deps += {'test-qga': qga}
169 endif
170
171 test_env = environment()
172 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
173 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
174
175 slow_tests = {
176 'test-crypto-tlscredsx509': 45,
177 'test-crypto-tlssession': 45
178 }
179
180 foreach test_name, extra: tests
181 src = [test_name + '.c']
182 deps = [qemuutil]
183 if extra.length() > 0
184 # use a sourceset to quickly separate sources and deps
185 test_ss = ss.source_set()
186 test_ss.add(extra)
187 src += test_ss.all_sources()
188 deps += test_ss.all_dependencies()
189 endif
190 exe = executable(test_name, src, genh, dependencies: deps)
191
192 test(test_name, exe,
193 depends: test_deps.get(test_name, []),
194 env: test_env,
195 args: ['--tap', '-k'],
196 protocol: 'tap',
197 timeout: slow_tests.get(test_name, 30),
198 priority: slow_tests.get(test_name, 30),
199 suite: ['unit'])
200 endforeach