xref: /openbmc/qemu/tests/unit/meson.build (revision 1b063fe2)
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-visitor-serialization': [testqapi],
22  'test-bitmap': [],
23  'test-resv-mem': [],
24  # all code tested by test-x86-topo is inside topology.h
25  'test-x86-topo': [],
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-qapi-util': [],
49  'test-interval-tree': [],
50  'test-fifo': [],
51}
52
53if have_system or have_tools
54  tests += {
55    'test-qmp-event': [testqapi],
56  }
57
58  if seccomp.found()
59    tests += {'test-seccomp': ['../../system/qemu-seccomp.c', seccomp]}
60  endif
61endif
62
63if have_block
64  tests += {
65    'test-coroutine': [testblock],
66    'test-aio': [testblock],
67    'test-aio-multithread': [testblock],
68    'test-throttle': [testblock],
69    'test-thread-pool': [testblock],
70    'test-hbitmap': [testblock],
71    'test-bdrv-drain': [testblock],
72    'test-bdrv-graph-mod': [testblock],
73    'test-blockjob': [testblock],
74    'test-blockjob-txn': [testblock],
75    'test-block-backend': [testblock],
76    'test-block-iothread': [testblock],
77    'test-write-threshold': [testblock],
78    'test-crypto-hash': [crypto],
79    'test-crypto-hmac': [crypto],
80    'test-crypto-cipher': [crypto],
81    'test-crypto-akcipher': [crypto],
82    'test-crypto-secret': [crypto, keyutils],
83    'test-crypto-der': [crypto],
84    'test-authz-simple': [authz],
85    'test-authz-list': [authz],
86    'test-authz-listfile': [authz],
87    'test-io-task': [testblock],
88    'test-io-channel-socket': ['socket-helpers.c', 'io-channel-helpers.c', io],
89    'test-io-channel-file': ['io-channel-helpers.c', io],
90    'test-io-channel-command': ['io-channel-helpers.c', io],
91    'test-io-channel-buffer': ['io-channel-helpers.c', io],
92    'test-io-channel-null': [io],
93    'test-crypto-ivgen': [io],
94    'test-crypto-afsplit': [io],
95    'test-crypto-block': [io],
96    'test-timed-average': [],
97    'test-uuid': [],
98  }
99  if gnutls.found() and \
100     tasn1.found() and \
101     host_os != 'windows'
102    tests += {
103      'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c',
104                                   tasn1, crypto, gnutls],
105      'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'crypto-tls-psk-helpers.c',
106                                 tasn1, crypto, gnutls],
107      'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.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 host_os != 'windows'
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  tests += {'test-crypto-pbkdf': [io]}
126endif
127
128if have_system
129  tests += {
130    'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'],
131    'test-iov': [],
132    'test-opts-visitor': [testqapi],
133    'test-xs-node': [qom],
134    'test-virtio-dmabuf': [meson.project_source_root() / 'hw/display/virtio-dmabuf.c'],
135    'test-qmp-cmds': [testqapi],
136    'test-xbzrle': [migration],
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 host_os != '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 host_os == '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-aio-multithread' : 120,
175  'test-bufferiszero': 60,
176  'test-crypto-block' : 300,
177  'test-crypto-tlscredsx509': 90,
178  'test-crypto-tlssession': 90,
179  'test-replication': 60,
180}
181
182foreach test_name, extra: tests
183  src = [test_name + '.c']
184  deps = [qemuutil]
185  if extra.length() > 0
186    # use a sourceset to quickly separate sources and deps
187    test_ss = ss.source_set()
188    test_ss.add(extra)
189    src += test_ss.all_sources()
190    deps += test_ss.all_dependencies()
191  endif
192  exe = executable(test_name, src, genh, dependencies: deps)
193
194  test(test_name, exe,
195       depends: test_deps.get(test_name, []),
196       env: test_env,
197       args: ['--tap', '-k'],
198       protocol: 'tap',
199       timeout: slow_tests.get(test_name, 30),
200       priority: slow_tests.get(test_name, 30),
201       suite: ['unit'])
202endforeach
203