]> git.proxmox.com Git - mirror_qemu.git/blob - tests/unit/meson.build
Merge tag 'edk2-stable202302-20230320-pull-request' of https://gitlab.com/kraxel...
[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-bitops': [],
40 'test-bitcnt': [],
41 'test-qgraph': ['../qtest/libqos/qgraph.c'],
42 'check-qom-interface': [qom],
43 'check-qom-proplist': [qom],
44 'test-qemu-opts': [],
45 'test-keyval': [testqapi],
46 'test-logging': [],
47 'test-uuid': [],
48 'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'],
49 'test-qapi-util': [],
50 'test-interval-tree': [],
51 'test-xs-node': [qom],
52 }
53
54 if have_system or have_tools
55 tests += {
56 'test-qmp-event': [testqapi],
57 }
58
59 if seccomp.found()
60 tests += {'test-seccomp': ['../../softmmu/qemu-seccomp.c', seccomp]}
61 endif
62 endif
63
64 if have_block
65 tests += {
66 'test-coroutine': [testblock],
67 'test-aio': [testblock],
68 'test-aio-multithread': [testblock],
69 'test-throttle': [testblock],
70 'test-thread-pool': [testblock],
71 'test-hbitmap': [testblock],
72 'test-bdrv-drain': [testblock],
73 'test-bdrv-graph-mod': [testblock],
74 'test-blockjob': [testblock],
75 'test-blockjob-txn': [testblock],
76 'test-block-backend': [testblock],
77 'test-block-iothread': [testblock],
78 'test-write-threshold': [testblock],
79 'test-crypto-hash': [crypto],
80 'test-crypto-hmac': [crypto],
81 'test-crypto-cipher': [crypto],
82 'test-crypto-akcipher': [crypto],
83 'test-crypto-secret': [crypto, keyutils],
84 'test-crypto-der': [crypto],
85 'test-authz-simple': [authz],
86 'test-authz-list': [authz],
87 'test-authz-listfile': [authz],
88 'test-io-task': [testblock],
89 'test-io-channel-socket': ['socket-helpers.c', 'io-channel-helpers.c', io],
90 'test-io-channel-file': ['io-channel-helpers.c', io],
91 'test-io-channel-command': ['io-channel-helpers.c', io],
92 'test-io-channel-buffer': ['io-channel-helpers.c', io],
93 'test-io-channel-null': [io],
94 'test-crypto-ivgen': [io],
95 'test-crypto-afsplit': [io],
96 'test-crypto-block': [io],
97 }
98 if gnutls.found() and \
99 tasn1.found() and \
100 'CONFIG_POSIX' in config_host
101 tests += {
102 'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
103 tasn1, crypto, gnutls],
104 'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 'crypto-tls-psk-helpers.c',
105 tasn1, crypto, gnutls],
106 'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
107 tasn1, io, crypto, gnutls]}
108 endif
109 if pam.found()
110 tests += {'test-authz-pam': [authz]}
111 endif
112 if xts == 'private'
113 tests += {'test-crypto-xts': [crypto, io]}
114 endif
115 if 'CONFIG_POSIX' in config_host
116 tests += {'test-image-locking': [testblock]}
117 endif
118 if config_host_data.get('CONFIG_REPLICATION')
119 tests += {'test-replication': [testblock]}
120 endif
121 if nettle.found() or gcrypt.found()
122 tests += {'test-crypto-pbkdf': [io]}
123 endif
124 if config_host_data.get('CONFIG_EPOLL_CREATE1')
125 tests += {'test-fdmon-epoll': [testblock]}
126 endif
127 endif
128
129 if have_system
130 tests += {
131 'test-iov': [],
132 'test-qmp-cmds': [testqapi],
133 'test-xbzrle': [migration],
134 'test-timed-average': [],
135 'test-util-sockets': ['socket-helpers.c'],
136 'test-base64': [],
137 'test-bufferiszero': [],
138 'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'],
139 'test-vmstate': [migration, io],
140 'test-yank': ['socket-helpers.c', qom, io, chardev]
141 }
142 if config_host_data.get('CONFIG_INOTIFY1')
143 tests += {'test-util-filemonitor': []}
144 endif
145
146 # Some tests: test-char, test-qdev-global-props, and test-qga,
147 # are not runnable under TSan due to a known issue.
148 # https://github.com/google/sanitizers/issues/1116
149 if 'CONFIG_TSAN' not in config_host
150 if 'CONFIG_POSIX' in config_host
151 tests += {
152 'test-char': ['socket-helpers.c', qom, io, chardev]
153 }
154 endif
155
156 tests += {
157 'test-qdev-global-props': [qom, hwcore]
158 }
159 endif
160 endif
161
162 if have_ga and targetos == 'linux'
163 tests += {'test-qga': ['../qtest/libqmp.c']}
164 test_deps += {'test-qga': qga}
165 endif
166
167 test_env = environment()
168 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
169 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
170
171 slow_tests = {
172 'test-crypto-tlscredsx509': 45,
173 'test-crypto-tlssession': 45
174 }
175
176 foreach test_name, extra: tests
177 src = [test_name + '.c']
178 deps = [qemuutil]
179 if extra.length() > 0
180 # use a sourceset to quickly separate sources and deps
181 test_ss = ss.source_set()
182 test_ss.add(extra)
183 src += test_ss.all_sources()
184 deps += test_ss.all_dependencies()
185 endif
186 exe = executable(test_name, src, genh, dependencies: deps)
187
188 test(test_name, exe,
189 depends: test_deps.get(test_name, []),
190 env: test_env,
191 args: ['--tap', '-k'],
192 protocol: 'tap',
193 timeout: slow_tests.get(test_name, 30),
194 priority: slow_tests.get(test_name, 30),
195 suite: ['unit'])
196 endforeach