xref: /qemu/tests/unit/meson.build (revision 57612511)
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': [],
14da668aa1SThomas Huth  'test-qobject-output-visitor': [testqapi],
15da668aa1SThomas Huth  'test-clone-visitor': [testqapi],
16da668aa1SThomas Huth  'test-qobject-input-visitor': [testqapi],
17da668aa1SThomas Huth  'test-string-input-visitor': [testqapi],
18da668aa1SThomas Huth  'test-string-output-visitor': [testqapi],
19da668aa1SThomas Huth  'test-opts-visitor': [testqapi],
20da668aa1SThomas Huth  'test-visitor-serialization': [testqapi],
21da668aa1SThomas Huth  'test-bitmap': [],
22da668aa1SThomas Huth  # all code tested by test-x86-cpuid is inside topology.h
23da668aa1SThomas Huth  'test-x86-cpuid': [],
24da668aa1SThomas Huth  'test-cutils': [],
25da668aa1SThomas Huth  'test-shift128': [],
26da668aa1SThomas Huth  'test-mul64': [],
27da668aa1SThomas Huth  # all code tested by test-int128 is inside int128.h
28da668aa1SThomas Huth  'test-int128': [],
29da668aa1SThomas Huth  'rcutorture': [],
30da668aa1SThomas Huth  'test-rcu-list': [],
31da668aa1SThomas Huth  'test-rcu-simpleq': [],
32da668aa1SThomas Huth  'test-rcu-tailq': [],
33da668aa1SThomas Huth  'test-rcu-slist': [],
34da668aa1SThomas Huth  'test-qdist': [],
35da668aa1SThomas Huth  'test-qht': [],
36da668aa1SThomas Huth  'test-bitops': [],
37da668aa1SThomas Huth  'test-bitcnt': [],
38da668aa1SThomas Huth  'test-qgraph': ['../qtest/libqos/qgraph.c'],
39da668aa1SThomas Huth  'check-qom-interface': [qom],
40da668aa1SThomas Huth  'check-qom-proplist': [qom],
41da668aa1SThomas Huth  'test-qemu-opts': [],
42da668aa1SThomas Huth  'test-keyval': [testqapi],
43da668aa1SThomas Huth  'test-logging': [],
44da668aa1SThomas Huth  'test-uuid': [],
45da668aa1SThomas Huth  'ptimer-test': ['ptimer-test-stubs.c', meson.source_root() / 'hw/core/ptimer.c'],
46da668aa1SThomas Huth  'test-qapi-util': [],
47da668aa1SThomas Huth}
48da668aa1SThomas Huth
49da668aa1SThomas Huthif have_system or have_tools
50da668aa1SThomas Huth  tests += {
51da668aa1SThomas Huth    'test-qmp-event': [testqapi],
52da668aa1SThomas Huth  }
53da668aa1SThomas Huthendif
54da668aa1SThomas Huth
55da668aa1SThomas Huthif have_block
56da668aa1SThomas Huth  tests += {
57da668aa1SThomas Huth    'test-coroutine': [testblock],
58da668aa1SThomas Huth    'test-aio': [testblock],
59da668aa1SThomas Huth    'test-aio-multithread': [testblock],
60da668aa1SThomas Huth    'test-throttle': [testblock],
61da668aa1SThomas Huth    'test-thread-pool': [testblock],
62da668aa1SThomas Huth    'test-hbitmap': [testblock],
63da668aa1SThomas Huth    'test-bdrv-drain': [testblock],
64da668aa1SThomas Huth    'test-bdrv-graph-mod': [testblock],
65da668aa1SThomas Huth    'test-blockjob': [testblock],
66da668aa1SThomas Huth    'test-blockjob-txn': [testblock],
67da668aa1SThomas Huth    'test-block-backend': [testblock],
68da668aa1SThomas Huth    'test-block-iothread': [testblock],
69da668aa1SThomas Huth    'test-write-threshold': [testblock],
70da668aa1SThomas Huth    'test-crypto-hash': [crypto],
71da668aa1SThomas Huth    'test-crypto-hmac': [crypto],
72da668aa1SThomas Huth    'test-crypto-cipher': [crypto],
73da668aa1SThomas Huth    'test-crypto-secret': [crypto, keyutils],
74da668aa1SThomas Huth    'test-authz-simple': [authz],
75da668aa1SThomas Huth    'test-authz-list': [authz],
76da668aa1SThomas Huth    'test-authz-listfile': [authz],
77da668aa1SThomas Huth    'test-io-task': [testblock],
78da668aa1SThomas Huth    'test-io-channel-socket': ['socket-helpers.c', 'io-channel-helpers.c', io],
79da668aa1SThomas Huth    'test-io-channel-file': ['io-channel-helpers.c', io],
80da668aa1SThomas Huth    'test-io-channel-command': ['io-channel-helpers.c', io],
81da668aa1SThomas Huth    'test-io-channel-buffer': ['io-channel-helpers.c', io],
82da668aa1SThomas Huth    'test-crypto-ivgen': [io],
83da668aa1SThomas Huth    'test-crypto-afsplit': [io],
84da668aa1SThomas Huth    'test-crypto-block': [io],
85da668aa1SThomas Huth  }
86*57612511SPaolo Bonzini  if gnutls.found() and \
87da668aa1SThomas Huth     'CONFIG_TASN1' in config_host and \
88da668aa1SThomas Huth     'CONFIG_POSIX' in config_host
89da668aa1SThomas Huth    tests += {
90da668aa1SThomas Huth      'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
91da668aa1SThomas Huth                                   tasn1, crypto, gnutls],
92da668aa1SThomas Huth      'test-crypto-tlssession': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', 'crypto-tls-psk-helpers.c',
93da668aa1SThomas Huth                                 tasn1, crypto, gnutls],
94da668aa1SThomas Huth      'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
95da668aa1SThomas Huth                              tasn1, io, crypto, gnutls]}
96da668aa1SThomas Huth  endif
97da668aa1SThomas Huth  if 'CONFIG_AUTH_PAM' in config_host
98da668aa1SThomas Huth    tests += {'test-authz-pam': [authz]}
99da668aa1SThomas Huth  endif
100*57612511SPaolo Bonzini  if xts == 'private'
101da668aa1SThomas Huth    tests += {'test-crypto-xts': [crypto, io]}
102da668aa1SThomas Huth  endif
103da668aa1SThomas Huth  if 'CONFIG_POSIX' in config_host
104da668aa1SThomas Huth    tests += {'test-image-locking': [testblock]}
105da668aa1SThomas Huth  endif
106da668aa1SThomas Huth  if 'CONFIG_REPLICATION' in config_host
107da668aa1SThomas Huth    tests += {'test-replication': [testblock]}
108da668aa1SThomas Huth  endif
109*57612511SPaolo Bonzini  if nettle.found() or gcrypt.found()
110da668aa1SThomas Huth    tests += {'test-crypto-pbkdf': [io]}
111da668aa1SThomas Huth  endif
112da668aa1SThomas Huth  if 'CONFIG_EPOLL_CREATE1' in config_host
113da668aa1SThomas Huth    tests += {'test-fdmon-epoll': [testblock]}
114da668aa1SThomas Huth  endif
115da668aa1SThomas Huthendif
116da668aa1SThomas Huth
117da668aa1SThomas Huthif have_system
118da668aa1SThomas Huth  tests += {
119da668aa1SThomas Huth    'test-iov': [],
120da668aa1SThomas Huth    'test-qmp-cmds': [testqapi],
121da668aa1SThomas Huth    'test-xbzrle': [migration],
122da668aa1SThomas Huth    'test-timed-average': [],
123da668aa1SThomas Huth    'test-util-sockets': ['socket-helpers.c'],
124da668aa1SThomas Huth    'test-base64': [],
125da668aa1SThomas Huth    'test-bufferiszero': [],
126d3a0bb77SLukas Straub    'test-vmstate': [migration, io],
127d3a0bb77SLukas Straub    'test-yank': ['socket-helpers.c', qom, io, chardev]
128da668aa1SThomas Huth  }
129da668aa1SThomas Huth  if 'CONFIG_INOTIFY1' in config_host
130da668aa1SThomas Huth    tests += {'test-util-filemonitor': []}
131da668aa1SThomas Huth  endif
132da668aa1SThomas Huth
133da668aa1SThomas Huth  # Some tests: test-char, test-qdev-global-props, and test-qga,
134da668aa1SThomas Huth  # are not runnable under TSan due to a known issue.
135da668aa1SThomas Huth  # https://github.com/google/sanitizers/issues/1116
136da668aa1SThomas Huth  if 'CONFIG_TSAN' not in config_host
137da668aa1SThomas Huth    if 'CONFIG_POSIX' in config_host
138da668aa1SThomas Huth        tests += {
139da668aa1SThomas Huth          'test-char': ['socket-helpers.c', qom, io, chardev]
140da668aa1SThomas Huth        }
141da668aa1SThomas Huth    endif
142da668aa1SThomas Huth
143da668aa1SThomas Huth    tests += {
144da668aa1SThomas Huth      'test-qdev-global-props': [qom, hwcore, testqapi]
145da668aa1SThomas Huth    }
146da668aa1SThomas Huth  endif
147da668aa1SThomas Huthendif
148da668aa1SThomas Huth
149da668aa1SThomas Huthif 'CONFIG_TSAN' not in config_host and \
150da668aa1SThomas Huth   'CONFIG_GUEST_AGENT' in config_host and \
151da668aa1SThomas Huth   'CONFIG_LINUX' in config_host
152da668aa1SThomas Huth  tests += {'test-qga': ['../qtest/libqtest.c']}
153da668aa1SThomas Huth  test_deps += {'test-qga': qga}
154da668aa1SThomas Huthendif
155da668aa1SThomas Huth
156da668aa1SThomas Huthtest_env = environment()
157da668aa1SThomas Huthtest_env.set('G_TEST_SRCDIR', meson.current_source_dir())
158da668aa1SThomas Huthtest_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
159da668aa1SThomas Huth
160da668aa1SThomas Huthslow_tests = {
161da668aa1SThomas Huth  'test-crypto-tlscredsx509': 45,
162da668aa1SThomas Huth  'test-crypto-tlssession': 45
163da668aa1SThomas Huth}
164da668aa1SThomas Huth
165da668aa1SThomas Huthforeach test_name, extra: tests
166da668aa1SThomas Huth  src = [test_name + '.c']
167da668aa1SThomas Huth  deps = [qemuutil]
168da668aa1SThomas Huth  if extra.length() > 0
169da668aa1SThomas Huth    # use a sourceset to quickly separate sources and deps
170da668aa1SThomas Huth    test_ss = ss.source_set()
171da668aa1SThomas Huth    test_ss.add(extra)
172da668aa1SThomas Huth    src += test_ss.all_sources()
173da668aa1SThomas Huth    deps += test_ss.all_dependencies()
174da668aa1SThomas Huth  endif
175da668aa1SThomas Huth  exe = executable(test_name, src, genh, dependencies: deps)
176da668aa1SThomas Huth
177da668aa1SThomas Huth  test(test_name, exe,
178da668aa1SThomas Huth       depends: test_deps.get(test_name, []),
179da668aa1SThomas Huth       env: test_env,
180da668aa1SThomas Huth       args: ['--tap', '-k'],
181da668aa1SThomas Huth       protocol: 'tap',
182da668aa1SThomas Huth       timeout: slow_tests.get(test_name, 30),
183da668aa1SThomas Huth       priority: slow_tests.get(test_name, 30),
184da668aa1SThomas Huth       suite: ['unit'])
185da668aa1SThomas Huthendforeach
186