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