xref: /openbmc/qemu/tests/Makefile.include (revision 55166230)
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
230*55166230SMarc-André Lureautests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/libmigration.fa $(test-util-obj-y) \
231*55166230SMarc-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
24746e7b706SFam Zhengtests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
24846e7b706SFam Zheng	hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\
24946e7b706SFam Zheng	hw/core/bus.o \
250c11256aaSDamien Hedde	hw/core/resettable.o \
25146e7b706SFam Zheng	hw/core/irq.o \
25246e7b706SFam Zheng	hw/core/fw-path-provider.o \
2532f7b92a0SPaolo Bonzini	hw/core/reset.o \
254107b5969SMarc-André Lureau	hw/core/vmstate-if.o \
2550e6934f2SDamien Hedde	hw/core/clock.o hw/core/qdev-clock.o \
25646e7b706SFam Zheng	$(test-qapi-obj-y)
257*55166230SMarc-André Lureautests/test-vmstate$(EXESUF): tests/test-vmstate.o migration/libmigration.fa \
25846e7b706SFam Zheng	$(test-io-obj-y)
259c2b38b27SPaolo Bonzinitests/test-timed-average$(EXESUF): tests/test-timed-average.o $(test-util-obj-y)
260ebedb37cSPaolo Bonzinitests/test-base64$(EXESUF): tests/test-base64.o $(test-util-obj-y)
2619ee24e98SPaolo Bonzinitests/ptimer-test$(EXESUF): tests/ptimer-test.o tests/ptimer-test-stubs.o hw/core/ptimer.o
26210ae5b30SThomas Huthtests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y)
26310ae5b30SThomas Huthtests/test-keyval$(EXESUF): tests/test-keyval.o $(test-util-obj-y) $(test-qapi-obj-y)
26410ae5b30SThomas Huthtests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-block-obj-y)
26510ae5b30SThomas Huthtests/test-uuid$(EXESUF): tests/test-uuid.o $(test-util-obj-y)
26610ae5b30SThomas Huthtests/test-qapi-util$(EXESUF): tests/test-qapi-util.o $(test-util-obj-y)
26746e7b706SFam Zheng
26846e7b706SFam Zhengtests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y)
26946e7b706SFam Zheng
270b3110466SChanglong Xietests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
271b3110466SChanglong Xie	$(test-block-obj-y)
272b3110466SChanglong Xie
273fb0bc835SMarkus Armbrustertests/test-qapi-types.c tests/test-qapi-types.h \
274709395f8SMarkus Armbrustertests/include/test-qapi-types-sub-module.c \
275709395f8SMarkus Armbrustertests/include/test-qapi-types-sub-module.h \
276709395f8SMarkus Armbrustertests/test-qapi-types-sub-sub-module.c \
277709395f8SMarkus Armbrustertests/test-qapi-types-sub-sub-module.h \
278fb0bc835SMarkus Armbrustertests/test-qapi-visit.c tests/test-qapi-visit.h \
279709395f8SMarkus Armbrustertests/include/test-qapi-visit-sub-module.c \
280709395f8SMarkus Armbrustertests/include/test-qapi-visit-sub-module.h \
281709395f8SMarkus Armbrustertests/test-qapi-visit-sub-sub-module.c \
282709395f8SMarkus Armbrustertests/test-qapi-visit-sub-sub-module.h \
283eb815e24SMarkus Armbrustertests/test-qapi-commands.h tests/test-qapi-commands.c \
284709395f8SMarkus Armbrustertests/include/test-qapi-commands-sub-module.h \
285709395f8SMarkus Armbrustertests/include/test-qapi-commands-sub-module.c \
286709395f8SMarkus Armbrustertests/test-qapi-commands-sub-sub-module.h \
287709395f8SMarkus Armbrustertests/test-qapi-commands-sub-sub-module.c \
2880cc0e268SMarkus Armbrustertests/test-qapi-emit-events.c tests/test-qapi-emit-events.h \
289eb815e24SMarkus Armbrustertests/test-qapi-events.c tests/test-qapi-events.h \
29000ca24ffSMarkus Armbrustertests/test-qapi-init-commands.c \
29100ca24ffSMarkus Armbrustertests/test-qapi-init-commands.h \
292709395f8SMarkus Armbrustertests/include/test-qapi-events-sub-module.c \
293709395f8SMarkus Armbrustertests/include/test-qapi-events-sub-module.h \
294709395f8SMarkus Armbrustertests/test-qapi-events-sub-sub-module.c \
295709395f8SMarkus Armbrustertests/test-qapi-events-sub-sub-module.h \
296eb815e24SMarkus Armbrustertests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
297fb0bc835SMarkus Armbrustertests/test-qapi-gen-timestamp ;
298709395f8SMarkus Armbrustertests/test-qapi-gen-timestamp: \
299709395f8SMarkus Armbruster		$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json \
300709395f8SMarkus Armbruster		$(SRC_PATH)/tests/qapi-schema/include/sub-module.json \
301709395f8SMarkus Armbruster		$(SRC_PATH)/tests/qapi-schema/sub-sub-module.json \
302709395f8SMarkus Armbruster		$(qapi-py)
3030d6b93deSMatthias Maier	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
304fb0bc835SMarkus Armbruster		-o tests -p "test-" $<, \
305fb0bc835SMarkus Armbruster		"GEN","$(@:%-timestamp=%)")
306f3d4aa5aSMarkus Armbruster	@rm -f tests/test-qapi-doc.texi
307fb0bc835SMarkus Armbruster	@>$@
30846e7b706SFam Zheng
30946e7b706SFam Zhengtests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
31046e7b706SFam Zhengtests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
3110cc0e268SMarkus 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
312b3db211fSDaniel P. Berrangetests/test-qobject-output-visitor$(EXESUF): tests/test-qobject-output-visitor.o $(test-qapi-obj-y)
313a15fcc3cSEric Blaketests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-obj-y)
314b3db211fSDaniel P. Berrangetests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visitor.o $(test-qapi-obj-y)
31500ca24ffSMarkus 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)
31646e7b706SFam Zhengtests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
31746e7b706SFam Zhengtests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y)
31846e7b706SFam Zheng
319f539fbe3SJose Ricardo Zivianitests/test-shift128$(EXESUF): tests/test-shift128.o $(test-util-obj-y)
32046e7b706SFam Zhengtests/test-mul64$(EXESUF): tests/test-mul64.o $(test-util-obj-y)
32146e7b706SFam Zhengtests/test-bitops$(EXESUF): tests/test-bitops.o $(test-util-obj-y)
322c3f8962fSAlex Bennéetests/test-bitcnt$(EXESUF): tests/test-bitcnt.o $(test-util-obj-y)
323a2ce7dbdSPaolo Bonzinitests/test-qgraph$(EXESUF): tests/test-qgraph.o tests/qtest/libqos/qgraph.o $(test-util-obj-y)
32446e7b706SFam Zhengtests/test-crypto-hash$(EXESUF): tests/test-crypto-hash.o $(test-crypto-obj-y)
3250128cd29SLongpeng(Mike)tests/benchmark-crypto-hash$(EXESUF): tests/benchmark-crypto-hash.o $(test-crypto-obj-y)
3264fd460bfSLongpeng(Mike)tests/test-crypto-hmac$(EXESUF): tests/test-crypto-hmac.o $(test-crypto-obj-y)
327c7a9af4bSLongpeng(Mike)tests/benchmark-crypto-hmac$(EXESUF): tests/benchmark-crypto-hmac.o $(test-crypto-obj-y)
32846e7b706SFam Zhengtests/test-crypto-cipher$(EXESUF): tests/test-crypto-cipher.o $(test-crypto-obj-y)
3291efd9d5eSLongpeng(Mike)tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-crypto-obj-y)
33046e7b706SFam Zhengtests/test-crypto-secret$(EXESUF): tests/test-crypto-secret.o $(test-crypto-obj-y)
33146e7b706SFam Zhengtests/test-crypto-xts$(EXESUF): tests/test-crypto-xts.o $(test-crypto-obj-y)
33246e7b706SFam Zheng
33392500362SAlexey Krasikovifeq ($(CONFIG_TEST_SECRET_KEYRING),y)
33492500362SAlexey Krasikovtests/test-crypto-secret.o-libs := -lkeyutils
33592500362SAlexey Krasikovendif
33692500362SAlexey Krasikov
33746e7b706SFam Zhengtests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS)
33846e7b706SFam Zhengtests/crypto-tls-x509-helpers.o-libs := $(TASN1_LIBS)
33946e7b706SFam Zhengtests/pkix_asn1_tab.o-cflags := $(TASN1_CFLAGS)
34046e7b706SFam Zheng
34146e7b706SFam Zhengtests/test-crypto-tlscredsx509.o-cflags := $(TASN1_CFLAGS)
34246e7b706SFam Zhengtests/test-crypto-tlscredsx509$(EXESUF): tests/test-crypto-tlscredsx509.o \
34346e7b706SFam Zheng	tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o $(test-crypto-obj-y)
34446e7b706SFam Zheng
34546e7b706SFam Zhengtests/test-crypto-tlssession.o-cflags := $(TASN1_CFLAGS)
34646e7b706SFam Zhengtests/test-crypto-tlssession$(EXESUF): tests/test-crypto-tlssession.o \
347e1a6dc91SRichard W.M. Jones	tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
348e1a6dc91SRichard W.M. Jones	tests/crypto-tls-psk-helpers.o \
349e1a6dc91SRichard W.M. Jones        $(test-crypto-obj-y)
35090e33dfeSDaniel P. Berrangétests/test-util-filemonitor$(EXESUF): tests/test-util-filemonitor.o \
35190e33dfeSDaniel P. Berrangé	$(test-util-obj-y)
35258dc31f1SDaniel P. Berrangetests/test-util-sockets$(EXESUF): tests/test-util-sockets.o \
35358dc31f1SDaniel P. Berrange	tests/socket-helpers.o $(test-util-obj-y)
354fb5c4ebcSDaniel P. Berrangétests/test-authz-simple$(EXESUF): tests/test-authz-simple.o $(test-authz-obj-y)
355c8c99887SDaniel P. Berrangetests/test-authz-list$(EXESUF): tests/test-authz-list.o $(test-authz-obj-y)
35655d86984SDaniel P. Berrangétests/test-authz-listfile$(EXESUF): tests/test-authz-listfile.o $(test-authz-obj-y)
3578953caf3SDaniel P. Berrangetests/test-authz-pam$(EXESUF): tests/test-authz-pam.o $(test-authz-obj-y)
35846e7b706SFam Zhengtests/test-io-task$(EXESUF): tests/test-io-task.o $(test-io-obj-y)
35946e7b706SFam Zhengtests/test-io-channel-socket$(EXESUF): tests/test-io-channel-socket.o \
3609b589ffbSDaniel P. Berrange        tests/io-channel-helpers.o tests/socket-helpers.o $(test-io-obj-y)
36146e7b706SFam Zhengtests/test-io-channel-file$(EXESUF): tests/test-io-channel-file.o \
36246e7b706SFam Zheng        tests/io-channel-helpers.o $(test-io-obj-y)
36346e7b706SFam Zhengtests/test-io-channel-tls$(EXESUF): tests/test-io-channel-tls.o \
36446e7b706SFam Zheng	tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
36546e7b706SFam Zheng	tests/io-channel-helpers.o $(test-io-obj-y)
36646e7b706SFam Zhengtests/test-io-channel-command$(EXESUF): tests/test-io-channel-command.o \
36746e7b706SFam Zheng        tests/io-channel-helpers.o $(test-io-obj-y)
36846e7b706SFam Zhengtests/test-io-channel-buffer$(EXESUF): tests/test-io-channel-buffer.o \
36946e7b706SFam Zheng        tests/io-channel-helpers.o $(test-io-obj-y)
37046e7b706SFam Zhengtests/test-crypto-pbkdf$(EXESUF): tests/test-crypto-pbkdf.o $(test-crypto-obj-y)
37146e7b706SFam Zhengtests/test-crypto-ivgen$(EXESUF): tests/test-crypto-ivgen.o $(test-crypto-obj-y)
37246e7b706SFam Zhengtests/test-crypto-afsplit$(EXESUF): tests/test-crypto-afsplit.o $(test-crypto-obj-y)
37346e7b706SFam Zhengtests/test-crypto-block$(EXESUF): tests/test-crypto-block.o $(test-crypto-obj-y)
37446e7b706SFam Zheng
375409437e1SDaniel P. Berrangetests/migration/stress$(EXESUF): tests/migration/stress.o
3760bdb12c7SPeter Maydell	$(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
377409437e1SDaniel P. Berrange
378409437e1SDaniel P. BerrangeINITRD_WORK_DIR=tests/migration/initrd
379409437e1SDaniel P. Berrange
380409437e1SDaniel P. Berrangetests/migration/initrd-stress.img: tests/migration/stress$(EXESUF)
381409437e1SDaniel P. Berrange	mkdir -p $(INITRD_WORK_DIR)
382409437e1SDaniel P. Berrange	cp $< $(INITRD_WORK_DIR)/init
383409437e1SDaniel P. Berrange	(cd $(INITRD_WORK_DIR) && (find | cpio --quiet -o -H newc | gzip -9)) > $@
384409437e1SDaniel P. Berrange	rm $(INITRD_WORK_DIR)/init
385409437e1SDaniel P. Berrange	rmdir $(INITRD_WORK_DIR)
386409437e1SDaniel P. Berrange
387f15bff25SPaolo Bonzinitests/test-qga$(EXESUF): qga/qemu-ga$(EXESUF)
388a2ce7dbdSPaolo Bonzinitests/test-qga$(EXESUF): tests/test-qga.o tests/qtest/libqtest.o $(test-util-obj-y)
3894eb38726SDr. David Alan Gilberttests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o $(test-util-obj-y) libvhost-user.a
3906e1da96bSPhilippe Mathieu-Daudétests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
39146e7b706SFam Zheng
39246e7b706SFam ZhengSPEED = quick
39346e7b706SFam Zheng
39446e7b706SFam Zheng# gtester tests, possibly with verbose output
3959df43317SPaolo Bonzini# do_test_tap runs all tests, even if some of them fail, while do_test_human
3969df43317SPaolo Bonzini# stops at the first failure unless -k is given on the command line
3979df43317SPaolo Bonzini
3989df43317SPaolo Bonzinidefine do_test_human_k
3999df43317SPaolo Bonzini        $(quiet-@)rc=0; $(foreach COMMAND, $1, \
4009df43317SPaolo Bonzini          $(call quiet-command-run, \
4019df43317SPaolo Bonzini            export 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              || rc=$$?;, "TEST", "$@: $(COMMAND)")) exit $$rc
4059df43317SPaolo Bonziniendef
4069df43317SPaolo Bonzinidefine do_test_human_no_k
4079df43317SPaolo Bonzini        $(foreach COMMAND, $1, \
4089df43317SPaolo Bonzini          $(call quiet-command, \
4099df43317SPaolo Bonzini            MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2 \
4109df43317SPaolo Bonzini              $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
4119df43317SPaolo Bonzini              | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" $(if $(V),, --show-failures-only), \
4129df43317SPaolo Bonzini              "TEST", "$@: $(COMMAND)")
4139df43317SPaolo Bonzini)
4149df43317SPaolo Bonziniendef
4159df43317SPaolo Bonzinido_test_human = \
4169df43317SPaolo Bonzini        $(if $(findstring k, $(MAKEFLAGS)), $(do_test_human_k), $(do_test_human_no_k))
4179df43317SPaolo Bonzini
4189df43317SPaolo Bonzinidefine do_test_tap
4199df43317SPaolo Bonzini	$(call quiet-command, \
4209df43317SPaolo Bonzini          { export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
4219df43317SPaolo Bonzini            $(foreach COMMAND, $1, \
4229df43317SPaolo Bonzini	      $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
4233bcb5840SHavard Skinnemoen	      | sed "s/^\(not \)\?ok [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \
4249df43317SPaolo Bonzini	      | ./scripts/tap-merge.pl | tee "$@" \
4259df43317SPaolo Bonzini	      | ./scripts/tap-driver.pl $(if $(V),, --show-failures-only), \
4269df43317SPaolo Bonzini	  "TAP","$@")
4279df43317SPaolo Bonziniendef
42846e7b706SFam Zheng
429a6eeac3bSAlex Bennéebuild-unit: $(check-unit-y)
430a6eeac3bSAlex Bennée
4319df43317SPaolo Bonzinicheck-unit: $(check-unit-y)
4329df43317SPaolo Bonzini	$(call do_test_human, $^)
43346e7b706SFam Zheng
4349df43317SPaolo Bonzinicheck-speed: $(check-speed-y)
4359df43317SPaolo Bonzini	$(call do_test_human, $^)
43646e7b706SFam Zheng
4379df43317SPaolo Bonzini# gtester tests with TAP output
43846e7b706SFam Zheng
4399df43317SPaolo Bonzinicheck-report-unit.tap: $(check-unit-y)
4409df43317SPaolo Bonzini	$(call do_test_tap,$^)
44146e7b706SFam Zheng
4423089e74eSAlex Bennée# Plugins
4433089e74eSAlex Bennéeifeq ($(CONFIG_PLUGIN),y)
4443089e74eSAlex Bennée.PHONY: plugins
4453089e74eSAlex Bennéeplugins:
4463089e74eSAlex Bennée	$(call quiet-command,\
4473089e74eSAlex Bennée		$(MAKE) $(SUBDIR_MAKEFLAGS) -C tests/plugin V="$(V)", \
4483089e74eSAlex Bennée		"BUILD", "plugins")
4493089e74eSAlex Bennéeendif
4503089e74eSAlex Bennée
4518ba0a820SAlex Bennée# Per guest TCG tests
4528ba0a820SAlex Bennée
453e24e66f0SAlex BennéeBUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS))
454e24e66f0SAlex BennéeCLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TARGET_DIRS))
455e24e66f0SAlex BennéeRUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TARGET_DIRS))
4568ba0a820SAlex Bennée
4571a7fab92SAlex Bennée# Probe for the Docker Builds needed for each build
4582b1f35b9SAlex Bennée$(foreach PROBE_TARGET,$(TARGET_DIRS), 				\
459fc76c56dSPaolo Bonzini	$(eval -include $(SRC_PATH)/tests/tcg/Makefile.prereqs))
4601a7fab92SAlex Bennée
4613089e74eSAlex Bennéebuild-tcg-tests-%: $(if $(CONFIG_PLUGIN),plugins)
462fc76c56dSPaolo Bonzini	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
463fc76c56dSPaolo Bonzini		-f $(SRC_PATH)/tests/tcg/Makefile.qemu \
464fc76c56dSPaolo Bonzini		SRC_PATH=$(SRC_PATH) \
4652038f8c8SPaolo Bonzini	       	V="$(V)" TARGET="$*" guest-tests, \
466cff54773SAlex Bennée		"BUILD", "TCG tests for $*")
4678ba0a820SAlex Bennée
468fc76c56dSPaolo Bonzinirun-tcg-tests-%: build-tcg-tests-% %/all
469fc76c56dSPaolo Bonzini	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
470fc76c56dSPaolo Bonzini		-f $(SRC_PATH)/tests/tcg/Makefile.qemu \
471fc76c56dSPaolo Bonzini		SRC_PATH=$(SRC_PATH) SPEED="$(SPEED)" \
4722038f8c8SPaolo Bonzini		V="$(V)" TARGET="$*" run-guest-tests, \
473cff54773SAlex Bennée		"RUN", "TCG tests for $*")
4748ba0a820SAlex Bennée
4758ba0a820SAlex Bennéeclean-tcg-tests-%:
476fc76c56dSPaolo Bonzini	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \
477fc76c56dSPaolo Bonzini		-f $(SRC_PATH)/tests/tcg/Makefile.qemu \
4782038f8c8SPaolo Bonzini		SRC_PATH=$(SRC_PATH) TARGET="$*" clean-guest-tests, \
479dda60da3SAlex Bennée		"CLEAN", "TCG tests for $*")
4808ba0a820SAlex Bennée
4818ba0a820SAlex Bennée.PHONY: build-tcg
4828ba0a820SAlex Bennéebuild-tcg: $(BUILD_TCG_TARGET_RULES)
4838ba0a820SAlex Bennée
4848ba0a820SAlex Bennée.PHONY: check-tcg
485df2bb38eSAlex Bennéecheck-tcg: $(RUN_TCG_TARGET_RULES)
4868ba0a820SAlex Bennée
4878ba0a820SAlex Bennée.PHONY: clean-tcg
4888ba0a820SAlex Bennéeclean-tcg: $(CLEAN_TCG_TARGET_RULES)
48946e7b706SFam Zheng
49046e7b706SFam Zheng
491206d1b9cSLaurent VivierQEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
49246e7b706SFam Zheng
493bdd95e47SThomas Huth.PHONY: check-tests/check-block.sh
494bdd95e47SThomas Huthcheck-tests/check-block.sh: tests/check-block.sh qemu-img$(EXESUF) \
495bdd95e47SThomas Huth		qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
496bdd95e47SThomas Huth		$(patsubst %,%/all,$(filter %-softmmu,$(TARGET_DIRS)))
4973fb643c3SThomas Huth	@$<
49846e7b706SFam Zheng
49921313721SCleber Rosa# Python venv for running tests
50021313721SCleber Rosa
501a56931eeSCleber Rosa.PHONY: check-venv check-acceptance
50221313721SCleber Rosa
50321313721SCleber RosaTESTS_VENV_DIR=$(BUILD_DIR)/tests/venv
50421313721SCleber RosaTESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt
505a56931eeSCleber RosaTESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
506a56931eeSCleber Rosa# Controls the output generated by Avocado when running tests.
507a56931eeSCleber Rosa# Any number of command separated loggers are accepted.  For more
508a56931eeSCleber Rosa# information please refer to "avocado --help".
50959692a12SCleber RosaAVOCADO_SHOW=app
510b194713fSCleber RosaAVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGET_DIRS)))
51121313721SCleber Rosa
51221313721SCleber Rosa$(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
51321313721SCleber Rosa	$(call quiet-command, \
51421313721SCleber Rosa            $(PYTHON) -m venv --system-site-packages $@, \
51521313721SCleber Rosa            VENV, $@)
51621313721SCleber Rosa	$(call quiet-command, \
51721313721SCleber Rosa            $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
51821313721SCleber Rosa            PIP, $(TESTS_VENV_REQ))
51921313721SCleber Rosa	$(call quiet-command, touch $@)
52021313721SCleber Rosa
521a56931eeSCleber Rosa$(TESTS_RESULTS_DIR):
522a56931eeSCleber Rosa	$(call quiet-command, mkdir -p $@, \
523a56931eeSCleber Rosa            MKDIR, $@)
524a56931eeSCleber Rosa
52521313721SCleber Rosacheck-venv: $(TESTS_VENV_DIR)
52621313721SCleber Rosa
5274ec49f0fSCleber RosaFEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(TARGETS))
5284ec49f0fSCleber RosaFEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x
5294ec49f0fSCleber RosaFEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES))
5304ec49f0fSCleber Rosa
5314ec49f0fSCleber Rosa# download one specific Fedora 31 image
5324ec49f0fSCleber Rosaget-vm-image-fedora-31-%: check-venv
5334ec49f0fSCleber Rosa	$(call quiet-command, \
5344ec49f0fSCleber Rosa             $(TESTS_VENV_DIR)/bin/python -m avocado vmimage get \
5354ec49f0fSCleber Rosa             --distro=fedora --distro-version=31 --arch=$*, \
5364ec49f0fSCleber Rosa	"AVOCADO", "Downloading acceptance tests VM image for $*")
5374ec49f0fSCleber Rosa
5384ec49f0fSCleber Rosa# download all vm images, according to defined targets
5394ec49f0fSCleber Rosaget-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD))
5404ec49f0fSCleber Rosa
5414ec49f0fSCleber Rosacheck-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images
542a56931eeSCleber Rosa	$(call quiet-command, \
543a56931eeSCleber Rosa            $(TESTS_VENV_DIR)/bin/python -m avocado \
544a56931eeSCleber Rosa            --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
545b194713fSCleber Rosa            --filter-by-tags-include-empty --filter-by-tags-include-empty-key \
546b194713fSCleber Rosa            $(AVOCADO_TAGS) \
547c5008c76SAlex Bennée            $(if $(GITLAB_CI),,--failfast=on) tests/acceptance, \
548a56931eeSCleber Rosa            "AVOCADO", "tests/acceptance")
549a56931eeSCleber Rosa
55046e7b706SFam Zheng# Consolidated targets
55146e7b706SFam Zheng
552a2ce7dbdSPaolo Bonzini.PHONY: check-block check-unit check check-clean get-vm-images
553ee6fe053SMarc-André Lureauifeq ($(CONFIG_TOOLS),y)
55446e7b706SFam Zhengcheck-block: $(patsubst %,check-%, $(check-block-y))
555ee6fe053SMarc-André Lureauendif
556a2ce7dbdSPaolo Bonzinicheck-build: build-unit
557a6eeac3bSAlex Bennée
55846e7b706SFam Zhengcheck-clean:
5591e8a1faeSThomas Huth	rm -rf $(check-unit-y) tests/*.o tests/*/*.o $(QEMU_IOTESTS_HELPERS-y)
560fb0bc835SMarkus Armbruster	rm -f tests/test-qapi-gen-timestamp
561a56931eeSCleber Rosa	rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
56246e7b706SFam Zheng
563a2ce7dbdSPaolo Bonzinicheck: check-block check-unit
564a6eeac3bSAlex Bennée
56546e7b706SFam Zhengclean: check-clean
56646e7b706SFam Zheng
56746e7b706SFam Zheng# Build the help program automatically
56846e7b706SFam Zheng
56946e7b706SFam Zhengall: $(QEMU_IOTESTS_HELPERS-y)
57046e7b706SFam Zheng
57146e7b706SFam Zheng-include $(wildcard tests/*.d)
572e45eaef9SFam Zheng
573e45eaef9SFam Zhengendif
574