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