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 39f2d59351SPaolo Bonzini-include tests/tcg/Makefile.prereqs 40f2d59351SPaolo Bonzinitests/tcg/Makefile.prereqs: config-host.mak 41f2d59351SPaolo Bonzini 42c401c058SAlex Bennée# Per guest TCG tests 435377a100SPaolo BonziniBUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS)) 445377a100SPaolo BonziniCLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS)) 455377a100SPaolo BonziniRUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TCG_TESTS_TARGETS)) 468ba0a820SAlex Bennée 475377a100SPaolo Bonzini$(foreach TARGET,$(TCG_TESTS_TARGETS), \ 48f2d59351SPaolo Bonzini $(eval $(BUILD_DIR)/tests/tcg/config-$(TARGET).mak: config-host.mak)) 491a7fab92SAlex Bennée 50eebf199cSPaolo Bonzini.PHONY: $(TCG_TESTS_TARGETS:%=build-tcg-tests-%) 51eebf199cSPaolo Bonzini$(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/tests/tcg/config-%.mak 52eebf199cSPaolo Bonzini $(call quiet-command, \ 53*d674342eSPaolo Bonzini $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS), \ 54eebf199cSPaolo Bonzini "BUILD","$* guest-tests") 558ba0a820SAlex Bennée 56eebf199cSPaolo Bonzini.PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%) 5795808875SPaolo Bonzini$(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-% 58eebf199cSPaolo Bonzini $(call quiet-command, \ 59*d674342eSPaolo Bonzini $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) run, \ 60eebf199cSPaolo Bonzini "RUN", "$* guest-tests") 618ba0a820SAlex Bennée 62eebf199cSPaolo Bonzini.PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%) 63eebf199cSPaolo Bonzini$(TCG_TESTS_TARGETS:%=clean-tcg-tests-%): clean-tcg-tests-%: 64eebf199cSPaolo Bonzini $(call quiet-command, \ 65*d674342eSPaolo Bonzini $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) clean, \ 66eebf199cSPaolo Bonzini "CLEAN", "$* guest-tests") 678ba0a820SAlex Bennée 688ba0a820SAlex Bennée.PHONY: build-tcg 698ba0a820SAlex Bennéebuild-tcg: $(BUILD_TCG_TARGET_RULES) 708ba0a820SAlex Bennée 718ba0a820SAlex Bennée.PHONY: check-tcg 7295808875SPaolo Bonzini.ninja-goals.check-tcg = all $(if $(CONFIG_PLUGIN),test-plugins) 73df2bb38eSAlex Bennéecheck-tcg: $(RUN_TCG_TARGET_RULES) 748ba0a820SAlex Bennée 758ba0a820SAlex Bennée.PHONY: clean-tcg 768ba0a820SAlex Bennéeclean-tcg: $(CLEAN_TCG_TARGET_RULES) 7746e7b706SFam Zheng 7821313721SCleber Rosa# Python venv for running tests 7921313721SCleber Rosa 80333d7036SWillian Rampazzo.PHONY: check-venv check-avocado check-acceptance check-acceptance-deprecated-warning 8121313721SCleber Rosa 825377a100SPaolo Bonzini# Build up our target list from the filtered list of ninja targets 835377a100SPaolo BonziniTARGETS=$(patsubst libqemu-%.fa, %, $(filter libqemu-%.fa, $(ninja-targets))) 845377a100SPaolo Bonzini 8521313721SCleber RosaTESTS_VENV_DIR=$(BUILD_DIR)/tests/venv 8621313721SCleber RosaTESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt 87a56931eeSCleber RosaTESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results 88aa19dd33SJohn SnowTESTS_PYTHON=$(TESTS_VENV_DIR)/bin/python3 8994c71462SWillian Rampazzoifndef AVOCADO_TESTS 90bbbd9b6eSWillian Rampazzo AVOCADO_TESTS=tests/avocado 9194c71462SWillian Rampazzoendif 92a56931eeSCleber Rosa# Controls the output generated by Avocado when running tests. 93a56931eeSCleber Rosa# Any number of command separated loggers are accepted. For more 94a56931eeSCleber Rosa# information please refer to "avocado --help". 9559692a12SCleber RosaAVOCADO_SHOW=app 9623022794SWillian Rampazzoifndef AVOCADO_TAGS 9723022794SWillian Rampazzo AVOCADO_CMDLINE_TAGS=$(patsubst %-softmmu,-t arch:%, \ 9823022794SWillian Rampazzo $(filter %-softmmu,$(TARGETS))) 9923022794SWillian Rampazzoelse 10023022794SWillian Rampazzo AVOCADO_CMDLINE_TAGS=$(addprefix -t , $(AVOCADO_TAGS)) 10123022794SWillian Rampazzoendif 10221313721SCleber Rosa 1035a6f1199SJohn Snowquiet-venv-pip = $(quiet-@)$(call quiet-command-run, \ 1045a6f1199SJohn Snow $(TESTS_PYTHON) -m pip -q --disable-pip-version-check $1, \ 1055a6f1199SJohn Snow "VENVPIP","$1") 1065a6f1199SJohn Snow 10721313721SCleber Rosa$(TESTS_VENV_DIR): $(TESTS_VENV_REQ) 1085a6f1199SJohn Snow $(call quiet-command, $(PYTHON) -m venv $@, VENV, $@) 1090e7647aaSJohn Snow $(call quiet-venv-pip,install -e "$(SRC_PATH)/python/") 1105a6f1199SJohn Snow $(call quiet-venv-pip,install -r $(TESTS_VENV_REQ)) 11121313721SCleber Rosa $(call quiet-command, touch $@) 11221313721SCleber Rosa 113a56931eeSCleber Rosa$(TESTS_RESULTS_DIR): 114a56931eeSCleber Rosa $(call quiet-command, mkdir -p $@, \ 115a56931eeSCleber Rosa MKDIR, $@) 116a56931eeSCleber Rosa 11721313721SCleber Rosacheck-venv: $(TESTS_VENV_DIR) 11821313721SCleber Rosa 11993fca0f2SCleber RosaFEDORA_31_ARCHES_TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGETS))) 12093fca0f2SCleber RosaFEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(FEDORA_31_ARCHES_TARGETS)) 1214ec49f0fSCleber RosaFEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x 1224ec49f0fSCleber RosaFEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES)) 1234ec49f0fSCleber Rosa 1244ec49f0fSCleber Rosa# download one specific Fedora 31 image 1254ec49f0fSCleber Rosaget-vm-image-fedora-31-%: check-venv 1264ec49f0fSCleber Rosa $(call quiet-command, \ 127caa0f7cbSJohn Snow $(TESTS_PYTHON) -m avocado vmimage get \ 1284ec49f0fSCleber Rosa --distro=fedora --distro-version=31 --arch=$*, \ 129333d7036SWillian Rampazzo "AVOCADO", "Downloading avocado tests VM image for $*") 1304ec49f0fSCleber Rosa 1314ec49f0fSCleber Rosa# download all vm images, according to defined targets 1324ec49f0fSCleber Rosaget-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD)) 1334ec49f0fSCleber Rosa 134333d7036SWillian Rampazzocheck-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-images 135a56931eeSCleber Rosa $(call quiet-command, \ 136caa0f7cbSJohn Snow $(TESTS_PYTHON) -m avocado \ 137a56931eeSCleber Rosa --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \ 13823022794SWillian Rampazzo $(if $(AVOCADO_TAGS),, --filter-by-tags-include-empty \ 13923022794SWillian Rampazzo --filter-by-tags-include-empty-key) \ 14023022794SWillian Rampazzo $(AVOCADO_CMDLINE_TAGS) \ 14194c71462SWillian Rampazzo $(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \ 142bbbd9b6eSWillian Rampazzo "AVOCADO", "tests/avocado") 143a56931eeSCleber Rosa 144333d7036SWillian Rampazzocheck-acceptance-deprecated-warning: 145333d7036SWillian Rampazzo @echo 146333d7036SWillian Rampazzo @echo "Note '$(MAKE) check-acceptance' is deprecated, use '$(MAKE) check-avocado' instead." 147333d7036SWillian Rampazzo @echo 148333d7036SWillian Rampazzo 149333d7036SWillian Rampazzocheck-acceptance: check-acceptance-deprecated-warning | check-avocado 150333d7036SWillian Rampazzo 15146e7b706SFam Zheng# Consolidated targets 15246e7b706SFam Zheng 153e287072bSThomas Huth.PHONY: check check-clean get-vm-images 154e781190cSPaolo Bonzinicheck: 155e781190cSPaolo Bonzini 156097a5f19SPaolo Bonzinicheck-build: run-ninja 157a6eeac3bSAlex Bennée 15846e7b706SFam Zhengcheck-clean: 159a56931eeSCleber Rosa rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR) 16046e7b706SFam Zheng 161425d6abaSThomas Huthclean: check-clean clean-tcg 16246e7b706SFam Zheng 163e45eaef9SFam Zhengendif 164