xref: /openbmc/qemu/tests/unit/meson.build (revision 197a1372)
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-forward-visitor': [testqapi],
18  'test-string-input-visitor': [testqapi],
19  'test-string-output-visitor': [testqapi],
20  'test-opts-visitor': [testqapi],
21  'test-visitor-serialization': [testqapi],
22  'test-bitmap': [],
23  # all code tested by test-x86-cpuid is inside topology.h
24  'test-x86-cpuid': [],
25  'test-cutils': [],
26  'test-div128': [],
27  'test-shift128': [],
28  'test-mul64': [],
29  # all code tested by test-int128 is inside int128.h
30  'test-int128': [],
31  'rcutorture': [],
32  'test-rcu-list': [],
33  'test-rcu-simpleq': [],
34  'test-rcu-tailq': [],
35  'test-rcu-slist': [],
36  'test-qdist': [],
37  'test-qht': [],
38  'test-bitops': [],
39  'test-bitcnt': [],
40  'test-qgraph': ['../qtest/libqos/qgraph.c'],
41  'check-qom-interface': [qom],
42  'check-qom-proplist': [qom],
43  'test-qemu-opts': [],
44  'test-keyval': [testqapi],
45  'test-logging': [],
46  'test-uuid': [],
47  'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'],
48  'test-qapi-util': [],
49  'test-interval-tree': [],
50  'test-xs-node': [qom],
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': ['../../softmmu/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  }
97  if gnutls.found() and \
98     tasn1.found() and \
99     'CONFIG_POSIX' in config_host
100    tests += {
101      'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
102                                   tasn1, crypto, gnutls],
103      'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 'crypto-tls-psk-helpers.c',
104                                 tasn1, crypto, gnutls],
105      'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
106                              tasn1, io, crypto, gnutls]}
107  endif
108  if pam.found()
109    tests += {'test-authz-pam': [authz]}
110  endif
111  if xts == 'private'
112    tests += {'test-crypto-xts': [crypto, io]}
113  endif
114  if 'CONFIG_POSIX' in config_host
115    tests += {'test-image-locking': [testblock]}
116  endif
117  if config_host_data.get('CONFIG_REPLICATION')
118    tests += {'test-replication': [testblock]}
119  endif
120  if nettle.found() or gcrypt.found()
121    tests += {'test-crypto-pbkdf': [io]}
122  endif
123  if config_host_data.get('CONFIG_EPOLL_CREATE1')
124    tests += {'test-fdmon-epoll': [testblock]}
125  endif
126endif
127
128if have_system
129  tests += {
130    'test-iov': [],
131    'test-qmp-cmds': [testqapi],
132    'test-xbzrle': [migration],
133    'test-timed-average': [],
134    'test-util-sockets': ['socket-helpers.c'],
135    'test-base64': [],
136    'test-bufferiszero': [],
137    'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'],
138    'test-vmstate': [migration, io],
139    'test-yank': ['socket-helpers.c', qom, io, chardev]
140  }
141  if config_host_data.get('CONFIG_INOTIFY1')
142    tests += {'test-util-filemonitor': []}
143  endif
144
145  # Some tests: test-char, test-qdev-global-props, and test-qga,
146  # are not runnable under TSan due to a known issue.
147  # https://github.com/google/sanitizers/issues/1116
148  if 'CONFIG_TSAN' not in config_host
149    if 'CONFIG_POSIX' in config_host
150        tests += {
151          'test-char': ['socket-helpers.c', qom, io, chardev]
152        }
153    endif
154
155    tests += {
156      'test-qdev-global-props': [qom, hwcore]
157    }
158  endif
159endif
160
161if have_ga and targetos == 'linux'
162  tests += {'test-qga': ['../qtest/libqmp.c']}
163  test_deps += {'test-qga': qga}
164endif
165
166test_env = environment()
167test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
168test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
169
170slow_tests = {
171  'test-crypto-tlscredsx509': 45,
172  'test-crypto-tlssession': 45
173}
174
175foreach test_name, extra: tests
176  src = [test_name + '.c']
177  deps = [qemuutil]
178  if extra.length() > 0
179    # use a sourceset to quickly separate sources and deps
180    test_ss = ss.source_set()
181    test_ss.add(extra)
182    src += test_ss.all_sources()
183    deps += test_ss.all_dependencies()
184  endif
185  exe = executable(test_name, src, genh, dependencies: deps)
186
187  test(test_name, exe,
188       depends: test_deps.get(test_name, []),
189       env: test_env,
190       args: ['--tap', '-k'],
191       protocol: 'tap',
192       timeout: slow_tests.get(test_name, 30),
193       priority: slow_tests.get(test_name, 30),
194       suite: ['unit'])
195endforeach
196