gitlab: add acceptance testing to system builds
[qemu.git] / tests / Makefile.include
1 # -*- Mode: makefile -*-
2
3 .PHONY: check-help
4 check-help:
5         @echo "Regression testing targets:"
6         @echo
7         @echo " $(MAKE) check                Run block, qapi-schema, unit, softfloat, qtest and decodetree tests"
8         @echo
9         @echo " $(MAKE) check-qtest-TARGET   Run qtest tests for given target"
10         @echo " $(MAKE) check-qtest          Run qtest tests"
11         @echo " $(MAKE) check-unit           Run qobject tests"
12         @echo " $(MAKE) check-speed          Run qobject speed tests"
13         @echo " $(MAKE) check-qapi-schema    Run QAPI schema tests"
14         @echo " $(MAKE) check-block          Run block tests"
15 ifeq ($(CONFIG_TCG),y)
16         @echo " $(MAKE) check-tcg            Run TCG tests"
17         @echo " $(MAKE) check-softfloat      Run FPU emulation tests"
18 endif
19         @echo " $(MAKE) check-acceptance     Run all acceptance (functional) tests"
20         @echo
21         @echo " $(MAKE) check-report.tap     Generates an aggregated TAP test report"
22         @echo " $(MAKE) check-venv           Creates a Python venv for tests"
23         @echo " $(MAKE) check-clean          Clean the tests and related data"
24         @echo
25         @echo " $(MAKE) get-vm-images        Downloads all images used by acceptance tests, according to configured targets (~350 MB each, 1.5 GB max)"
26         @echo
27         @echo
28         @echo "The variable SPEED can be set to control the gtester speed setting."
29         @echo "Default options are -k and (for $(MAKE) V=1) --verbose; they can be"
30         @echo "changed with variable GTESTER_OPTIONS."
31
32 ifneq ($(wildcard config-host.mak),)
33 export SRC_PATH
34
35 # TODO don't duplicate $(SRC_PATH)/Makefile's qapi-py here
36 qapi-py = $(SRC_PATH)/scripts/qapi/__init__.py \
37 $(SRC_PATH)/scripts/qapi/commands.py \
38 $(SRC_PATH)/scripts/qapi/common.py \
39 $(SRC_PATH)/scripts/qapi/doc.py \
40 $(SRC_PATH)/scripts/qapi/error.py \
41 $(SRC_PATH)/scripts/qapi/events.py \
42 $(SRC_PATH)/scripts/qapi/expr.py \
43 $(SRC_PATH)/scripts/qapi/gen.py \
44 $(SRC_PATH)/scripts/qapi/introspect.py \
45 $(SRC_PATH)/scripts/qapi/parser.py \
46 $(SRC_PATH)/scripts/qapi/schema.py \
47 $(SRC_PATH)/scripts/qapi/source.py \
48 $(SRC_PATH)/scripts/qapi/types.py \
49 $(SRC_PATH)/scripts/qapi/visit.py \
50 $(SRC_PATH)/scripts/qapi-gen.py
51
52 # Get the list of all supported sysemu targets
53 SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
54    $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
55
56 check-unit-y += tests/check-qdict$(EXESUF)
57 check-unit-y += tests/check-block-qdict$(EXESUF)
58 check-unit-y += tests/check-qnum$(EXESUF)
59 check-unit-y += tests/check-qstring$(EXESUF)
60 check-unit-y += tests/check-qlist$(EXESUF)
61 check-unit-y += tests/check-qnull$(EXESUF)
62 check-unit-y += tests/check-qobject$(EXESUF)
63 check-unit-y += tests/check-qjson$(EXESUF)
64 check-unit-y += tests/check-qlit$(EXESUF)
65 check-unit-y += tests/test-qobject-output-visitor$(EXESUF)
66 check-unit-y += tests/test-clone-visitor$(EXESUF)
67 check-unit-y += tests/test-qobject-input-visitor$(EXESUF)
68 check-unit-$(CONFIG_SOFTMMU) += tests/test-qmp-cmds$(EXESUF)
69 check-unit-y += tests/test-string-input-visitor$(EXESUF)
70 check-unit-y += tests/test-string-output-visitor$(EXESUF)
71 check-unit-y += tests/test-qmp-event$(EXESUF)
72 check-unit-y += tests/test-opts-visitor$(EXESUF)
73 check-unit-$(CONFIG_BLOCK) += tests/test-coroutine$(EXESUF)
74 check-unit-y += tests/test-visitor-serialization$(EXESUF)
75 check-unit-$(CONFIG_SOFTMMU) += tests/test-iov$(EXESUF)
76 check-unit-y += tests/test-bitmap$(EXESUF)
77 check-unit-$(CONFIG_BLOCK) += tests/test-aio$(EXESUF)
78 check-unit-$(CONFIG_BLOCK) += tests/test-aio-multithread$(EXESUF)
79 check-unit-$(CONFIG_BLOCK) += tests/test-throttle$(EXESUF)
80 check-unit-$(CONFIG_BLOCK) += tests/test-thread-pool$(EXESUF)
81 check-unit-$(CONFIG_BLOCK) += tests/test-hbitmap$(EXESUF)
82 check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-drain$(EXESUF)
83 check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-graph-mod$(EXESUF)
84 check-unit-$(CONFIG_BLOCK) += tests/test-blockjob$(EXESUF)
85 check-unit-$(CONFIG_BLOCK) += tests/test-blockjob-txn$(EXESUF)
86 check-unit-$(CONFIG_BLOCK) += tests/test-block-backend$(EXESUF)
87 check-unit-$(CONFIG_BLOCK) += tests/test-block-iothread$(EXESUF)
88 check-unit-$(CONFIG_BLOCK) += tests/test-image-locking$(EXESUF)
89 check-unit-y += tests/test-x86-cpuid$(EXESUF)
90 # all code tested by test-x86-cpuid is inside topology.h
91 ifeq ($(CONFIG_SOFTMMU),y)
92 check-unit-y += tests/test-xbzrle$(EXESUF)
93 check-unit-$(CONFIG_POSIX) += tests/test-vmstate$(EXESUF)
94 endif
95 check-unit-y += tests/test-cutils$(EXESUF)
96 check-unit-y += tests/test-shift128$(EXESUF)
97 check-unit-y += tests/test-mul64$(EXESUF)
98 check-unit-y += tests/test-int128$(EXESUF)
99 # all code tested by test-int128 is inside int128.h
100 check-unit-y += tests/rcutorture$(EXESUF)
101 check-unit-y += tests/test-rcu-list$(EXESUF)
102 check-unit-y += tests/test-rcu-simpleq$(EXESUF)
103 check-unit-y += tests/test-rcu-tailq$(EXESUF)
104 check-unit-y += tests/test-rcu-slist$(EXESUF)
105 check-unit-y += tests/test-qdist$(EXESUF)
106 check-unit-y += tests/test-qht$(EXESUF)
107 check-unit-y += tests/test-qht-par$(EXESUF)
108 check-unit-y += tests/test-bitops$(EXESUF)
109 check-unit-y += tests/test-bitcnt$(EXESUF)
110 check-unit-y += tests/check-qom-interface$(EXESUF)
111 check-unit-y += tests/check-qom-proplist$(EXESUF)
112 check-unit-y += tests/test-qemu-opts$(EXESUF)
113 check-unit-y += tests/test-keyval$(EXESUF)
114 check-unit-$(CONFIG_BLOCK) += tests/test-write-threshold$(EXESUF)
115 check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hash$(EXESUF)
116 check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hash$(EXESUF)
117 check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hmac$(EXESUF)
118 check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hmac$(EXESUF)
119 check-unit-$(CONFIG_BLOCK) += tests/test-crypto-cipher$(EXESUF)
120 check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-cipher$(EXESUF)
121 check-unit-$(CONFIG_BLOCK) += tests/test-crypto-secret$(EXESUF)
122 check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlscredsx509$(EXESUF)
123 check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlssession$(EXESUF)
124 ifndef CONFIG_TSAN
125 # Some tests: test-char, test-qdev-global-props, and test-qga,
126 # are not runnable under TSan due to a known issue.
127 # https://github.com/google/sanitizers/issues/1116
128 check-unit-$(CONFIG_SOFTMMU) += tests/test-char$(EXESUF)
129 check-unit-$(CONFIG_SOFTMMU) += tests/test-qdev-global-props$(EXESUF)
130 ifneq (,$(findstring qemu-ga,$(TOOLS)))
131 check-unit-$(call land,$(CONFIG_LINUX),$(CONFIG_VIRTIO_SERIAL)) += tests/test-qga$(EXESUF)
132 endif
133 endif
134 check-unit-$(CONFIG_SOFTMMU) += tests/test-timed-average$(EXESUF)
135 check-unit-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_INOTIFY1)) += tests/test-util-filemonitor$(EXESUF)
136 check-unit-$(CONFIG_SOFTMMU) += tests/test-util-sockets$(EXESUF)
137 check-unit-$(CONFIG_BLOCK) += tests/test-authz-simple$(EXESUF)
138 check-unit-$(CONFIG_BLOCK) += tests/test-authz-list$(EXESUF)
139 check-unit-$(CONFIG_BLOCK) += tests/test-authz-listfile$(EXESUF)
140 check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_AUTH_PAM)) += tests/test-authz-pam$(EXESUF)
141 check-unit-$(CONFIG_BLOCK) += tests/test-io-task$(EXESUF)
142 check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-socket$(EXESUF)
143 check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-file$(EXESUF)
144 check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-io-channel-tls$(EXESUF)
145 check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-command$(EXESUF)
146 check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-buffer$(EXESUF)
147 check-unit-$(CONFIG_SOFTMMU) += tests/test-base64$(EXESUF)
148 check-unit-$(call land,$(CONFIG_BLOCK),$(if $(CONFIG_NETTLE),y,$(CONFIG_GCRYPT))) += tests/test-crypto-pbkdf$(EXESUF)
149 check-unit-$(CONFIG_BLOCK) += tests/test-crypto-ivgen$(EXESUF)
150 check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-afsplit$(EXESUF)
151 check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_QEMU_PRIVATE_XTS)) += tests/test-crypto-xts$(EXESUF)
152 check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-block$(EXESUF)
153 check-unit-y += tests/test-logging$(EXESUF)
154 check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_REPLICATION)) += tests/test-replication$(EXESUF)
155 check-unit-$(CONFIG_SOFTMMU) += tests/test-bufferiszero$(EXESUF)
156 check-unit-y += tests/test-uuid$(EXESUF)
157 check-unit-y += tests/ptimer-test$(EXESUF)
158 check-unit-y += tests/test-qapi-util$(EXESUF)
159
160 check-block-$(call land,$(CONFIG_POSIX),$(CONFIG_SOFTMMU)) += tests/check-block.sh
161
162 qapi-schema += alternate-any.json
163 qapi-schema += alternate-array.json
164 qapi-schema += alternate-base.json
165 qapi-schema += alternate-branch-if-invalid.json
166 qapi-schema += alternate-clash.json
167 qapi-schema += alternate-conflict-dict.json
168 qapi-schema += alternate-conflict-enum-bool.json
169 qapi-schema += alternate-conflict-enum-int.json
170 qapi-schema += alternate-conflict-string.json
171 qapi-schema += alternate-conflict-bool-string.json
172 qapi-schema += alternate-conflict-num-string.json
173 qapi-schema += alternate-empty.json
174 qapi-schema += alternate-invalid-dict.json
175 qapi-schema += alternate-nested.json
176 qapi-schema += alternate-unknown.json
177 qapi-schema += args-alternate.json
178 qapi-schema += args-any.json
179 qapi-schema += args-array-empty.json
180 qapi-schema += args-array-unknown.json
181 qapi-schema += args-bad-boxed.json
182 qapi-schema += args-boxed-anon.json
183 qapi-schema += args-boxed-string.json
184 qapi-schema += args-int.json
185 qapi-schema += args-invalid.json
186 qapi-schema += args-member-array-bad.json
187 qapi-schema += args-member-case.json
188 qapi-schema += args-member-unknown.json
189 qapi-schema += args-name-clash.json
190 qapi-schema += args-union.json
191 qapi-schema += args-unknown.json
192 qapi-schema += bad-base.json
193 qapi-schema += bad-data.json
194 qapi-schema += bad-ident.json
195 qapi-schema += bad-if.json
196 qapi-schema += bad-if-empty.json
197 qapi-schema += bad-if-empty-list.json
198 qapi-schema += bad-if-list.json
199 qapi-schema += bad-type-bool.json
200 qapi-schema += bad-type-dict.json
201 qapi-schema += bad-type-int.json
202 qapi-schema += base-cycle-direct.json
203 qapi-schema += base-cycle-indirect.json
204 qapi-schema += command-int.json
205 qapi-schema += comments.json
206 qapi-schema += doc-bad-alternate-member.json
207 qapi-schema += doc-bad-boxed-command-arg.json
208 qapi-schema += doc-bad-command-arg.json
209 qapi-schema += doc-bad-enum-member.json
210 qapi-schema += doc-bad-event-arg.json
211 qapi-schema += doc-bad-feature.json
212 qapi-schema += doc-bad-section.json
213 qapi-schema += doc-bad-symbol.json
214 qapi-schema += doc-bad-union-member.json
215 qapi-schema += doc-before-include.json
216 qapi-schema += doc-before-pragma.json
217 qapi-schema += doc-duplicated-arg.json
218 qapi-schema += doc-duplicated-return.json
219 qapi-schema += doc-duplicated-since.json
220 qapi-schema += doc-empty-arg.json
221 qapi-schema += doc-empty-section.json
222 qapi-schema += doc-empty-symbol.json
223 qapi-schema += doc-good.json
224 qapi-schema += doc-interleaved-section.json
225 qapi-schema += doc-invalid-end.json
226 qapi-schema += doc-invalid-end2.json
227 qapi-schema += doc-invalid-return.json
228 qapi-schema += doc-invalid-section.json
229 qapi-schema += doc-invalid-start.json
230 qapi-schema += doc-missing-colon.json
231 qapi-schema += doc-missing-expr.json
232 qapi-schema += doc-missing-space.json
233 qapi-schema += doc-missing.json
234 qapi-schema += doc-no-symbol.json
235 qapi-schema += doc-undoc-feature.json
236 qapi-schema += double-type.json
237 qapi-schema += duplicate-key.json
238 qapi-schema += empty.json
239 qapi-schema += enum-bad-member.json
240 qapi-schema += enum-bad-name.json
241 qapi-schema += enum-bad-prefix.json
242 qapi-schema += enum-clash-member.json
243 qapi-schema += enum-dict-member-unknown.json
244 qapi-schema += enum-if-invalid.json
245 qapi-schema += enum-int-member.json
246 qapi-schema += enum-member-case.json
247 qapi-schema += enum-missing-data.json
248 qapi-schema += enum-wrong-data.json
249 qapi-schema += event-boxed-empty.json
250 qapi-schema += event-case.json
251 qapi-schema += event-member-invalid-dict.json
252 qapi-schema += event-nest-struct.json
253 qapi-schema += features-bad-type.json
254 qapi-schema += features-deprecated-type.json
255 qapi-schema += features-duplicate-name.json
256 qapi-schema += features-if-invalid.json
257 qapi-schema += features-missing-name.json
258 qapi-schema += features-name-bad-type.json
259 qapi-schema += features-no-list.json
260 qapi-schema += features-unknown-key.json
261 qapi-schema += flat-union-array-branch.json
262 qapi-schema += flat-union-bad-base.json
263 qapi-schema += flat-union-bad-discriminator.json
264 qapi-schema += flat-union-base-any.json
265 qapi-schema += flat-union-base-union.json
266 qapi-schema += flat-union-clash-member.json
267 qapi-schema += flat-union-discriminator-bad-name.json
268 qapi-schema += flat-union-empty.json
269 qapi-schema += flat-union-inline.json
270 qapi-schema += flat-union-inline-invalid-dict.json
271 qapi-schema += flat-union-int-branch.json
272 qapi-schema += flat-union-invalid-branch-key.json
273 qapi-schema += flat-union-invalid-discriminator.json
274 qapi-schema += flat-union-invalid-if-discriminator.json
275 qapi-schema += flat-union-no-base.json
276 qapi-schema += flat-union-optional-discriminator.json
277 qapi-schema += flat-union-string-discriminator.json
278 qapi-schema += funny-char.json
279 qapi-schema += funny-word.json
280 qapi-schema += ident-with-escape.json
281 qapi-schema += include-before-err.json
282 qapi-schema += include-cycle.json
283 qapi-schema += include-extra-junk.json
284 qapi-schema += include-nested-err.json
285 qapi-schema += include-no-file.json
286 qapi-schema += include-non-file.json
287 qapi-schema += include-repetition.json
288 qapi-schema += include-self-cycle.json
289 qapi-schema += include-simple.json
290 qapi-schema += indented-expr.json
291 qapi-schema += leading-comma-list.json
292 qapi-schema += leading-comma-object.json
293 qapi-schema += missing-colon.json
294 qapi-schema += missing-comma-list.json
295 qapi-schema += missing-comma-object.json
296 qapi-schema += missing-type.json
297 qapi-schema += nested-struct-data.json
298 qapi-schema += nested-struct-data-invalid-dict.json
299 qapi-schema += non-objects.json
300 qapi-schema += oob-test.json
301 qapi-schema += allow-preconfig-test.json
302 qapi-schema += pragma-doc-required-crap.json
303 qapi-schema += pragma-extra-junk.json
304 qapi-schema += pragma-name-case-whitelist-crap.json
305 qapi-schema += pragma-non-dict.json
306 qapi-schema += pragma-unknown.json
307 qapi-schema += pragma-returns-whitelist-crap.json
308 qapi-schema += qapi-schema-test.json
309 qapi-schema += quoted-structural-chars.json
310 qapi-schema += redefined-builtin.json
311 qapi-schema += redefined-command.json
312 qapi-schema += redefined-event.json
313 qapi-schema += redefined-type.json
314 qapi-schema += reserved-command-q.json
315 qapi-schema += reserved-enum-q.json
316 qapi-schema += reserved-member-has.json
317 qapi-schema += reserved-member-q.json
318 qapi-schema += reserved-member-u.json
319 qapi-schema += reserved-member-underscore.json
320 qapi-schema += reserved-type-kind.json
321 qapi-schema += reserved-type-list.json
322 qapi-schema += returns-alternate.json
323 qapi-schema += returns-array-bad.json
324 qapi-schema += returns-dict.json
325 qapi-schema += returns-unknown.json
326 qapi-schema += returns-whitelist.json
327 qapi-schema += string-code-point-31.json
328 qapi-schema += string-code-point-127.json
329 qapi-schema += struct-base-clash-deep.json
330 qapi-schema += struct-base-clash.json
331 qapi-schema += struct-data-invalid.json
332 qapi-schema += struct-member-if-invalid.json
333 qapi-schema += struct-member-invalid-dict.json
334 qapi-schema += struct-member-invalid.json
335 qapi-schema += trailing-comma-list.json
336 qapi-schema += trailing-comma-object.json
337 qapi-schema += type-bypass-bad-gen.json
338 qapi-schema += unclosed-list.json
339 qapi-schema += unclosed-object.json
340 qapi-schema += unclosed-string.json
341 qapi-schema += union-base-empty.json
342 qapi-schema += union-base-no-discriminator.json
343 qapi-schema += union-branch-case.json
344 qapi-schema += union-branch-if-invalid.json
345 qapi-schema += union-branch-invalid-dict.json
346 qapi-schema += union-clash-branches.json
347 qapi-schema += union-empty.json
348 qapi-schema += union-invalid-base.json
349 qapi-schema += union-optional-branch.json
350 qapi-schema += union-unknown.json
351 qapi-schema += unknown-escape.json
352 qapi-schema += unknown-expr-key.json
353
354
355 check-qapi-schema-y := $(addprefix tests/qapi-schema/, $(qapi-schema))
356
357 generated-files-y += tests/test-qapi-types.h
358 generated-files-y += tests/include/test-qapi-types-sub-module.h
359 generated-files-y += tests/test-qapi-types-sub-sub-module.h
360 generated-files-y += tests/test-qapi-visit.h
361 generated-files-y += tests/include/test-qapi-visit-sub-module.h
362 generated-files-y += tests/test-qapi-visit-sub-sub-module.h
363 generated-files-y += tests/test-qapi-commands.h
364 generated-files-y += tests/test-qapi-init-commands.h
365 generated-files-y += tests/include/test-qapi-commands-sub-module.h
366 generated-files-y += tests/test-qapi-commands-sub-sub-module.h
367 generated-files-y += tests/test-qapi-emit-events.h
368 generated-files-y += tests/test-qapi-events.h
369 generated-files-y += tests/include/test-qapi-events-sub-module.h
370 generated-files-y += tests/test-qapi-events-sub-sub-module.h
371 generated-files-y += tests/test-qapi-introspect.h
372
373 QEMU_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
374
375
376 # Deps that are common to various different sets of tests below
377 test-util-obj-y = libqemuutil.a
378 test-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
379 test-qapi-obj-y = tests/test-qapi-types.o \
380         tests/include/test-qapi-types-sub-module.o \
381         tests/test-qapi-types-sub-sub-module.o \
382         tests/test-qapi-visit.o \
383         tests/include/test-qapi-visit-sub-module.o \
384         tests/test-qapi-visit-sub-sub-module.o \
385         tests/test-qapi-introspect.o \
386         $(test-qom-obj-y)
387 benchmark-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
388 test-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
389 test-io-obj-$(CONFIG_BLOCK) = $(io-obj-y) $(test-crypto-obj-y)
390 test-authz-obj-$(CONFIG_BLOCK) = $(test-qom-obj-y) $(authz-obj-y)
391 test-block-obj-$(CONFIG_BLOCK) = $(block-obj-y) $(test-io-obj-y) tests/iothread.o
392
393 tests/check-qnum$(EXESUF): tests/check-qnum.o $(test-util-obj-y)
394 tests/check-qstring$(EXESUF): tests/check-qstring.o $(test-util-obj-y)
395 tests/check-qdict$(EXESUF): tests/check-qdict.o $(test-util-obj-y)
396 tests/check-block-qdict$(EXESUF): tests/check-block-qdict.o $(test-util-obj-y)
397 tests/check-qlist$(EXESUF): tests/check-qlist.o $(test-util-obj-y)
398 tests/check-qnull$(EXESUF): tests/check-qnull.o $(test-util-obj-y)
399 tests/check-qobject$(EXESUF): tests/check-qobject.o $(test-util-obj-y)
400 tests/check-qjson$(EXESUF): tests/check-qjson.o $(test-util-obj-y)
401 tests/check-qlit$(EXESUF): tests/check-qlit.o $(test-util-obj-y)
402 tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(test-qom-obj-y)
403 tests/check-qom-proplist$(EXESUF): tests/check-qom-proplist.o $(test-qom-obj-y)
404
405 tests/test-char$(EXESUF): tests/test-char.o $(test-util-obj-y) $(test-io-obj-y) $(chardev-obj-y) tests/socket-helpers.o
406 tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(test-block-obj-y)
407 tests/test-aio$(EXESUF): tests/test-aio.o $(test-block-obj-y)
408 tests/test-aio-multithread$(EXESUF): tests/test-aio-multithread.o $(test-block-obj-y)
409 tests/test-throttle$(EXESUF): tests/test-throttle.o $(test-block-obj-y)
410 tests/test-bdrv-drain$(EXESUF): tests/test-bdrv-drain.o $(test-block-obj-y) $(test-util-obj-y)
411 tests/test-bdrv-graph-mod$(EXESUF): tests/test-bdrv-graph-mod.o $(test-block-obj-y) $(test-util-obj-y)
412 tests/test-blockjob$(EXESUF): tests/test-blockjob.o $(test-block-obj-y) $(test-util-obj-y)
413 tests/test-blockjob-txn$(EXESUF): tests/test-blockjob-txn.o $(test-block-obj-y) $(test-util-obj-y)
414 tests/test-block-backend$(EXESUF): tests/test-block-backend.o $(test-block-obj-y) $(test-util-obj-y)
415 tests/test-block-iothread$(EXESUF): tests/test-block-iothread.o $(test-block-obj-y) $(test-util-obj-y)
416 tests/test-image-locking$(EXESUF): tests/test-image-locking.o $(test-block-obj-y) $(test-util-obj-y)
417 tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj-y)
418 tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y)
419 tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(test-crypto-obj-y)
420 tests/test-bitmap$(EXESUF): tests/test-bitmap.o $(test-util-obj-y)
421 tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
422 tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-util-obj-y)
423 tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o $(test-util-obj-y)
424 tests/test-int128$(EXESUF): tests/test-int128.o
425 tests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y)
426 tests/test-rcu-list$(EXESUF): tests/test-rcu-list.o $(test-util-obj-y)
427 tests/test-rcu-simpleq$(EXESUF): tests/test-rcu-simpleq.o $(test-util-obj-y)
428 tests/test-rcu-tailq$(EXESUF): tests/test-rcu-tailq.o $(test-util-obj-y)
429 tests/test-rcu-slist$(EXESUF): tests/test-rcu-slist.o $(test-util-obj-y)
430 tests/test-qdist$(EXESUF): tests/test-qdist.o $(test-util-obj-y)
431 tests/test-qht$(EXESUF): tests/test-qht.o $(test-util-obj-y)
432 tests/test-qht-par$(EXESUF): tests/test-qht-par.o tests/qht-bench$(EXESUF) $(test-util-obj-y)
433 tests/qht-bench$(EXESUF): tests/qht-bench.o $(test-util-obj-y)
434 tests/test-bufferiszero$(EXESUF): tests/test-bufferiszero.o $(test-util-obj-y)
435 tests/atomic_add-bench$(EXESUF): tests/atomic_add-bench.o $(test-util-obj-y)
436 tests/atomic64-bench$(EXESUF): tests/atomic64-bench.o $(test-util-obj-y)
437
438 tests/fp/%:
439         $(MAKE) -C $(dir $@) $(notdir $@)
440
441 tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
442         hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\
443         hw/core/bus.o \
444         hw/core/resettable.o \
445         hw/core/irq.o \
446         hw/core/fw-path-provider.o \
447         hw/core/reset.o \
448         hw/core/vmstate-if.o \
449         hw/core/clock.o hw/core/qdev-clock.o \
450         $(test-qapi-obj-y)
451 tests/test-vmstate$(EXESUF): tests/test-vmstate.o \
452         migration/vmstate.o migration/vmstate-types.o migration/qemu-file.o \
453         migration/qemu-file-channel.o migration/qjson.o \
454         $(test-io-obj-y)
455 tests/test-timed-average$(EXESUF): tests/test-timed-average.o $(test-util-obj-y)
456 tests/test-base64$(EXESUF): tests/test-base64.o $(test-util-obj-y)
457 tests/ptimer-test$(EXESUF): tests/ptimer-test.o tests/ptimer-test-stubs.o hw/core/ptimer.o
458 tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y)
459 tests/test-keyval$(EXESUF): tests/test-keyval.o $(test-util-obj-y) $(test-qapi-obj-y)
460 tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-block-obj-y)
461 tests/test-uuid$(EXESUF): tests/test-uuid.o $(test-util-obj-y)
462 tests/test-qapi-util$(EXESUF): tests/test-qapi-util.o $(test-util-obj-y)
463
464 tests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y)
465
466 tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
467         $(test-block-obj-y)
468
469 tests/test-qapi-types.c tests/test-qapi-types.h \
470 tests/include/test-qapi-types-sub-module.c \
471 tests/include/test-qapi-types-sub-module.h \
472 tests/test-qapi-types-sub-sub-module.c \
473 tests/test-qapi-types-sub-sub-module.h \
474 tests/test-qapi-visit.c tests/test-qapi-visit.h \
475 tests/include/test-qapi-visit-sub-module.c \
476 tests/include/test-qapi-visit-sub-module.h \
477 tests/test-qapi-visit-sub-sub-module.c \
478 tests/test-qapi-visit-sub-sub-module.h \
479 tests/test-qapi-commands.h tests/test-qapi-commands.c \
480 tests/include/test-qapi-commands-sub-module.h \
481 tests/include/test-qapi-commands-sub-module.c \
482 tests/test-qapi-commands-sub-sub-module.h \
483 tests/test-qapi-commands-sub-sub-module.c \
484 tests/test-qapi-emit-events.c tests/test-qapi-emit-events.h \
485 tests/test-qapi-events.c tests/test-qapi-events.h \
486 tests/test-qapi-init-commands.c \
487 tests/test-qapi-init-commands.h \
488 tests/include/test-qapi-events-sub-module.c \
489 tests/include/test-qapi-events-sub-module.h \
490 tests/test-qapi-events-sub-sub-module.c \
491 tests/test-qapi-events-sub-sub-module.h \
492 tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
493 tests/test-qapi-gen-timestamp ;
494 tests/test-qapi-gen-timestamp: \
495                 $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json \
496                 $(SRC_PATH)/tests/qapi-schema/include/sub-module.json \
497                 $(SRC_PATH)/tests/qapi-schema/sub-sub-module.json \
498                 $(qapi-py)
499         $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
500                 -o tests -p "test-" $<, \
501                 "GEN","$(@:%-timestamp=%)")
502         @rm -f tests/test-qapi-doc.texi
503         @>$@
504
505 tests/qapi-schema/doc-good.test.texi: $(SRC_PATH)/tests/qapi-schema/doc-good.json $(qapi-py)
506         $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
507                 -o tests/qapi-schema -p "doc-good-" $<, \
508                 "GEN","$@")
509         @mv tests/qapi-schema/doc-good-qapi-doc.texi $@
510         @rm -f tests/qapi-schema/doc-good-qapi-*.[ch] tests/qapi-schema/doc-good-qmp-*.[ch]
511
512 tests/qtest/dbus-vmstate1.h tests/qtest/dbus-vmstate1.c: tests/qtest/dbus-vmstate1-gen-timestamp ;
513 tests/qtest/dbus-vmstate1-gen-timestamp: $(SRC_PATH)/tests/qtest/dbus-vmstate1.xml
514         $(call quiet-command,$(GDBUS_CODEGEN) $< \
515                 --interface-prefix org.qemu --generate-c-code tests/qtest/dbus-vmstate1, \
516                 "GEN","$(@:%-timestamp=%)")
517         @>$@
518
519 tests/qtest/dbus-vmstate-test.o-cflags := -DSRCDIR="$(SRC_PATH)"
520 tests/qtest/dbus-vmstate1.o-cflags := $(GIO_CFLAGS)
521 tests/qtest/dbus-vmstate1.o-libs := $(GIO_LIBS)
522
523 tests/qtest/dbus-vmstate-test.o: tests/qtest/dbus-vmstate1.h
524
525 tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
526 tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
527 tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y) tests/test-qapi-emit-events.o tests/test-qapi-events.o
528 tests/test-qobject-output-visitor$(EXESUF): tests/test-qobject-output-visitor.o $(test-qapi-obj-y)
529 tests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-obj-y)
530 tests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visitor.o $(test-qapi-obj-y)
531 tests/test-qmp-cmds$(EXESUF): tests/test-qmp-cmds.o tests/test-qapi-commands.o tests/test-qapi-init-commands.o $(test-qapi-obj-y)
532 tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
533 tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y)
534
535 tests/test-shift128$(EXESUF): tests/test-shift128.o $(test-util-obj-y)
536 tests/test-mul64$(EXESUF): tests/test-mul64.o $(test-util-obj-y)
537 tests/test-bitops$(EXESUF): tests/test-bitops.o $(test-util-obj-y)
538 tests/test-bitcnt$(EXESUF): tests/test-bitcnt.o $(test-util-obj-y)
539 tests/test-crypto-hash$(EXESUF): tests/test-crypto-hash.o $(test-crypto-obj-y)
540 tests/benchmark-crypto-hash$(EXESUF): tests/benchmark-crypto-hash.o $(test-crypto-obj-y)
541 tests/test-crypto-hmac$(EXESUF): tests/test-crypto-hmac.o $(test-crypto-obj-y)
542 tests/benchmark-crypto-hmac$(EXESUF): tests/benchmark-crypto-hmac.o $(test-crypto-obj-y)
543 tests/test-crypto-cipher$(EXESUF): tests/test-crypto-cipher.o $(test-crypto-obj-y)
544 tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-crypto-obj-y)
545 tests/test-crypto-secret$(EXESUF): tests/test-crypto-secret.o $(test-crypto-obj-y)
546 tests/test-crypto-xts$(EXESUF): tests/test-crypto-xts.o $(test-crypto-obj-y)
547
548 ifeq ($(CONFIG_TEST_SECRET_KEYRING),y)
549 tests/test-crypto-secret.o-libs := -lkeyutils
550 endif
551
552 tests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS)
553 tests/crypto-tls-x509-helpers.o-libs := $(TASN1_LIBS)
554 tests/pkix_asn1_tab.o-cflags := $(TASN1_CFLAGS)
555
556 tests/test-crypto-tlscredsx509.o-cflags := $(TASN1_CFLAGS)
557 tests/test-crypto-tlscredsx509$(EXESUF): tests/test-crypto-tlscredsx509.o \
558         tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o $(test-crypto-obj-y)
559
560 tests/test-crypto-tlssession.o-cflags := $(TASN1_CFLAGS)
561 tests/test-crypto-tlssession$(EXESUF): tests/test-crypto-tlssession.o \
562         tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
563         tests/crypto-tls-psk-helpers.o \
564         $(test-crypto-obj-y)
565 tests/test-util-filemonitor$(EXESUF): tests/test-util-filemonitor.o \
566         $(test-util-obj-y)
567 tests/test-util-sockets$(EXESUF): tests/test-util-sockets.o \
568         tests/socket-helpers.o $(test-util-obj-y)
569 tests/test-authz-simple$(EXESUF): tests/test-authz-simple.o $(test-authz-obj-y)
570 tests/test-authz-list$(EXESUF): tests/test-authz-list.o $(test-authz-obj-y)
571 tests/test-authz-listfile$(EXESUF): tests/test-authz-listfile.o $(test-authz-obj-y)
572 tests/test-authz-pam$(EXESUF): tests/test-authz-pam.o $(test-authz-obj-y)
573 tests/test-io-task$(EXESUF): tests/test-io-task.o $(test-io-obj-y)
574 tests/test-io-channel-socket$(EXESUF): tests/test-io-channel-socket.o \
575         tests/io-channel-helpers.o tests/socket-helpers.o $(test-io-obj-y)
576 tests/test-io-channel-file$(EXESUF): tests/test-io-channel-file.o \
577         tests/io-channel-helpers.o $(test-io-obj-y)
578 tests/test-io-channel-tls$(EXESUF): tests/test-io-channel-tls.o \
579         tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
580         tests/io-channel-helpers.o $(test-io-obj-y)
581 tests/test-io-channel-command$(EXESUF): tests/test-io-channel-command.o \
582         tests/io-channel-helpers.o $(test-io-obj-y)
583 tests/test-io-channel-buffer$(EXESUF): tests/test-io-channel-buffer.o \
584         tests/io-channel-helpers.o $(test-io-obj-y)
585 tests/test-crypto-pbkdf$(EXESUF): tests/test-crypto-pbkdf.o $(test-crypto-obj-y)
586 tests/test-crypto-ivgen$(EXESUF): tests/test-crypto-ivgen.o $(test-crypto-obj-y)
587 tests/test-crypto-afsplit$(EXESUF): tests/test-crypto-afsplit.o $(test-crypto-obj-y)
588 tests/test-crypto-block$(EXESUF): tests/test-crypto-block.o $(test-crypto-obj-y)
589
590 tests/migration/stress$(EXESUF): tests/migration/stress.o
591         $(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
592
593 INITRD_WORK_DIR=tests/migration/initrd
594
595 tests/migration/initrd-stress.img: tests/migration/stress$(EXESUF)
596         mkdir -p $(INITRD_WORK_DIR)
597         cp $< $(INITRD_WORK_DIR)/init
598         (cd $(INITRD_WORK_DIR) && (find | cpio --quiet -o -H newc | gzip -9)) > $@
599         rm $(INITRD_WORK_DIR)/init
600         rmdir $(INITRD_WORK_DIR)
601
602 include $(SRC_PATH)/tests/qtest/Makefile.include
603
604 tests/test-qga$(EXESUF): qemu-ga$(EXESUF)
605 tests/test-qga$(EXESUF): tests/test-qga.o $(qtest-obj-y)
606 tests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o $(test-util-obj-y) libvhost-user.a
607 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
608
609 SPEED = quick
610
611 # gtester tests, possibly with verbose output
612 # do_test_tap runs all tests, even if some of them fail, while do_test_human
613 # stops at the first failure unless -k is given on the command line
614
615 define do_test_human_k
616         $(quiet-@)rc=0; $(foreach COMMAND, $1, \
617           $(call quiet-command-run, \
618             export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
619               $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
620               | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" $(if $(V),, --show-failures-only) \
621               || rc=$$?;, "TEST", "$@: $(COMMAND)")) exit $$rc
622 endef
623 define do_test_human_no_k
624         $(foreach COMMAND, $1, \
625           $(call quiet-command, \
626             MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2 \
627               $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
628               | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" $(if $(V),, --show-failures-only), \
629               "TEST", "$@: $(COMMAND)")
630 )
631 endef
632 do_test_human = \
633         $(if $(findstring k, $(MAKEFLAGS)), $(do_test_human_k), $(do_test_human_no_k))
634
635 define do_test_tap
636         $(call quiet-command, \
637           { export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
638             $(foreach COMMAND, $1, \
639               $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
640               | sed "s/^[a-z][a-z]* [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \
641               | ./scripts/tap-merge.pl | tee "$@" \
642               | ./scripts/tap-driver.pl $(if $(V),, --show-failures-only), \
643           "TAP","$@")
644 endef
645
646 .PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
647 $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: %-softmmu/all $(check-qtest-y)
648         $(call do_test_human,$(check-qtest-$*-y:%=tests/qtest/%$(EXESUF)) $(check-qtest-generic-y:%=tests/qtest/%$(EXESUF)), \
649           QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
650           QTEST_QEMU_IMG=qemu-img$(EXESUF))
651
652 check-unit: $(check-unit-y)
653         $(call do_test_human, $^)
654
655 check-speed: $(check-speed-y)
656         $(call do_test_human, $^)
657
658 # gtester tests with TAP output
659
660 $(patsubst %, check-report-qtest-%.tap, $(QTEST_TARGETS)): check-report-qtest-%.tap: %-softmmu/all $(check-qtest-y)
661         $(call do_test_tap, $(check-qtest-$*-y:%=tests/qtest/%$(EXESUF)) $(check-qtest-generic-y:%=tests/qtest/%$(EXESUF)), \
662           QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
663           QTEST_QEMU_IMG=qemu-img$(EXESUF))
664
665 check-report-unit.tap: $(check-unit-y)
666         $(call do_test_tap,$^)
667
668 # Reports and overall runs
669
670 check-report.tap: $(patsubst %,check-report-qtest-%.tap, $(QTEST_TARGETS)) check-report-unit.tap
671         $(call quiet-command, cat $^ | scripts/tap-merge.pl >$@,"GEN","$@")
672
673 # FPU Emulation tests (aka softfloat)
674 #
675 # As we still have some places that need fixing the rules are a little
676 # more complex than they need to be and have to override some of the
677 # generic Makefile expansions. Once we are cleanly passing all
678 # the tests we can simplify the make syntax.
679
680 FP_TEST_BIN=$(BUILD_DIR)/tests/fp/fp-test
681
682 # the build dir is created by configure
683 .PHONY: $(FP_TEST_BIN)
684 $(FP_TEST_BIN): config-host.h $(test-util-obj-y)
685         $(call quiet-command, \
686                 $(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" $(notdir $@), \
687                  "BUILD", "$(notdir $@)")
688
689 # The full test suite can take a bit of time, default to a quick run
690 # "-l 2 -r all" can take more than a day for some operations and is best
691 # run manually
692 FP_TL=-l 1 -r all
693
694 # $1 = tests, $2 = description, $3 = test flags
695 test-softfloat = $(call quiet-command, \
696                         cd $(BUILD_DIR)/tests/fp && \
697                         ./fp-test -s $(if $3,$3,$(FP_TL)) $1 > $2.out 2>&1 || \
698                         (cat $2.out && exit 1;), \
699                         "FLOAT TEST", $2)
700
701 # Conversion Routines: Float to Float
702 # FIXME: f32_to_f128 (broken), f64_to_f128 (broken)
703 # FIXME: f128_to_f32(broken), f128_to_f64 (broken)
704 # FIXME: f128_to_extF80 (broken)
705 check-softfloat-conv-f2f: $(FP_TEST_BIN)
706         $(call test-softfloat, \
707                 f16_to_f32 f16_to_f64 \
708                 f16_to_extF80 f16_to_f128 \
709                 f32_to_f16 f32_to_f64 \
710                 f32_to_extF80 \
711                 f64_to_f16 f64_to_f32 \
712                 extF80_to_f16 extF80_to_f32 \
713                 extF80_to_f64 extF80_to_f128 \
714                 f128_to_f16, \
715                 float-to-float)
716
717 # Conversion Routines: Int and Uint to Float
718 # FIXME: i32_to_extF80 (broken), i64_to_extF80 (broken)
719 #        ui32_to_f128 (not implemented)
720 check-softfloat-conv-to-float: $(FP_TEST_BIN)
721         $(call test-softfloat, \
722                 i32_to_f16 i64_to_f16 \
723                 i32_to_f32 i64_to_f32 \
724                 i32_to_f64 i64_to_f64 \
725                 i32_to_f128 i64_to_f128, int-to-float)
726         $(call test-softfloat, \
727                 ui32_to_f16 ui64_to_f16 \
728                 ui32_to_f32 ui64_to_f32 \
729                 ui32_to_f64 ui64_to_f64 \
730                 ui32_to_extF80 ui64_to_extF80 \
731                 ui64_to_f128, uint-to-float)
732
733 # Conversion Routines: Float to integers
734 # FIXME: extF80_roundToInt (broken)
735 check-softfloat-conv-to-int: $(FP_TEST_BIN)
736         $(call test-softfloat, \
737                 f16_to_i32 f16_to_i32_r_minMag \
738                 f32_to_i32 f32_to_i32_r_minMag \
739                 f64_to_i32 f64_to_i32_r_minMag \
740                 extF80_to_i32 extF80_to_i32_r_minMag \
741                 f128_to_i32 f128_to_i32_r_minMag \
742                 f16_to_i64 f16_to_i64_r_minMag \
743                 f32_to_i64 f32_to_i64_r_minMag \
744                 f64_to_i64 f64_to_i64_r_minMag \
745                 extF80_to_i64 extF80_to_i64_r_minMag \
746                 f128_to_i64 f128_to_i64_r_minMag, \
747                 float-to-int)
748         $(call test-softfloat, \
749                 f16_to_ui32 f16_to_ui32_r_minMag \
750                 f32_to_ui32 f32_to_ui32_r_minMag \
751                 f64_to_ui32 f64_to_ui32_r_minMag \
752                 extF80_to_ui32 extF80_to_ui32_r_minMag \
753                 f128_to_ui32 f128_to_ui32_r_minMag \
754                 f16_to_ui64 f16_to_ui64_r_minMag \
755                 f32_to_ui64 f32_to_ui64_r_minMag \
756                 f64_to_ui64 f64_to_ui64_r_minMag \
757                 extF80_to_ui64 extF80_to_ui64_r_minMag \
758                 f128_to_ui64 f128_to_ui64_r_minMag, \
759                 float-to-uint)
760         $(call test-softfloat, \
761                 f16_roundToInt f32_roundToInt \
762                 f64_roundToInt f128_roundToInt, \
763                 round-to-integer)
764
765 .PHONY: check-softfloat-conv
766 check-softfloat-conv: check-softfloat-conv-f2f
767 check-softfloat-conv: check-softfloat-conv-to-float
768 check-softfloat-conv: check-softfloat-conv-to-int
769
770 # Generic rule for all float operations
771 #
772 # Some patterns are overridden due to broken or missing tests.
773 # Hopefully these can be removed over time.
774
775 check-softfloat-%: $(FP_TEST_BIN)
776         $(call test-softfloat, f16_$* f32_$* f64_$* extF80_$* f128_$*, $*)
777
778 # Float Compare routines
779 SF_COMPARE_OPS=eq eq_signaling le le_quiet lt_quiet
780 SF_COMPARE_RULES=$(patsubst %,check-softfloat-%, $(SF_COMPARE_OPS))
781
782 # FIXME: extF80_lt_quiet (broken)
783 check-softfloat-lt_quiet: $(FP_TEST_BIN)
784         $(call test-softfloat,                          \
785                 f16_lt_quiet f32_lt_quiet f64_lt_quiet  \
786                 f128_lt_quiet,                          \
787                 lt_quiet)
788
789 .PHONY: check-softfloat-compare
790 check-softfloat-compare: $(SF_COMPARE_RULES)
791
792 # Math Operations
793
794 # FIXME: extF80_mulAdd (missing)
795 check-softfloat-mulAdd: $(FP_TEST_BIN)
796         $(call test-softfloat, \
797                 f16_mulAdd f32_mulAdd f64_mulAdd f128_mulAdd, \
798                 mulAdd,-l 1)
799
800 # FIXME: extF80_rem (broken)
801 check-softfloat-rem: $(FP_TEST_BIN)
802         $(call test-softfloat, \
803                 f16_rem f32_rem f64_rem f128_rem, \
804                 rem)
805
806 SF_MATH_OPS=add sub mul mulAdd div rem sqrt
807 SF_MATH_RULES=$(patsubst %,check-softfloat-%, $(SF_MATH_OPS))
808
809 .PHONY: check-softfloat-ops
810 check-softfloat-ops: $(SF_MATH_RULES)
811
812 # Finally a generic rule to test all of softfoat. If TCG isnt't
813 # enabled we define a null operation which skips the tests.
814
815 .PHONY: check-softfloat
816 ifeq ($(CONFIG_TCG),y)
817 check-softfloat: check-softfloat-conv check-softfloat-compare check-softfloat-ops
818 else
819 check-softfloat:
820         $(call quiet-command, /bin/true, "FLOAT TEST", \
821                 "SKIPPED for non-TCG builds")
822 endif
823
824 # Plugins
825 ifeq ($(CONFIG_PLUGIN),y)
826 .PHONY: plugins
827 plugins:
828         $(call quiet-command,\
829                 $(MAKE) $(SUBDIR_MAKEFLAGS) -C tests/plugin V="$(V)", \
830                 "BUILD", "plugins")
831 endif
832
833 # Per guest TCG tests
834
835 BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS))
836 CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TARGET_DIRS))
837 RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TARGET_DIRS))
838
839 # Probe for the Docker Builds needed for each build
840 $(foreach PROBE_TARGET,$(TARGET_DIRS),                          \
841         $(eval -include $(SRC_PATH)/tests/tcg/Makefile.prereqs))
842
843 build-tcg-tests-%: $(if $(CONFIG_PLUGIN),plugins)
844         $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
845                 -f $(SRC_PATH)/tests/tcg/Makefile.qemu \
846                 SRC_PATH=$(SRC_PATH) \
847                 V="$(V)" TARGET="$*" guest-tests, \
848                 "BUILD", "TCG tests for $*")
849
850 run-tcg-tests-%: build-tcg-tests-% %/all
851         $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
852                 -f $(SRC_PATH)/tests/tcg/Makefile.qemu \
853                 SRC_PATH=$(SRC_PATH) SPEED="$(SPEED)" \
854                 V="$(V)" TARGET="$*" run-guest-tests, \
855                 "RUN", "TCG tests for $*")
856
857 clean-tcg-tests-%:
858         $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
859                 -f $(SRC_PATH)/tests/tcg/Makefile.qemu \
860                 SRC_PATH=$(SRC_PATH) TARGET="$*" clean-guest-tests, \
861                 "CLEAN", "TCG tests for $*")
862
863 .PHONY: build-tcg
864 build-tcg: $(BUILD_TCG_TARGET_RULES)
865
866 .PHONY: check-tcg
867 check-tcg: $(RUN_TCG_TARGET_RULES)
868
869 .PHONY: clean-tcg
870 clean-tcg: $(CLEAN_TCG_TARGET_RULES)
871
872 # Other tests
873
874 QEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
875
876 .PHONY: check-tests/check-block.sh
877 check-tests/check-block.sh: tests/check-block.sh qemu-img$(EXESUF) \
878                 qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
879                 $(patsubst %,%/all,$(filter %-softmmu,$(TARGET_DIRS)))
880         @$<
881
882 .PHONY: check-tests/qapi-schema/frontend
883 check-tests/qapi-schema/frontend: $(addprefix $(SRC_PATH)/, $(check-qapi-schema-y))
884         $(call quiet-command, PYTHONPATH=$(SRC_PATH)/scripts \
885           PYTHONIOENCODING=utf-8 $(PYTHON) $(SRC_PATH)/tests/qapi-schema/test-qapi.py $^, \
886           TEST, check-qapi-schema)
887
888 .PHONY: check-tests/qapi-schema/doc-good.texi
889 check-tests/qapi-schema/doc-good.texi: tests/qapi-schema/doc-good.test.texi
890         @diff -u $(SRC_PATH)/tests/qapi-schema/doc-good.texi $<
891
892 .PHONY: check-decodetree
893 check-decodetree:
894         $(call quiet-command, \
895           cd $(SRC_PATH)/tests/decode && \
896           ./check.sh "$(PYTHON)" "$(SRC_PATH)/scripts/decodetree.py", \
897           TEST, decodetree.py)
898
899 # Python venv for running tests
900
901 .PHONY: check-venv check-acceptance
902
903 TESTS_VENV_DIR=$(BUILD_DIR)/tests/venv
904 TESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt
905 TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
906 # Controls the output generated by Avocado when running tests.
907 # Any number of command separated loggers are accepted.  For more
908 # information please refer to "avocado --help".
909 AVOCADO_SHOW=app
910 AVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGET_DIRS)))
911
912 $(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
913         $(call quiet-command, \
914             $(PYTHON) -m venv --system-site-packages $@, \
915             VENV, $@)
916         $(call quiet-command, \
917             $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
918             PIP, $(TESTS_VENV_REQ))
919         $(call quiet-command, touch $@)
920
921 $(TESTS_RESULTS_DIR):
922         $(call quiet-command, mkdir -p $@, \
923             MKDIR, $@)
924
925 check-venv: $(TESTS_VENV_DIR)
926
927 FEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(TARGETS))
928 FEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x
929 FEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES))
930
931 # download one specific Fedora 31 image
932 get-vm-image-fedora-31-%: check-venv
933         $(call quiet-command, \
934              $(TESTS_VENV_DIR)/bin/python -m avocado vmimage get \
935              --distro=fedora --distro-version=31 --arch=$*, \
936         "AVOCADO", "Downloading acceptance tests VM image for $*")
937
938 # download all vm images, according to defined targets
939 get-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD))
940
941 check-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images
942         $(call quiet-command, \
943             $(TESTS_VENV_DIR)/bin/python -m avocado \
944             --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
945             --filter-by-tags-include-empty --filter-by-tags-include-empty-key \
946             $(AVOCADO_TAGS) \
947             $(if $(GITLAB_CI),,--failfast=on) tests/acceptance, \
948             "AVOCADO", "tests/acceptance")
949
950 # Consolidated targets
951
952 .PHONY: check-block check-qapi-schema check-qtest check-unit check check-clean get-vm-images
953 check-qapi-schema: check-tests/qapi-schema/frontend check-tests/qapi-schema/doc-good.texi
954 check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
955 ifeq ($(CONFIG_TOOLS),y)
956 check-block: $(patsubst %,check-%, $(check-block-y))
957 endif
958 check: check-block check-qapi-schema check-unit check-softfloat check-qtest check-decodetree
959 check-clean:
960         rm -rf $(check-unit-y) tests/*.o tests/*/*.o $(QEMU_IOTESTS_HELPERS-y)
961         rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y:%=tests/qtest/%$(EXESUF))) $(check-qtest-generic-y:%=tests/qtest/%$(EXESUF)))
962         rm -f tests/test-qapi-gen-timestamp
963         rm -f tests/qtest/dbus-vmstate1-gen-timestamp
964         rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
965
966 clean: check-clean
967
968 # Build the help program automatically
969
970 all: $(QEMU_IOTESTS_HELPERS-y)
971
972 -include $(wildcard tests/*.d)
973 -include $(wildcard tests/qtest/*.d)
974 -include $(wildcard tests/qtest/libqos/*.d)
975
976 endif