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