xref: /openbmc/qemu/tests/Makefile.include (revision c92a3097)
13b8593eeSMarkus Armbruster# -*- Mode: makefile -*-
2e45eaef9SFam Zheng
3e45eaef9SFam Zheng.PHONY: check-help
4e45eaef9SFam Zhengcheck-help:
5e45eaef9SFam Zheng	@echo "Regression testing targets:"
6e45eaef9SFam Zheng	@echo
79865f39dSHuacai Chen	@echo " $(MAKE) check                Run block, qapi-schema, unit, softfloat, qtest and decodetree tests"
854f96b45SCleber Rosa	@echo
9b98a3baeSPhilippe Mathieu-Daudé	@echo " $(MAKE) check-qtest-TARGET   Run qtest tests for given target"
10b98a3baeSPhilippe Mathieu-Daudé	@echo " $(MAKE) check-qtest          Run qtest tests"
11b98a3baeSPhilippe Mathieu-Daudé	@echo " $(MAKE) check-unit           Run qobject tests"
12b98a3baeSPhilippe Mathieu-Daudé	@echo " $(MAKE) check-speed          Run qobject speed tests"
13b98a3baeSPhilippe Mathieu-Daudé	@echo " $(MAKE) check-qapi-schema    Run QAPI schema tests"
14b98a3baeSPhilippe Mathieu-Daudé	@echo " $(MAKE) check-block          Run block tests"
15ca6db469SPhilippe Mathieu-Daudéifeq ($(CONFIG_TCG),y)
168ba0a820SAlex Bennée	@echo " $(MAKE) check-tcg            Run TCG tests"
1776170102SAlex Bennée	@echo " $(MAKE) check-softfloat      Run FPU emulation tests"
18ca6db469SPhilippe Mathieu-Daudéendif
19a56931eeSCleber Rosa	@echo " $(MAKE) check-acceptance     Run all acceptance (functional) tests"
2054f96b45SCleber Rosa	@echo
21c3088cd3SWainer dos Santos Moschetta	@echo " $(MAKE) check-report.tap     Generates an aggregated TAP test report"
2221313721SCleber Rosa	@echo " $(MAKE) check-venv           Creates a Python venv for tests"
2354f96b45SCleber Rosa	@echo " $(MAKE) check-clean          Clean the tests and related data"
24e45eaef9SFam Zheng	@echo
25a6eeac3bSAlex Bennée	@echo "The following are useful for CI builds"
26a6eeac3bSAlex Bennée	@echo " $(MAKE) check-build          Build most test binaris"
274ec49f0fSCleber Rosa	@echo " $(MAKE) get-vm-images        Downloads all images used by acceptance tests, according to configured targets (~350 MB each, 1.5 GB max)"
284ec49f0fSCleber Rosa	@echo
29e45eaef9SFam Zheng	@echo
30e45eaef9SFam Zheng	@echo "The variable SPEED can be set to control the gtester speed setting."
31b98a3baeSPhilippe Mathieu-Daudé	@echo "Default options are -k and (for $(MAKE) V=1) --verbose; they can be"
32e45eaef9SFam Zheng	@echo "changed with variable GTESTER_OPTIONS."
33e45eaef9SFam Zheng
34e45eaef9SFam Zhengifneq ($(wildcard config-host.mak),)
3546e7b706SFam Zhengexport SRC_PATH
3646e7b706SFam Zheng
37fb0bc835SMarkus Armbruster# TODO don't duplicate $(SRC_PATH)/Makefile's qapi-py here
38e6c42b96SMarkus Armbrusterqapi-py = $(SRC_PATH)/scripts/qapi/__init__.py \
39e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/commands.py \
40fb0bc835SMarkus Armbruster$(SRC_PATH)/scripts/qapi/common.py \
41fb0bc835SMarkus Armbruster$(SRC_PATH)/scripts/qapi/doc.py \
42e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/error.py \
43e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/events.py \
44e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/expr.py \
45e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/gen.py \
46e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/introspect.py \
47e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/parser.py \
48e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/schema.py \
49e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/source.py \
50e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/types.py \
51e6c42b96SMarkus Armbruster$(SRC_PATH)/scripts/qapi/visit.py \
52fb0bc835SMarkus Armbruster$(SRC_PATH)/scripts/qapi-gen.py
5346e7b706SFam Zheng
5446e7b706SFam Zheng# Get the list of all supported sysemu targets
5546e7b706SFam ZhengSYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
5646e7b706SFam Zheng   $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
5746e7b706SFam Zheng
587a6c377fSEric Blakecheck-unit-y += tests/check-qdict$(EXESUF)
59992159c7SMarkus Armbrustercheck-unit-y += tests/check-block-qdict$(EXESUF)
6001b2ffceSMarc-André Lureaucheck-unit-y += tests/check-qnum$(EXESUF)
6146e7b706SFam Zhengcheck-unit-y += tests/check-qstring$(EXESUF)
6246e7b706SFam Zhengcheck-unit-y += tests/check-qlist$(EXESUF)
6346e7b706SFam Zhengcheck-unit-y += tests/check-qnull$(EXESUF)
641b76e838SMax Reitzcheck-unit-y += tests/check-qobject$(EXESUF)
6546e7b706SFam Zhengcheck-unit-y += tests/check-qjson$(EXESUF)
66382176b4SMarc-André Lureaucheck-unit-y += tests/check-qlit$(EXESUF)
67b3db211fSDaniel P. Berrangecheck-unit-y += tests/test-qobject-output-visitor$(EXESUF)
68a15fcc3cSEric Blakecheck-unit-y += tests/test-clone-visitor$(EXESUF)
69b3db211fSDaniel P. Berrangecheck-unit-y += tests/test-qobject-input-visitor$(EXESUF)
7037914f60SPhilippe Mathieu-Daudécheck-unit-$(CONFIG_SOFTMMU) += tests/test-qmp-cmds$(EXESUF)
7146e7b706SFam Zhengcheck-unit-y += tests/test-string-input-visitor$(EXESUF)
7246e7b706SFam Zhengcheck-unit-y += tests/test-string-output-visitor$(EXESUF)
7346e7b706SFam Zhengcheck-unit-y += tests/test-qmp-event$(EXESUF)
7446e7b706SFam Zhengcheck-unit-y += tests/test-opts-visitor$(EXESUF)
7529de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-coroutine$(EXESUF)
7646e7b706SFam Zhengcheck-unit-y += tests/test-visitor-serialization$(EXESUF)
7737914f60SPhilippe Mathieu-Daudécheck-unit-$(CONFIG_SOFTMMU) += tests/test-iov$(EXESUF)
78ad37f24dSPeter Xucheck-unit-y += tests/test-bitmap$(EXESUF)
7929de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-aio$(EXESUF)
8029de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-aio-multithread$(EXESUF)
8129de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-throttle$(EXESUF)
8229de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-thread-pool$(EXESUF)
8329de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-hbitmap$(EXESUF)
8429de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-bdrv-drain$(EXESUF)
8529de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-bdrv-graph-mod$(EXESUF)
8629de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-blockjob$(EXESUF)
8729de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-blockjob-txn$(EXESUF)
8829de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-block-backend$(EXESUF)
8929de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-block-iothread$(EXESUF)
9029de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-image-locking$(EXESUF)
9146e7b706SFam Zhengcheck-unit-y += tests/test-x86-cpuid$(EXESUF)
9246e7b706SFam Zheng# all code tested by test-x86-cpuid is inside topology.h
9346e7b706SFam Zhengifeq ($(CONFIG_SOFTMMU),y)
9446e7b706SFam Zhengcheck-unit-y += tests/test-xbzrle$(EXESUF)
9546e7b706SFam Zhengcheck-unit-$(CONFIG_POSIX) += tests/test-vmstate$(EXESUF)
9646e7b706SFam Zhengendif
9746e7b706SFam Zhengcheck-unit-y += tests/test-cutils$(EXESUF)
98f539fbe3SJose Ricardo Zivianicheck-unit-y += tests/test-shift128$(EXESUF)
9946e7b706SFam Zhengcheck-unit-y += tests/test-mul64$(EXESUF)
10046e7b706SFam Zhengcheck-unit-y += tests/test-int128$(EXESUF)
10146e7b706SFam Zheng# all code tested by test-int128 is inside int128.h
10246e7b706SFam Zhengcheck-unit-y += tests/rcutorture$(EXESUF)
10346e7b706SFam Zhengcheck-unit-y += tests/test-rcu-list$(EXESUF)
10490487e45SEmilio G. Cotacheck-unit-y += tests/test-rcu-simpleq$(EXESUF)
105dbf8862aSEmilio G. Cotacheck-unit-y += tests/test-rcu-tailq$(EXESUF)
1068c3570e3SPaolo Bonzinicheck-unit-y += tests/test-rcu-slist$(EXESUF)
107ff9249b7SEmilio G. Cotacheck-unit-y += tests/test-qdist$(EXESUF)
1081a95404fSEmilio G. Cotacheck-unit-y += tests/test-qht$(EXESUF)
109a36270a4SAlex Bennéecheck-unit-y += tests/test-qht-par$(EXESUF)
11046e7b706SFam Zhengcheck-unit-y += tests/test-bitops$(EXESUF)
111c3f8962fSAlex Bennéecheck-unit-y += tests/test-bitcnt$(EXESUF)
112a2ce7dbdSPaolo Bonzinicheck-unit-y += tests/test-qgraph$(EXESUF)
11346e7b706SFam Zhengcheck-unit-y += tests/check-qom-interface$(EXESUF)
11446e7b706SFam Zhengcheck-unit-y += tests/check-qom-proplist$(EXESUF)
11546e7b706SFam Zhengcheck-unit-y += tests/test-qemu-opts$(EXESUF)
116d454dbe0SMarkus Armbrustercheck-unit-y += tests/test-keyval$(EXESUF)
11729de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-write-threshold$(EXESUF)
11829de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-crypto-hash$(EXESUF)
11929de2804SLaurent Viviercheck-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hash$(EXESUF)
12029de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-crypto-hmac$(EXESUF)
12129de2804SLaurent Viviercheck-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hmac$(EXESUF)
12229de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-crypto-cipher$(EXESUF)
12329de2804SLaurent Viviercheck-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-cipher$(EXESUF)
12429de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-crypto-secret$(EXESUF)
12529de2804SLaurent Viviercheck-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlscredsx509$(EXESUF)
12629de2804SLaurent Viviercheck-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlssession$(EXESUF)
127ff8f63daSRobert Foleyifndef CONFIG_TSAN
128ff8f63daSRobert Foley# Some tests: test-char, test-qdev-global-props, and test-qga,
129ff8f63daSRobert Foley# are not runnable under TSan due to a known issue.
130ff8f63daSRobert Foley# https://github.com/google/sanitizers/issues/1116
131ff8f63daSRobert Foleycheck-unit-$(CONFIG_SOFTMMU) += tests/test-char$(EXESUF)
132ff8f63daSRobert Foleycheck-unit-$(CONFIG_SOFTMMU) += tests/test-qdev-global-props$(EXESUF)
133f15bff25SPaolo Bonziniifeq ($(CONFIG_GUEST_AGENT),y)
134a9d2e3f1SPhilippe Mathieu-Daudécheck-unit-$(call land,$(CONFIG_LINUX),$(CONFIG_VIRTIO_SERIAL)) += tests/test-qga$(EXESUF)
13546e7b706SFam Zhengendif
136ff8f63daSRobert Foleyendif
13737914f60SPhilippe Mathieu-Daudécheck-unit-$(CONFIG_SOFTMMU) += tests/test-timed-average$(EXESUF)
13837914f60SPhilippe Mathieu-Daudécheck-unit-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_INOTIFY1)) += tests/test-util-filemonitor$(EXESUF)
13937914f60SPhilippe Mathieu-Daudécheck-unit-$(CONFIG_SOFTMMU) += tests/test-util-sockets$(EXESUF)
14029de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-authz-simple$(EXESUF)
14129de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-authz-list$(EXESUF)
14229de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-authz-listfile$(EXESUF)
14329de2804SLaurent Viviercheck-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_AUTH_PAM)) += tests/test-authz-pam$(EXESUF)
14429de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-io-task$(EXESUF)
14529de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-io-channel-socket$(EXESUF)
14629de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-io-channel-file$(EXESUF)
14729de2804SLaurent Viviercheck-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-io-channel-tls$(EXESUF)
14829de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-io-channel-command$(EXESUF)
14929de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-io-channel-buffer$(EXESUF)
15037914f60SPhilippe Mathieu-Daudécheck-unit-$(CONFIG_SOFTMMU) += tests/test-base64$(EXESUF)
15129de2804SLaurent Viviercheck-unit-$(call land,$(CONFIG_BLOCK),$(if $(CONFIG_NETTLE),y,$(CONFIG_GCRYPT))) += tests/test-crypto-pbkdf$(EXESUF)
15229de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK) += tests/test-crypto-ivgen$(EXESUF)
15329de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK)  += tests/test-crypto-afsplit$(EXESUF)
1544e89ed19SDaniel P. Berrangécheck-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_QEMU_PRIVATE_XTS)) += tests/test-crypto-xts$(EXESUF)
15529de2804SLaurent Viviercheck-unit-$(CONFIG_BLOCK)  += tests/test-crypto-block$(EXESUF)
15646e7b706SFam Zhengcheck-unit-y += tests/test-logging$(EXESUF)
15729de2804SLaurent Viviercheck-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_REPLICATION)) += tests/test-replication$(EXESUF)
15837914f60SPhilippe Mathieu-Daudécheck-unit-$(CONFIG_SOFTMMU) += tests/test-bufferiszero$(EXESUF)
159c739cdddSFam Zhengcheck-unit-y += tests/test-uuid$(EXESUF)
16024b94625SPaolo Bonzinicheck-unit-y += tests/ptimer-test$(EXESUF)
1616c873d11SMarkus Armbrustercheck-unit-y += tests/test-qapi-util$(EXESUF)
16246e7b706SFam Zheng
163bdd95e47SThomas Huthcheck-block-$(call land,$(CONFIG_POSIX),$(CONFIG_SOFTMMU)) += tests/check-block.sh
16446e7b706SFam Zheng
1653dff199cSLaurent Viviergenerated-files-y += tests/test-qapi-types.h
1663dff199cSLaurent Viviergenerated-files-y += tests/include/test-qapi-types-sub-module.h
1673dff199cSLaurent Viviergenerated-files-y += tests/test-qapi-types-sub-sub-module.h
1683dff199cSLaurent Viviergenerated-files-y += tests/test-qapi-visit.h
1693dff199cSLaurent Viviergenerated-files-y += tests/include/test-qapi-visit-sub-module.h
1703dff199cSLaurent Viviergenerated-files-y += tests/test-qapi-visit-sub-sub-module.h
1713dff199cSLaurent Viviergenerated-files-y += tests/test-qapi-commands.h
17200ca24ffSMarkus Armbrustergenerated-files-y += tests/test-qapi-init-commands.h
1733dff199cSLaurent Viviergenerated-files-y += tests/include/test-qapi-commands-sub-module.h
1743dff199cSLaurent Viviergenerated-files-y += tests/test-qapi-commands-sub-sub-module.h
1750cc0e268SMarkus Armbrustergenerated-files-y += tests/test-qapi-emit-events.h
1763dff199cSLaurent Viviergenerated-files-y += tests/test-qapi-events.h
1773dff199cSLaurent Viviergenerated-files-y += tests/include/test-qapi-events-sub-module.h
1783dff199cSLaurent Viviergenerated-files-y += tests/test-qapi-events-sub-sub-module.h
1793dff199cSLaurent Viviergenerated-files-y += tests/test-qapi-introspect.h
18046e7b706SFam Zheng
1811e8a1faeSThomas HuthQEMU_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
18246e7b706SFam Zheng
18346e7b706SFam Zheng
18446e7b706SFam Zheng# Deps that are common to various different sets of tests below
185ebedb37cSPaolo Bonzinitest-util-obj-y = libqemuutil.a
18646e7b706SFam Zhengtest-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
187709395f8SMarkus Armbrustertest-qapi-obj-y = tests/test-qapi-types.o \
188709395f8SMarkus Armbruster	tests/include/test-qapi-types-sub-module.o \
189709395f8SMarkus Armbruster	tests/test-qapi-types-sub-sub-module.o \
190709395f8SMarkus Armbruster	tests/test-qapi-visit.o \
191709395f8SMarkus Armbruster	tests/include/test-qapi-visit-sub-module.o \
192709395f8SMarkus Armbruster	tests/test-qapi-visit-sub-sub-module.o \
193a9529100SMarkus Armbruster	tests/test-qapi-introspect.o \
19446e7b706SFam Zheng	$(test-qom-obj-y)
19529de2804SLaurent Vivierbenchmark-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
19629de2804SLaurent Viviertest-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
19729de2804SLaurent Viviertest-io-obj-$(CONFIG_BLOCK) = $(io-obj-y) $(test-crypto-obj-y)
19829de2804SLaurent Viviertest-authz-obj-$(CONFIG_BLOCK) = $(test-qom-obj-y) $(authz-obj-y)
19929de2804SLaurent Viviertest-block-obj-$(CONFIG_BLOCK) = $(block-obj-y) $(test-io-obj-y) tests/iothread.o
20046e7b706SFam Zheng
20101b2ffceSMarc-André Lureautests/check-qnum$(EXESUF): tests/check-qnum.o $(test-util-obj-y)
20246e7b706SFam Zhengtests/check-qstring$(EXESUF): tests/check-qstring.o $(test-util-obj-y)
20346e7b706SFam Zhengtests/check-qdict$(EXESUF): tests/check-qdict.o $(test-util-obj-y)
2040bcc8e5bSMarkus Armbrustertests/check-block-qdict$(EXESUF): tests/check-block-qdict.o $(test-util-obj-y)
20546e7b706SFam Zhengtests/check-qlist$(EXESUF): tests/check-qlist.o $(test-util-obj-y)
20646e7b706SFam Zhengtests/check-qnull$(EXESUF): tests/check-qnull.o $(test-util-obj-y)
2071b76e838SMax Reitztests/check-qobject$(EXESUF): tests/check-qobject.o $(test-util-obj-y)
20846e7b706SFam Zhengtests/check-qjson$(EXESUF): tests/check-qjson.o $(test-util-obj-y)
209382176b4SMarc-André Lureautests/check-qlit$(EXESUF): tests/check-qlit.o $(test-util-obj-y)
21046e7b706SFam Zhengtests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(test-qom-obj-y)
21146e7b706SFam Zhengtests/check-qom-proplist$(EXESUF): tests/check-qom-proplist.o $(test-qom-obj-y)
212ea3af47dSMarc-André Lureau
2133db9f6a3SThomas Huthtests/test-char$(EXESUF): tests/test-char.o $(test-util-obj-y) $(test-io-obj-y) $(chardev-obj-y) tests/socket-helpers.o
21446e7b706SFam Zhengtests/test-coroutine$(EXESUF): tests/test-coroutine.o $(test-block-obj-y)
21546e7b706SFam Zhengtests/test-aio$(EXESUF): tests/test-aio.o $(test-block-obj-y)
2160c330a73SPaolo Bonzinitests/test-aio-multithread$(EXESUF): tests/test-aio-multithread.o $(test-block-obj-y)
21746e7b706SFam Zhengtests/test-throttle$(EXESUF): tests/test-throttle.o $(test-block-obj-y)
218881cfd17SKevin Wolftests/test-bdrv-drain$(EXESUF): tests/test-bdrv-drain.o $(test-block-obj-y) $(test-util-obj-y)
2192dbfadf6SVladimir Sementsov-Ogievskiytests/test-bdrv-graph-mod$(EXESUF): tests/test-bdrv-graph-mod.o $(test-block-obj-y) $(test-util-obj-y)
2209ef8112aSAlberto Garciatests/test-blockjob$(EXESUF): tests/test-blockjob.o $(test-block-obj-y) $(test-util-obj-y)
22146e7b706SFam Zhengtests/test-blockjob-txn$(EXESUF): tests/test-blockjob-txn.o $(test-block-obj-y) $(test-util-obj-y)
222ad0df3e0SKevin Wolftests/test-block-backend$(EXESUF): tests/test-block-backend.o $(test-block-obj-y) $(test-util-obj-y)
2234720cbeeSKevin Wolftests/test-block-iothread$(EXESUF): tests/test-block-iothread.o $(test-block-obj-y) $(test-util-obj-y)
224aef96d7dSFam Zhengtests/test-image-locking$(EXESUF): tests/test-image-locking.o $(test-block-obj-y) $(test-util-obj-y)
22546e7b706SFam Zhengtests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj-y)
22646e7b706SFam Zhengtests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y)
227a3b52535SVladimir Sementsov-Ogievskiytests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(test-crypto-obj-y)
228ad37f24dSPeter Xutests/test-bitmap$(EXESUF): tests/test-bitmap.o $(test-util-obj-y)
22946e7b706SFam Zhengtests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
23055166230SMarc-André Lureautests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/libmigration.fa $(test-util-obj-y) \
23155166230SMarc-André Lureau	$(test-io-obj-y)
23205cb8ed5SAlistair Francistests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o $(test-util-obj-y)
23346e7b706SFam Zhengtests/test-int128$(EXESUF): tests/test-int128.o
23446e7b706SFam Zhengtests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y)
23546e7b706SFam Zhengtests/test-rcu-list$(EXESUF): tests/test-rcu-list.o $(test-util-obj-y)
23690487e45SEmilio G. Cotatests/test-rcu-simpleq$(EXESUF): tests/test-rcu-simpleq.o $(test-util-obj-y)
237dbf8862aSEmilio G. Cotatests/test-rcu-tailq$(EXESUF): tests/test-rcu-tailq.o $(test-util-obj-y)
2388c3570e3SPaolo Bonzinitests/test-rcu-slist$(EXESUF): tests/test-rcu-slist.o $(test-util-obj-y)
239ff9249b7SEmilio G. Cotatests/test-qdist$(EXESUF): tests/test-qdist.o $(test-util-obj-y)
2401a95404fSEmilio G. Cotatests/test-qht$(EXESUF): tests/test-qht.o $(test-util-obj-y)
241896a9ee9SEmilio G. Cotatests/test-qht-par$(EXESUF): tests/test-qht-par.o tests/qht-bench$(EXESUF) $(test-util-obj-y)
242515864a0SEmilio G. Cotatests/qht-bench$(EXESUF): tests/qht-bench.o $(test-util-obj-y)
243efad6682SRichard Hendersontests/test-bufferiszero$(EXESUF): tests/test-bufferiszero.o $(test-util-obj-y)
244070e3edcSEmilio G. Cotatests/atomic_add-bench$(EXESUF): tests/atomic_add-bench.o $(test-util-obj-y)
24582fdfcbeSEmilio G. Cotatests/atomic64-bench$(EXESUF): tests/atomic64-bench.o $(test-util-obj-y)
24646e7b706SFam Zheng
247*c92a3097SMarc-André Lureautests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o hw/core/libhwcore.fa \
24846e7b706SFam Zheng	$(test-qapi-obj-y)
24955166230SMarc-André Lureautests/test-vmstate$(EXESUF): tests/test-vmstate.o migration/libmigration.fa \
25046e7b706SFam Zheng	$(test-io-obj-y)
251c2b38b27SPaolo Bonzinitests/test-timed-average$(EXESUF): tests/test-timed-average.o $(test-util-obj-y)
252ebedb37cSPaolo Bonzinitests/test-base64$(EXESUF): tests/test-base64.o $(test-util-obj-y)
2539ee24e98SPaolo Bonzinitests/ptimer-test$(EXESUF): tests/ptimer-test.o tests/ptimer-test-stubs.o hw/core/ptimer.o
25410ae5b30SThomas Huthtests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y)
25510ae5b30SThomas Huthtests/test-keyval$(EXESUF): tests/test-keyval.o $(test-util-obj-y) $(test-qapi-obj-y)
25610ae5b30SThomas Huthtests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-block-obj-y)
25710ae5b30SThomas Huthtests/test-uuid$(EXESUF): tests/test-uuid.o $(test-util-obj-y)
25810ae5b30SThomas Huthtests/test-qapi-util$(EXESUF): tests/test-qapi-util.o $(test-util-obj-y)
25946e7b706SFam Zheng
26046e7b706SFam Zhengtests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y)
26146e7b706SFam Zheng
262b3110466SChanglong Xietests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
263b3110466SChanglong Xie	$(test-block-obj-y)
264b3110466SChanglong Xie
265fb0bc835SMarkus Armbrustertests/test-qapi-types.c tests/test-qapi-types.h \
266709395f8SMarkus Armbrustertests/include/test-qapi-types-sub-module.c \
267709395f8SMarkus Armbrustertests/include/test-qapi-types-sub-module.h \
268709395f8SMarkus Armbrustertests/test-qapi-types-sub-sub-module.c \
269709395f8SMarkus Armbrustertests/test-qapi-types-sub-sub-module.h \
270fb0bc835SMarkus Armbrustertests/test-qapi-visit.c tests/test-qapi-visit.h \
271709395f8SMarkus Armbrustertests/include/test-qapi-visit-sub-module.c \
272709395f8SMarkus Armbrustertests/include/test-qapi-visit-sub-module.h \
273709395f8SMarkus Armbrustertests/test-qapi-visit-sub-sub-module.c \
274709395f8SMarkus Armbrustertests/test-qapi-visit-sub-sub-module.h \
275eb815e24SMarkus Armbrustertests/test-qapi-commands.h tests/test-qapi-commands.c \
276709395f8SMarkus Armbrustertests/include/test-qapi-commands-sub-module.h \
277709395f8SMarkus Armbrustertests/include/test-qapi-commands-sub-module.c \
278709395f8SMarkus Armbrustertests/test-qapi-commands-sub-sub-module.h \
279709395f8SMarkus Armbrustertests/test-qapi-commands-sub-sub-module.c \
2800cc0e268SMarkus Armbrustertests/test-qapi-emit-events.c tests/test-qapi-emit-events.h \
281eb815e24SMarkus Armbrustertests/test-qapi-events.c tests/test-qapi-events.h \
28200ca24ffSMarkus Armbrustertests/test-qapi-init-commands.c \
28300ca24ffSMarkus Armbrustertests/test-qapi-init-commands.h \
284709395f8SMarkus Armbrustertests/include/test-qapi-events-sub-module.c \
285709395f8SMarkus Armbrustertests/include/test-qapi-events-sub-module.h \
286709395f8SMarkus Armbrustertests/test-qapi-events-sub-sub-module.c \
287709395f8SMarkus Armbrustertests/test-qapi-events-sub-sub-module.h \
288eb815e24SMarkus Armbrustertests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
289fb0bc835SMarkus Armbrustertests/test-qapi-gen-timestamp ;
290709395f8SMarkus Armbrustertests/test-qapi-gen-timestamp: \
291709395f8SMarkus Armbruster		$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json \
292709395f8SMarkus Armbruster		$(SRC_PATH)/tests/qapi-schema/include/sub-module.json \
293709395f8SMarkus Armbruster		$(SRC_PATH)/tests/qapi-schema/sub-sub-module.json \
294709395f8SMarkus Armbruster		$(qapi-py)
2950d6b93deSMatthias Maier	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
296fb0bc835SMarkus Armbruster		-o tests -p "test-" $<, \
297fb0bc835SMarkus Armbruster		"GEN","$(@:%-timestamp=%)")
298f3d4aa5aSMarkus Armbruster	@rm -f tests/test-qapi-doc.texi
299fb0bc835SMarkus Armbruster	@>$@
30046e7b706SFam Zheng
30146e7b706SFam Zhengtests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
30246e7b706SFam Zhengtests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
3030cc0e268SMarkus Armbrustertests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y) tests/test-qapi-emit-events.o tests/test-qapi-events.o
304b3db211fSDaniel P. Berrangetests/test-qobject-output-visitor$(EXESUF): tests/test-qobject-output-visitor.o $(test-qapi-obj-y)
305a15fcc3cSEric Blaketests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-obj-y)
306b3db211fSDaniel P. Berrangetests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visitor.o $(test-qapi-obj-y)
30700ca24ffSMarkus Armbrustertests/test-qmp-cmds$(EXESUF): tests/test-qmp-cmds.o tests/test-qapi-commands.o tests/test-qapi-init-commands.o $(test-qapi-obj-y)
30846e7b706SFam Zhengtests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
30946e7b706SFam Zhengtests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y)
31046e7b706SFam Zheng
311f539fbe3SJose Ricardo Zivianitests/test-shift128$(EXESUF): tests/test-shift128.o $(test-util-obj-y)
31246e7b706SFam Zhengtests/test-mul64$(EXESUF): tests/test-mul64.o $(test-util-obj-y)
31346e7b706SFam Zhengtests/test-bitops$(EXESUF): tests/test-bitops.o $(test-util-obj-y)
314c3f8962fSAlex Bennéetests/test-bitcnt$(EXESUF): tests/test-bitcnt.o $(test-util-obj-y)
315a2ce7dbdSPaolo Bonzinitests/test-qgraph$(EXESUF): tests/test-qgraph.o tests/qtest/libqos/qgraph.o $(test-util-obj-y)
31646e7b706SFam Zhengtests/test-crypto-hash$(EXESUF): tests/test-crypto-hash.o $(test-crypto-obj-y)
3170128cd29SLongpeng(Mike)tests/benchmark-crypto-hash$(EXESUF): tests/benchmark-crypto-hash.o $(test-crypto-obj-y)
3184fd460bfSLongpeng(Mike)tests/test-crypto-hmac$(EXESUF): tests/test-crypto-hmac.o $(test-crypto-obj-y)
319c7a9af4bSLongpeng(Mike)tests/benchmark-crypto-hmac$(EXESUF): tests/benchmark-crypto-hmac.o $(test-crypto-obj-y)
32046e7b706SFam Zhengtests/test-crypto-cipher$(EXESUF): tests/test-crypto-cipher.o $(test-crypto-obj-y)
3211efd9d5eSLongpeng(Mike)tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-crypto-obj-y)
32246e7b706SFam Zhengtests/test-crypto-secret$(EXESUF): tests/test-crypto-secret.o $(test-crypto-obj-y)
32346e7b706SFam Zhengtests/test-crypto-xts$(EXESUF): tests/test-crypto-xts.o $(test-crypto-obj-y)
32446e7b706SFam Zheng
32592500362SAlexey Krasikovifeq ($(CONFIG_TEST_SECRET_KEYRING),y)
32692500362SAlexey Krasikovtests/test-crypto-secret.o-libs := -lkeyutils
32792500362SAlexey Krasikovendif
32892500362SAlexey Krasikov
32946e7b706SFam Zhengtests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS)
33046e7b706SFam Zhengtests/crypto-tls-x509-helpers.o-libs := $(TASN1_LIBS)
33146e7b706SFam Zhengtests/pkix_asn1_tab.o-cflags := $(TASN1_CFLAGS)
33246e7b706SFam Zheng
33346e7b706SFam Zhengtests/test-crypto-tlscredsx509.o-cflags := $(TASN1_CFLAGS)
33446e7b706SFam Zhengtests/test-crypto-tlscredsx509$(EXESUF): tests/test-crypto-tlscredsx509.o \
33546e7b706SFam Zheng	tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o $(test-crypto-obj-y)
33646e7b706SFam Zheng
33746e7b706SFam Zhengtests/test-crypto-tlssession.o-cflags := $(TASN1_CFLAGS)
33846e7b706SFam Zhengtests/test-crypto-tlssession$(EXESUF): tests/test-crypto-tlssession.o \
339e1a6dc91SRichard W.M. Jones	tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
340e1a6dc91SRichard W.M. Jones	tests/crypto-tls-psk-helpers.o \
341e1a6dc91SRichard W.M. Jones        $(test-crypto-obj-y)
34290e33dfeSDaniel P. Berrangétests/test-util-filemonitor$(EXESUF): tests/test-util-filemonitor.o \
34390e33dfeSDaniel P. Berrangé	$(test-util-obj-y)
34458dc31f1SDaniel P. Berrangetests/test-util-sockets$(EXESUF): tests/test-util-sockets.o \
34558dc31f1SDaniel P. Berrange	tests/socket-helpers.o $(test-util-obj-y)
346fb5c4ebcSDaniel P. Berrangétests/test-authz-simple$(EXESUF): tests/test-authz-simple.o $(test-authz-obj-y)
347c8c99887SDaniel P. Berrangetests/test-authz-list$(EXESUF): tests/test-authz-list.o $(test-authz-obj-y)
34855d86984SDaniel P. Berrangétests/test-authz-listfile$(EXESUF): tests/test-authz-listfile.o $(test-authz-obj-y)
3498953caf3SDaniel P. Berrangetests/test-authz-pam$(EXESUF): tests/test-authz-pam.o $(test-authz-obj-y)
35046e7b706SFam Zhengtests/test-io-task$(EXESUF): tests/test-io-task.o $(test-io-obj-y)
35146e7b706SFam Zhengtests/test-io-channel-socket$(EXESUF): tests/test-io-channel-socket.o \
3529b589ffbSDaniel P. Berrange        tests/io-channel-helpers.o tests/socket-helpers.o $(test-io-obj-y)
35346e7b706SFam Zhengtests/test-io-channel-file$(EXESUF): tests/test-io-channel-file.o \
35446e7b706SFam Zheng        tests/io-channel-helpers.o $(test-io-obj-y)
35546e7b706SFam Zhengtests/test-io-channel-tls$(EXESUF): tests/test-io-channel-tls.o \
35646e7b706SFam Zheng	tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
35746e7b706SFam Zheng	tests/io-channel-helpers.o $(test-io-obj-y)
35846e7b706SFam Zhengtests/test-io-channel-command$(EXESUF): tests/test-io-channel-command.o \
35946e7b706SFam Zheng        tests/io-channel-helpers.o $(test-io-obj-y)
36046e7b706SFam Zhengtests/test-io-channel-buffer$(EXESUF): tests/test-io-channel-buffer.o \
36146e7b706SFam Zheng        tests/io-channel-helpers.o $(test-io-obj-y)
36246e7b706SFam Zhengtests/test-crypto-pbkdf$(EXESUF): tests/test-crypto-pbkdf.o $(test-crypto-obj-y)
36346e7b706SFam Zhengtests/test-crypto-ivgen$(EXESUF): tests/test-crypto-ivgen.o $(test-crypto-obj-y)
36446e7b706SFam Zhengtests/test-crypto-afsplit$(EXESUF): tests/test-crypto-afsplit.o $(test-crypto-obj-y)
36546e7b706SFam Zhengtests/test-crypto-block$(EXESUF): tests/test-crypto-block.o $(test-crypto-obj-y)
36646e7b706SFam Zheng
367409437e1SDaniel P. Berrangetests/migration/stress$(EXESUF): tests/migration/stress.o
3680bdb12c7SPeter Maydell	$(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
369409437e1SDaniel P. Berrange
370409437e1SDaniel P. BerrangeINITRD_WORK_DIR=tests/migration/initrd
371409437e1SDaniel P. Berrange
372409437e1SDaniel P. Berrangetests/migration/initrd-stress.img: tests/migration/stress$(EXESUF)
373409437e1SDaniel P. Berrange	mkdir -p $(INITRD_WORK_DIR)
374409437e1SDaniel P. Berrange	cp $< $(INITRD_WORK_DIR)/init
375409437e1SDaniel P. Berrange	(cd $(INITRD_WORK_DIR) && (find | cpio --quiet -o -H newc | gzip -9)) > $@
376409437e1SDaniel P. Berrange	rm $(INITRD_WORK_DIR)/init
377409437e1SDaniel P. Berrange	rmdir $(INITRD_WORK_DIR)
378409437e1SDaniel P. Berrange
379f15bff25SPaolo Bonzinitests/test-qga$(EXESUF): qga/qemu-ga$(EXESUF)
380a2ce7dbdSPaolo Bonzinitests/test-qga$(EXESUF): tests/test-qga.o tests/qtest/libqtest.o $(test-util-obj-y)
3814eb38726SDr. David Alan Gilberttests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o $(test-util-obj-y) libvhost-user.a
3826e1da96bSPhilippe Mathieu-Daudétests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
38346e7b706SFam Zheng
38446e7b706SFam ZhengSPEED = quick
38546e7b706SFam Zheng
38646e7b706SFam Zheng# gtester tests, possibly with verbose output
3879df43317SPaolo Bonzini# do_test_tap runs all tests, even if some of them fail, while do_test_human
3889df43317SPaolo Bonzini# stops at the first failure unless -k is given on the command line
3899df43317SPaolo Bonzini
3909df43317SPaolo Bonzinidefine do_test_human_k
3919df43317SPaolo Bonzini        $(quiet-@)rc=0; $(foreach COMMAND, $1, \
3929df43317SPaolo Bonzini          $(call quiet-command-run, \
3939df43317SPaolo Bonzini            export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
3949df43317SPaolo Bonzini              $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
3959df43317SPaolo Bonzini              | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" $(if $(V),, --show-failures-only) \
3969df43317SPaolo Bonzini              || rc=$$?;, "TEST", "$@: $(COMMAND)")) exit $$rc
3979df43317SPaolo Bonziniendef
3989df43317SPaolo Bonzinidefine do_test_human_no_k
3999df43317SPaolo Bonzini        $(foreach COMMAND, $1, \
4009df43317SPaolo Bonzini          $(call quiet-command, \
4019df43317SPaolo Bonzini            MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2 \
4029df43317SPaolo Bonzini              $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
4039df43317SPaolo Bonzini              | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" $(if $(V),, --show-failures-only), \
4049df43317SPaolo Bonzini              "TEST", "$@: $(COMMAND)")
4059df43317SPaolo Bonzini)
4069df43317SPaolo Bonziniendef
4079df43317SPaolo Bonzinido_test_human = \
4089df43317SPaolo Bonzini        $(if $(findstring k, $(MAKEFLAGS)), $(do_test_human_k), $(do_test_human_no_k))
4099df43317SPaolo Bonzini
4109df43317SPaolo Bonzinidefine do_test_tap
4119df43317SPaolo Bonzini	$(call quiet-command, \
4129df43317SPaolo Bonzini          { export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
4139df43317SPaolo Bonzini            $(foreach COMMAND, $1, \
4149df43317SPaolo Bonzini	      $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
4153bcb5840SHavard Skinnemoen	      | sed "s/^\(not \)\?ok [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \
4169df43317SPaolo Bonzini	      | ./scripts/tap-merge.pl | tee "$@" \
4179df43317SPaolo Bonzini	      | ./scripts/tap-driver.pl $(if $(V),, --show-failures-only), \
4189df43317SPaolo Bonzini	  "TAP","$@")
4199df43317SPaolo Bonziniendef
42046e7b706SFam Zheng
421a6eeac3bSAlex Bennéebuild-unit: $(check-unit-y)
422a6eeac3bSAlex Bennée
4239df43317SPaolo Bonzinicheck-unit: $(check-unit-y)
4249df43317SPaolo Bonzini	$(call do_test_human, $^)
42546e7b706SFam Zheng
4269df43317SPaolo Bonzinicheck-speed: $(check-speed-y)
4279df43317SPaolo Bonzini	$(call do_test_human, $^)
42846e7b706SFam Zheng
4299df43317SPaolo Bonzini# gtester tests with TAP output
43046e7b706SFam Zheng
4319df43317SPaolo Bonzinicheck-report-unit.tap: $(check-unit-y)
4329df43317SPaolo Bonzini	$(call do_test_tap,$^)
43346e7b706SFam Zheng
4343089e74eSAlex Bennée# Plugins
4353089e74eSAlex Bennéeifeq ($(CONFIG_PLUGIN),y)
4363089e74eSAlex Bennée.PHONY: plugins
4373089e74eSAlex Bennéeplugins:
4383089e74eSAlex Bennée	$(call quiet-command,\
4393089e74eSAlex Bennée		$(MAKE) $(SUBDIR_MAKEFLAGS) -C tests/plugin V="$(V)", \
4403089e74eSAlex Bennée		"BUILD", "plugins")
4413089e74eSAlex Bennéeendif
4423089e74eSAlex Bennée
4438ba0a820SAlex Bennée# Per guest TCG tests
4448ba0a820SAlex Bennée
445e24e66f0SAlex BennéeBUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS))
446e24e66f0SAlex BennéeCLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TARGET_DIRS))
447e24e66f0SAlex BennéeRUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TARGET_DIRS))
4488ba0a820SAlex Bennée
4491a7fab92SAlex Bennée# Probe for the Docker Builds needed for each build
4502b1f35b9SAlex Bennée$(foreach PROBE_TARGET,$(TARGET_DIRS), 				\
451fc76c56dSPaolo Bonzini	$(eval -include $(SRC_PATH)/tests/tcg/Makefile.prereqs))
4521a7fab92SAlex Bennée
4533089e74eSAlex Bennéebuild-tcg-tests-%: $(if $(CONFIG_PLUGIN),plugins)
454fc76c56dSPaolo Bonzini	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
455fc76c56dSPaolo Bonzini		-f $(SRC_PATH)/tests/tcg/Makefile.qemu \
456fc76c56dSPaolo Bonzini		SRC_PATH=$(SRC_PATH) \
4572038f8c8SPaolo Bonzini	       	V="$(V)" TARGET="$*" guest-tests, \
458cff54773SAlex Bennée		"BUILD", "TCG tests for $*")
4598ba0a820SAlex Bennée
460fc76c56dSPaolo Bonzinirun-tcg-tests-%: build-tcg-tests-% %/all
461fc76c56dSPaolo Bonzini	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
462fc76c56dSPaolo Bonzini		-f $(SRC_PATH)/tests/tcg/Makefile.qemu \
463fc76c56dSPaolo Bonzini		SRC_PATH=$(SRC_PATH) SPEED="$(SPEED)" \
4642038f8c8SPaolo Bonzini		V="$(V)" TARGET="$*" run-guest-tests, \
465cff54773SAlex Bennée		"RUN", "TCG tests for $*")
4668ba0a820SAlex Bennée
4678ba0a820SAlex Bennéeclean-tcg-tests-%:
468fc76c56dSPaolo Bonzini	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
469fc76c56dSPaolo Bonzini		-f $(SRC_PATH)/tests/tcg/Makefile.qemu \
4702038f8c8SPaolo Bonzini		SRC_PATH=$(SRC_PATH) TARGET="$*" clean-guest-tests, \
471dda60da3SAlex Bennée		"CLEAN", "TCG tests for $*")
4728ba0a820SAlex Bennée
4738ba0a820SAlex Bennée.PHONY: build-tcg
4748ba0a820SAlex Bennéebuild-tcg: $(BUILD_TCG_TARGET_RULES)
4758ba0a820SAlex Bennée
4768ba0a820SAlex Bennée.PHONY: check-tcg
477df2bb38eSAlex Bennéecheck-tcg: $(RUN_TCG_TARGET_RULES)
4788ba0a820SAlex Bennée
4798ba0a820SAlex Bennée.PHONY: clean-tcg
4808ba0a820SAlex Bennéeclean-tcg: $(CLEAN_TCG_TARGET_RULES)
48146e7b706SFam Zheng
48246e7b706SFam Zheng
483206d1b9cSLaurent VivierQEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
48446e7b706SFam Zheng
485bdd95e47SThomas Huth.PHONY: check-tests/check-block.sh
486bdd95e47SThomas Huthcheck-tests/check-block.sh: tests/check-block.sh qemu-img$(EXESUF) \
487bdd95e47SThomas Huth		qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
488bdd95e47SThomas Huth		$(patsubst %,%/all,$(filter %-softmmu,$(TARGET_DIRS)))
4893fb643c3SThomas Huth	@$<
49046e7b706SFam Zheng
49121313721SCleber Rosa# Python venv for running tests
49221313721SCleber Rosa
493a56931eeSCleber Rosa.PHONY: check-venv check-acceptance
49421313721SCleber Rosa
49521313721SCleber RosaTESTS_VENV_DIR=$(BUILD_DIR)/tests/venv
49621313721SCleber RosaTESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt
497a56931eeSCleber RosaTESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
498a56931eeSCleber Rosa# Controls the output generated by Avocado when running tests.
499a56931eeSCleber Rosa# Any number of command separated loggers are accepted.  For more
500a56931eeSCleber Rosa# information please refer to "avocado --help".
50159692a12SCleber RosaAVOCADO_SHOW=app
502b194713fSCleber RosaAVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGET_DIRS)))
50321313721SCleber Rosa
50421313721SCleber Rosa$(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
50521313721SCleber Rosa	$(call quiet-command, \
50621313721SCleber Rosa            $(PYTHON) -m venv --system-site-packages $@, \
50721313721SCleber Rosa            VENV, $@)
50821313721SCleber Rosa	$(call quiet-command, \
50921313721SCleber Rosa            $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
51021313721SCleber Rosa            PIP, $(TESTS_VENV_REQ))
51121313721SCleber Rosa	$(call quiet-command, touch $@)
51221313721SCleber Rosa
513a56931eeSCleber Rosa$(TESTS_RESULTS_DIR):
514a56931eeSCleber Rosa	$(call quiet-command, mkdir -p $@, \
515a56931eeSCleber Rosa            MKDIR, $@)
516a56931eeSCleber Rosa
51721313721SCleber Rosacheck-venv: $(TESTS_VENV_DIR)
51821313721SCleber Rosa
5194ec49f0fSCleber RosaFEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(TARGETS))
5204ec49f0fSCleber RosaFEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x
5214ec49f0fSCleber RosaFEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES))
5224ec49f0fSCleber Rosa
5234ec49f0fSCleber Rosa# download one specific Fedora 31 image
5244ec49f0fSCleber Rosaget-vm-image-fedora-31-%: check-venv
5254ec49f0fSCleber Rosa	$(call quiet-command, \
5264ec49f0fSCleber Rosa             $(TESTS_VENV_DIR)/bin/python -m avocado vmimage get \
5274ec49f0fSCleber Rosa             --distro=fedora --distro-version=31 --arch=$*, \
5284ec49f0fSCleber Rosa	"AVOCADO", "Downloading acceptance tests VM image for $*")
5294ec49f0fSCleber Rosa
5304ec49f0fSCleber Rosa# download all vm images, according to defined targets
5314ec49f0fSCleber Rosaget-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD))
5324ec49f0fSCleber Rosa
5334ec49f0fSCleber Rosacheck-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images
534a56931eeSCleber Rosa	$(call quiet-command, \
535a56931eeSCleber Rosa            $(TESTS_VENV_DIR)/bin/python -m avocado \
536a56931eeSCleber Rosa            --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
537b194713fSCleber Rosa            --filter-by-tags-include-empty --filter-by-tags-include-empty-key \
538b194713fSCleber Rosa            $(AVOCADO_TAGS) \
539c5008c76SAlex Bennée            $(if $(GITLAB_CI),,--failfast=on) tests/acceptance, \
540a56931eeSCleber Rosa            "AVOCADO", "tests/acceptance")
541a56931eeSCleber Rosa
54246e7b706SFam Zheng# Consolidated targets
54346e7b706SFam Zheng
544a2ce7dbdSPaolo Bonzini.PHONY: check-block check-unit check check-clean get-vm-images
545ee6fe053SMarc-André Lureauifeq ($(CONFIG_TOOLS),y)
54646e7b706SFam Zhengcheck-block: $(patsubst %,check-%, $(check-block-y))
547ee6fe053SMarc-André Lureauendif
548a2ce7dbdSPaolo Bonzinicheck-build: build-unit
549a6eeac3bSAlex Bennée
55046e7b706SFam Zhengcheck-clean:
5511e8a1faeSThomas Huth	rm -rf $(check-unit-y) tests/*.o tests/*/*.o $(QEMU_IOTESTS_HELPERS-y)
552fb0bc835SMarkus Armbruster	rm -f tests/test-qapi-gen-timestamp
553a56931eeSCleber Rosa	rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
55446e7b706SFam Zheng
555a2ce7dbdSPaolo Bonzinicheck: check-block check-unit
556a6eeac3bSAlex Bennée
55746e7b706SFam Zhengclean: check-clean
55846e7b706SFam Zheng
55946e7b706SFam Zheng# Build the help program automatically
56046e7b706SFam Zheng
56146e7b706SFam Zhengall: $(QEMU_IOTESTS_HELPERS-y)
56246e7b706SFam Zheng
56346e7b706SFam Zheng-include $(wildcard tests/*.d)
564e45eaef9SFam Zheng
565e45eaef9SFam Zhengendif
566