xref: /openbmc/qemu/tests/Makefile.include (revision 49269895)
13b8593eeSMarkus Armbruster# -*- Mode: makefile -*-
2e45eaef9SFam Zheng
3e45eaef9SFam Zheng.PHONY: check-help
4e45eaef9SFam Zhengcheck-help:
5e45eaef9SFam Zheng	@echo "Regression testing targets:"
69865f39dSHuacai Chen	@echo " $(MAKE) check                  Run block, qapi-schema, unit, softfloat, qtest and decodetree tests"
78e19c009SPaolo Bonzini	@echo " $(MAKE) bench                  Run speed tests"
854f96b45SCleber Rosa	@echo
98e19c009SPaolo Bonzini	@echo "Individual test suites:"
10b98a3baeSPhilippe Mathieu-Daudé	@echo " $(MAKE) check-qtest-TARGET     Run qtest tests for given target"
11b98a3baeSPhilippe Mathieu-Daudé	@echo " $(MAKE) check-qtest            Run qtest tests"
12b98a3baeSPhilippe Mathieu-Daudé	@echo " $(MAKE) check-unit             Run qobject tests"
13b98a3baeSPhilippe Mathieu-Daudé	@echo " $(MAKE) check-qapi-schema      Run QAPI schema tests"
14b98a3baeSPhilippe Mathieu-Daudé	@echo " $(MAKE) check-block            Run block tests"
1547e3424aSAlex Bennéeifneq ($(filter $(all-check-targets), check-softfloat),)
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
19333d7036SWillian Rampazzo	@echo " $(MAKE) check-avocado          Run avocado (integration) tests for currently configured targets"
2054f96b45SCleber Rosa	@echo
21d426ff93SDario Faggioli	@echo " $(MAKE) check-report.junit.xml Generates an aggregated XML 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"
266d4c8af3SPhilippe Mathieu-Daudé	@echo " $(MAKE) check-build            Build most test binaries"
27333d7036SWillian Rampazzo	@echo " $(MAKE) get-vm-images          Downloads all images used by avocado 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
3746e7b706SFam ZhengSPEED = quick
3846e7b706SFam Zheng
39c401c058SAlex Bennée# Per guest TCG tests
405377a100SPaolo BonziniBUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS))
415377a100SPaolo BonziniCLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS))
426ffe8137SPaolo BonziniDISTCLEAN_TCG_TARGET_RULES=$(patsubst %,distclean-tcg-tests-%, $(TCG_TESTS_TARGETS))
435377a100SPaolo BonziniRUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TCG_TESTS_TARGETS))
448ba0a820SAlex Bennée
455377a100SPaolo Bonzini$(foreach TARGET,$(TCG_TESTS_TARGETS), \
46f2d59351SPaolo Bonzini        $(eval $(BUILD_DIR)/tests/tcg/config-$(TARGET).mak: config-host.mak))
471a7fab92SAlex Bennée
48eebf199cSPaolo Bonzini.PHONY: $(TCG_TESTS_TARGETS:%=build-tcg-tests-%)
49eebf199cSPaolo Bonzini$(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/tests/tcg/config-%.mak
50eebf199cSPaolo Bonzini	$(call quiet-command, \
51d674342eSPaolo Bonzini            $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS), \
52eebf199cSPaolo Bonzini        "BUILD","$* guest-tests")
538ba0a820SAlex Bennée
54eebf199cSPaolo Bonzini.PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%)
5595808875SPaolo Bonzini$(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-%
56eebf199cSPaolo Bonzini	$(call quiet-command, \
57d674342eSPaolo Bonzini           $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) run, \
58eebf199cSPaolo Bonzini        "RUN", "$* guest-tests")
598ba0a820SAlex Bennée
60eebf199cSPaolo Bonzini.PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%)
61eebf199cSPaolo Bonzini$(TCG_TESTS_TARGETS:%=clean-tcg-tests-%): clean-tcg-tests-%:
62eebf199cSPaolo Bonzini	$(call quiet-command, \
63d674342eSPaolo Bonzini           $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) clean, \
64eebf199cSPaolo Bonzini        "CLEAN", "$* guest-tests")
658ba0a820SAlex Bennée
666ffe8137SPaolo Bonzini.PHONY: $(TCG_TESTS_TARGETS:%=distclean-tcg-tests-%)
676ffe8137SPaolo Bonzini$(TCG_TESTS_TARGETS:%=distclean-tcg-tests-%): distclean-tcg-tests-%:
686ffe8137SPaolo Bonzini	$(call quiet-command, \
696ffe8137SPaolo Bonzini           $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) distclean, \
706ffe8137SPaolo Bonzini        "CLEAN", "$* guest-tests")
716ffe8137SPaolo Bonzini
728ba0a820SAlex Bennée.PHONY: build-tcg
738ba0a820SAlex Bennéebuild-tcg: $(BUILD_TCG_TARGET_RULES)
748ba0a820SAlex Bennée
758ba0a820SAlex Bennée.PHONY: check-tcg
76ce43e842SPaolo Bonzini.ninja-goals.check-tcg = all test-plugins
77df2bb38eSAlex Bennéecheck-tcg: $(RUN_TCG_TARGET_RULES)
788ba0a820SAlex Bennée
798ba0a820SAlex Bennée.PHONY: clean-tcg
808ba0a820SAlex Bennéeclean-tcg: $(CLEAN_TCG_TARGET_RULES)
8146e7b706SFam Zheng
826ffe8137SPaolo Bonzini.PHONY: distclean-tcg
836ffe8137SPaolo Bonzinidistclean-tcg: $(DISTCLEAN_TCG_TARGET_RULES)
846ffe8137SPaolo Bonzini
8521313721SCleber Rosa# Python venv for running tests
8621313721SCleber Rosa
87333d7036SWillian Rampazzo.PHONY: check-venv check-avocado check-acceptance check-acceptance-deprecated-warning
8821313721SCleber Rosa
895377a100SPaolo Bonzini# Build up our target list from the filtered list of ninja targets
904408155aSPaolo BonziniTARGETS=$(patsubst libqemu-%.a, %, $(filter libqemu-%.a, $(ninja-targets)))
915377a100SPaolo Bonzini
92c03f57fdSPaolo BonziniTESTS_VENV_TOKEN=$(BUILD_DIR)/pyvenv/tests.group
93a56931eeSCleber RosaTESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
9494c71462SWillian Rampazzoifndef AVOCADO_TESTS
95bbbd9b6eSWillian Rampazzo	AVOCADO_TESTS=tests/avocado
9694c71462SWillian Rampazzoendif
97a56931eeSCleber Rosa# Controls the output generated by Avocado when running tests.
98a56931eeSCleber Rosa# Any number of command separated loggers are accepted.  For more
99a56931eeSCleber Rosa# information please refer to "avocado --help".
100*49269895SPhilippe Mathieu-DaudéAVOCADO_SHOW?=app
10123022794SWillian Rampazzoifndef AVOCADO_TAGS
10223022794SWillian Rampazzo	AVOCADO_CMDLINE_TAGS=$(patsubst %-softmmu,-t arch:%, \
10323022794SWillian Rampazzo						 $(filter %-softmmu,$(TARGETS)))
10423022794SWillian Rampazzoelse
10523022794SWillian Rampazzo	AVOCADO_CMDLINE_TAGS=$(addprefix -t , $(AVOCADO_TAGS))
10623022794SWillian Rampazzoendif
10721313721SCleber Rosa
1085a6f1199SJohn Snowquiet-venv-pip = $(quiet-@)$(call quiet-command-run, \
109c03f57fdSPaolo Bonzini    $(PYTHON) -m pip -q --disable-pip-version-check $1, \
1105a6f1199SJohn Snow    "VENVPIP","$1")
1115a6f1199SJohn Snow
112c03f57fdSPaolo Bonzini$(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml
1130e7647aaSJohn Snow	$(call quiet-venv-pip,install -e "$(SRC_PATH)/python/")
114913e47cbSPaolo Bonzini	$(MKVENV_ENSUREGROUP) $< avocado
11521313721SCleber Rosa	$(call quiet-command, touch $@)
11621313721SCleber Rosa
117a56931eeSCleber Rosa$(TESTS_RESULTS_DIR):
118a56931eeSCleber Rosa	$(call quiet-command, mkdir -p $@, \
119a56931eeSCleber Rosa            MKDIR, $@)
120a56931eeSCleber Rosa
121c03f57fdSPaolo Bonzinicheck-venv: $(TESTS_VENV_TOKEN)
12221313721SCleber Rosa
12393fca0f2SCleber RosaFEDORA_31_ARCHES_TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGETS)))
12493fca0f2SCleber RosaFEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(FEDORA_31_ARCHES_TARGETS))
1254ec49f0fSCleber RosaFEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x
1264ec49f0fSCleber RosaFEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES))
1274ec49f0fSCleber Rosa
1284ec49f0fSCleber Rosa# download one specific Fedora 31 image
1294ec49f0fSCleber Rosaget-vm-image-fedora-31-%: check-venv
1304ec49f0fSCleber Rosa	$(call quiet-command, \
131c03f57fdSPaolo Bonzini             $(PYTHON) -m avocado vmimage get \
1324ec49f0fSCleber Rosa             --distro=fedora --distro-version=31 --arch=$*, \
133333d7036SWillian Rampazzo	"AVOCADO", "Downloading avocado tests VM image for $*")
1344ec49f0fSCleber Rosa
1354ec49f0fSCleber Rosa# download all vm images, according to defined targets
1364ec49f0fSCleber Rosaget-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD))
1374ec49f0fSCleber Rosa
138333d7036SWillian Rampazzocheck-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-images
139a56931eeSCleber Rosa	$(call quiet-command, \
140c03f57fdSPaolo Bonzini            $(PYTHON) -m avocado \
141a56931eeSCleber Rosa            --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
142eaf245beSPaolo Bonzini            $(if $(AVOCADO_TAGS),, --filter-by-tags-include-empty \
14323022794SWillian Rampazzo			--filter-by-tags-include-empty-key) \
14423022794SWillian Rampazzo            $(AVOCADO_CMDLINE_TAGS) \
14594c71462SWillian Rampazzo            $(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \
146bbbd9b6eSWillian Rampazzo            "AVOCADO", "tests/avocado")
147a56931eeSCleber Rosa
148333d7036SWillian Rampazzocheck-acceptance-deprecated-warning:
149333d7036SWillian Rampazzo	@echo
150333d7036SWillian Rampazzo	@echo "Note '$(MAKE) check-acceptance' is deprecated, use '$(MAKE) check-avocado' instead."
151333d7036SWillian Rampazzo	@echo
152333d7036SWillian Rampazzo
153333d7036SWillian Rampazzocheck-acceptance: check-acceptance-deprecated-warning | check-avocado
154333d7036SWillian Rampazzo
15546e7b706SFam Zheng# Consolidated targets
15646e7b706SFam Zheng
157e287072bSThomas Huth.PHONY: check check-clean get-vm-images
158e781190cSPaolo Bonzinicheck:
159e781190cSPaolo Bonzini
160097a5f19SPaolo Bonzinicheck-build: run-ninja
161a6eeac3bSAlex Bennée
16246e7b706SFam Zhengcheck-clean:
163c03f57fdSPaolo Bonzini	rm -rf $(TESTS_RESULTS_DIR)
16446e7b706SFam Zheng
165425d6abaSThomas Huthclean: check-clean clean-tcg
1666ffe8137SPaolo Bonzinidistclean: distclean-tcg
16746e7b706SFam Zheng
168e45eaef9SFam Zhengendif
169