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