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