xref: /qemu/tests/unit/meson.build (revision 34dca3f5)
1da668aa1SThomas Huth
2da668aa1SThomas Huthtestblock = declare_dependency(dependencies: [block], sources: 'iothread.c')
3da668aa1SThomas Huth
4da668aa1SThomas Huthtests = {
5da668aa1SThomas Huth  'check-block-qdict': [],
6da668aa1SThomas Huth  'check-qdict': [],
7da668aa1SThomas Huth  'check-qnum': [],
8da668aa1SThomas Huth  'check-qstring': [],
9da668aa1SThomas Huth  'check-qlist': [],
10da668aa1SThomas Huth  'check-qnull': [],
11da668aa1SThomas Huth  'check-qobject': [],
12da668aa1SThomas Huth  'check-qjson': [],
13da668aa1SThomas Huth  'check-qlit': [],
146bbee5dbSMarc-André Lureau  'test-error-report': [],
15da668aa1SThomas Huth  'test-qobject-output-visitor': [testqapi],
16da668aa1SThomas Huth  'test-clone-visitor': [testqapi],
17da668aa1SThomas Huth  'test-qobject-input-visitor': [testqapi],
1818fa3ebcSPaolo Bonzini  'test-forward-visitor': [testqapi],
19da668aa1SThomas Huth  'test-string-input-visitor': [testqapi],
20da668aa1SThomas Huth  'test-string-output-visitor': [testqapi],
21da668aa1SThomas Huth  'test-visitor-serialization': [testqapi],
22da668aa1SThomas Huth  'test-bitmap': [],
2371177490SEric Auger  'test-resv-mem': [],
24af4c26e6SZhao Liu  # all code tested by test-x86-topo is inside topology.h
25af4c26e6SZhao Liu  'test-x86-topo': [],
26da668aa1SThomas Huth  'test-cutils': [],
2702346297SLuis Pires  'test-div128': [],
28da668aa1SThomas Huth  'test-shift128': [],
29da668aa1SThomas Huth  'test-mul64': [],
30da668aa1SThomas Huth  # all code tested by test-int128 is inside int128.h
31da668aa1SThomas Huth  'test-int128': [],
32da668aa1SThomas Huth  'rcutorture': [],
33da668aa1SThomas Huth  'test-rcu-list': [],
34da668aa1SThomas Huth  'test-rcu-simpleq': [],
35da668aa1SThomas Huth  'test-rcu-tailq': [],
36da668aa1SThomas Huth  'test-rcu-slist': [],
37da668aa1SThomas Huth  'test-qdist': [],
38da668aa1SThomas Huth  'test-qht': [],
39e3feb2ccSEmilio Cota  'test-qtree': [],
40da668aa1SThomas Huth  'test-bitops': [],
41da668aa1SThomas Huth  'test-bitcnt': [],
42da668aa1SThomas Huth  'test-qgraph': ['../qtest/libqos/qgraph.c'],
43da668aa1SThomas Huth  'check-qom-interface': [qom],
44da668aa1SThomas Huth  'check-qom-proplist': [qom],
45da668aa1SThomas Huth  'test-qemu-opts': [],
46da668aa1SThomas Huth  'test-keyval': [testqapi],
47da668aa1SThomas Huth  'test-logging': [],
48da668aa1SThomas Huth  'test-qapi-util': [],
490d99d37aSRichard Henderson  'test-interval-tree': [],
50da668aa1SThomas Huth}
51da668aa1SThomas Huth
52da668aa1SThomas Huthif have_system or have_tools
53da668aa1SThomas Huth  tests += {
54da668aa1SThomas Huth    'test-qmp-event': [testqapi],
55da668aa1SThomas Huth  }
56d2ea8dacSDaniel P. Berrangé
57d2ea8dacSDaniel P. Berrangé  if seccomp.found()
588d7f2e76SPhilippe Mathieu-Daudé    tests += {'test-seccomp': ['../../system/qemu-seccomp.c', seccomp]}
59d2ea8dacSDaniel P. Berrangé  endif
60da668aa1SThomas Huthendif
61da668aa1SThomas Huth
62da668aa1SThomas Huthif have_block
63da668aa1SThomas Huth  tests += {
64da668aa1SThomas Huth    'test-coroutine': [testblock],
65da668aa1SThomas Huth    'test-aio': [testblock],
66da668aa1SThomas Huth    'test-aio-multithread': [testblock],
67da668aa1SThomas Huth    'test-throttle': [testblock],
68da668aa1SThomas Huth    'test-thread-pool': [testblock],
69da668aa1SThomas Huth    'test-hbitmap': [testblock],
70da668aa1SThomas Huth    'test-bdrv-drain': [testblock],
71da668aa1SThomas Huth    'test-bdrv-graph-mod': [testblock],
72da668aa1SThomas Huth    'test-blockjob': [testblock],
73da668aa1SThomas Huth    'test-blockjob-txn': [testblock],
74da668aa1SThomas Huth    'test-block-backend': [testblock],
75da668aa1SThomas Huth    'test-block-iothread': [testblock],
76da668aa1SThomas Huth    'test-write-threshold': [testblock],
77da668aa1SThomas Huth    'test-crypto-hash': [crypto],
78da668aa1SThomas Huth    'test-crypto-hmac': [crypto],
79da668aa1SThomas Huth    'test-crypto-cipher': [crypto],
80689309c4SLei He    'test-crypto-akcipher': [crypto],
81da668aa1SThomas Huth    'test-crypto-secret': [crypto, keyutils],
8299d423f1SLei He    'test-crypto-der': [crypto],
83da668aa1SThomas Huth    'test-authz-simple': [authz],
84da668aa1SThomas Huth    'test-authz-list': [authz],
85da668aa1SThomas Huth    'test-authz-listfile': [authz],
86da668aa1SThomas Huth    'test-io-task': [testblock],
87da668aa1SThomas Huth    'test-io-channel-socket': ['socket-helpers.c', 'io-channel-helpers.c', io],
88da668aa1SThomas Huth    'test-io-channel-file': ['io-channel-helpers.c', io],
89da668aa1SThomas Huth    'test-io-channel-command': ['io-channel-helpers.c', io],
90da668aa1SThomas Huth    'test-io-channel-buffer': ['io-channel-helpers.c', io],
9187e42764SDaniel P. Berrangé    'test-io-channel-null': [io],
92da668aa1SThomas Huth    'test-crypto-ivgen': [io],
93da668aa1SThomas Huth    'test-crypto-afsplit': [io],
94da668aa1SThomas Huth    'test-crypto-block': [io],
9534dca3f5SPaolo Bonzini    'test-timed-average': [],
9634dca3f5SPaolo Bonzini    'test-uuid': [],
97da668aa1SThomas Huth  }
9857612511SPaolo Bonzini  if gnutls.found() and \
99ba7ed407SPaolo Bonzini     tasn1.found() and \
100d0cda6f4SPaolo Bonzini     host_os != 'windows'
101da668aa1SThomas Huth    tests += {
102da668aa1SThomas Huth      'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
103da668aa1SThomas Huth                                   tasn1, crypto, gnutls],
104da668aa1SThomas Huth      'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 'crypto-tls-psk-helpers.c',
105da668aa1SThomas Huth                                 tasn1, crypto, gnutls],
106da668aa1SThomas Huth      'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
107da668aa1SThomas Huth                              tasn1, io, crypto, gnutls]}
108da668aa1SThomas Huth  endif
10905e391aeSPaolo Bonzini  if pam.found()
110da668aa1SThomas Huth    tests += {'test-authz-pam': [authz]}
111da668aa1SThomas Huth  endif
11257612511SPaolo Bonzini  if xts == 'private'
113da668aa1SThomas Huth    tests += {'test-crypto-xts': [crypto, io]}
114da668aa1SThomas Huth  endif
115d0cda6f4SPaolo Bonzini  if host_os != 'windows'
116844a12a6SStefan Hajnoczi    tests += {
117844a12a6SStefan Hajnoczi      'test-image-locking': [testblock],
118844a12a6SStefan Hajnoczi      'test-nested-aio-poll': [testblock],
119844a12a6SStefan Hajnoczi    }
120da668aa1SThomas Huth  endif
121406523f6SPaolo Bonzini  if config_host_data.get('CONFIG_REPLICATION')
122da668aa1SThomas Huth    tests += {'test-replication': [testblock]}
123da668aa1SThomas Huth  endif
12457612511SPaolo Bonzini  if nettle.found() or gcrypt.found()
125da668aa1SThomas Huth    tests += {'test-crypto-pbkdf': [io]}
126da668aa1SThomas Huth  endif
127da668aa1SThomas Huthendif
128da668aa1SThomas Huth
129da668aa1SThomas Huthif have_system
130da668aa1SThomas Huth  tests += {
13134dca3f5SPaolo Bonzini    'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'],
132da668aa1SThomas Huth    'test-iov': [],
13334dca3f5SPaolo Bonzini    'test-opts-visitor': [testqapi],
13434dca3f5SPaolo Bonzini    'test-xs-node': [qom],
13534dca3f5SPaolo Bonzini    'test-virtio-dmabuf': [meson.project_source_root() / 'hw/display/virtio-dmabuf.c'],
136da668aa1SThomas Huth    'test-qmp-cmds': [testqapi],
137da668aa1SThomas Huth    'test-xbzrle': [migration],
138da668aa1SThomas Huth    'test-util-sockets': ['socket-helpers.c'],
139da668aa1SThomas Huth    'test-base64': [],
140da668aa1SThomas Huth    'test-bufferiszero': [],
14162b6323dSPhilippe Mathieu-Daudé    'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'],
142d3a0bb77SLukas Straub    'test-vmstate': [migration, io],
143d3a0bb77SLukas Straub    'test-yank': ['socket-helpers.c', qom, io, chardev]
144da668aa1SThomas Huth  }
1459d30c78cSVolker Rümelin  if config_host_data.get('CONFIG_INOTIFY1')
146da668aa1SThomas Huth    tests += {'test-util-filemonitor': []}
147da668aa1SThomas Huth  endif
148da668aa1SThomas Huth
149da668aa1SThomas Huth  # Some tests: test-char, test-qdev-global-props, and test-qga,
150da668aa1SThomas Huth  # are not runnable under TSan due to a known issue.
151da668aa1SThomas Huth  # https://github.com/google/sanitizers/issues/1116
15234f983d8SPaolo Bonzini  if not get_option('tsan')
153d0cda6f4SPaolo Bonzini    if host_os != 'windows'
154da668aa1SThomas Huth        tests += {
155da668aa1SThomas Huth          'test-char': ['socket-helpers.c', qom, io, chardev]
156da668aa1SThomas Huth        }
157da668aa1SThomas Huth    endif
158da668aa1SThomas Huth
159da668aa1SThomas Huth    tests += {
1609d587100SMarc-André Lureau      'test-qdev-global-props': [qom, hwcore]
161da668aa1SThomas Huth    }
162da668aa1SThomas Huth  endif
163da668aa1SThomas Huthendif
164da668aa1SThomas Huth
165d0cda6f4SPaolo Bonziniif have_ga and host_os == 'linux'
166c6d3bcb4SMarc-André Lureau  tests += {'test-qga': ['../qtest/libqmp.c']}
167da668aa1SThomas Huth  test_deps += {'test-qga': qga}
168da668aa1SThomas Huthendif
169da668aa1SThomas Huth
170da668aa1SThomas Huthtest_env = environment()
171da668aa1SThomas Huthtest_env.set('G_TEST_SRCDIR', meson.current_source_dir())
172da668aa1SThomas Huthtest_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
173da668aa1SThomas Huth
174da668aa1SThomas Huthslow_tests = {
175c45f8f1aSThomas Huth  'test-aio-multithread' : 120,
17655f7c6a5SPeter Maydell  'test-bufferiszero': 60,
177e1b363e3SThomas Huth  'test-crypto-block' : 300,
17855f7c6a5SPeter Maydell  'test-crypto-tlscredsx509': 90,
17955f7c6a5SPeter Maydell  'test-crypto-tlssession': 90,
18063b18312SKevin Wolf  'test-replication': 60,
181da668aa1SThomas Huth}
182da668aa1SThomas Huth
183da668aa1SThomas Huthforeach test_name, extra: tests
184da668aa1SThomas Huth  src = [test_name + '.c']
185da668aa1SThomas Huth  deps = [qemuutil]
186da668aa1SThomas Huth  if extra.length() > 0
187da668aa1SThomas Huth    # use a sourceset to quickly separate sources and deps
188da668aa1SThomas Huth    test_ss = ss.source_set()
189da668aa1SThomas Huth    test_ss.add(extra)
190da668aa1SThomas Huth    src += test_ss.all_sources()
191da668aa1SThomas Huth    deps += test_ss.all_dependencies()
192da668aa1SThomas Huth  endif
193da668aa1SThomas Huth  exe = executable(test_name, src, genh, dependencies: deps)
194da668aa1SThomas Huth
195da668aa1SThomas Huth  test(test_name, exe,
196da668aa1SThomas Huth       depends: test_deps.get(test_name, []),
197da668aa1SThomas Huth       env: test_env,
198da668aa1SThomas Huth       args: ['--tap', '-k'],
199da668aa1SThomas Huth       protocol: 'tap',
200da668aa1SThomas Huth       timeout: slow_tests.get(test_name, 30),
201da668aa1SThomas Huth       priority: slow_tests.get(test_name, 30),
202da668aa1SThomas Huth       suite: ['unit'])
203da668aa1SThomas Huthendforeach
204