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" 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 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 3746e7b706SFam Zheng# Get the list of all supported sysemu targets 3846e7b706SFam ZhengSYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \ 3946e7b706SFam Zheng $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak))) 4046e7b706SFam Zheng 4146e7b706SFam ZhengSPEED = quick 4246e7b706SFam Zheng 43c401c058SAlex Bennée# Build up our target list from the filtered list of ninja targets 44c401c058SAlex BennéeTARGETS=$(patsubst libqemu-%.fa, %, $(filter libqemu-%.fa, $(ninja-targets))) 458ba0a820SAlex Bennée 46c401c058SAlex Bennée# Per guest TCG tests 47c401c058SAlex BennéeBUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGETS)) 48c401c058SAlex BennéeCLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TARGETS)) 49c401c058SAlex BennéeRUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TARGETS)) 508ba0a820SAlex Bennée 511a7fab92SAlex Bennée# Probe for the Docker Builds needed for each build 522b1f35b9SAlex Bennée$(foreach PROBE_TARGET,$(TARGET_DIRS), \ 53fc76c56dSPaolo Bonzini $(eval -include $(SRC_PATH)/tests/tcg/Makefile.prereqs)) 541a7fab92SAlex Bennée 558c17b840SPaolo Bonzini$(BUILD_TCG_TARGET_RULES): build-tcg-tests-%: $(if $(CONFIG_PLUGIN),test-plugins) 56fc76c56dSPaolo Bonzini $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ 57fc76c56dSPaolo Bonzini -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ 58fc76c56dSPaolo Bonzini SRC_PATH=$(SRC_PATH) \ 592038f8c8SPaolo Bonzini V="$(V)" TARGET="$*" guest-tests, \ 60cff54773SAlex Bennée "BUILD", "TCG tests for $*") 618ba0a820SAlex Bennée 628c17b840SPaolo Bonzini$(RUN_TCG_TARGET_RULES): run-tcg-tests-%: build-tcg-tests-% all 63fc76c56dSPaolo Bonzini $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ 64fc76c56dSPaolo Bonzini -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ 65fc76c56dSPaolo Bonzini SRC_PATH=$(SRC_PATH) SPEED="$(SPEED)" \ 662038f8c8SPaolo Bonzini V="$(V)" TARGET="$*" run-guest-tests, \ 67cff54773SAlex Bennée "RUN", "TCG tests for $*") 688ba0a820SAlex Bennée 698c17b840SPaolo Bonzini$(CLEAN_TCG_TARGET_RULES): clean-tcg-tests-%: 70fc76c56dSPaolo Bonzini $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ 71fc76c56dSPaolo Bonzini -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ 722038f8c8SPaolo Bonzini SRC_PATH=$(SRC_PATH) TARGET="$*" clean-guest-tests, \ 73dda60da3SAlex Bennée "CLEAN", "TCG tests for $*") 748ba0a820SAlex Bennée 758ba0a820SAlex Bennée.PHONY: build-tcg 768ba0a820SAlex Bennéebuild-tcg: $(BUILD_TCG_TARGET_RULES) 778ba0a820SAlex Bennée 788ba0a820SAlex Bennée.PHONY: check-tcg 79df2bb38eSAlex Bennéecheck-tcg: $(RUN_TCG_TARGET_RULES) 808ba0a820SAlex Bennée 818ba0a820SAlex Bennée.PHONY: clean-tcg 828ba0a820SAlex Bennéeclean-tcg: $(CLEAN_TCG_TARGET_RULES) 8346e7b706SFam Zheng 8421313721SCleber Rosa# Python venv for running tests 8521313721SCleber Rosa 86a56931eeSCleber Rosa.PHONY: check-venv check-acceptance 8721313721SCleber Rosa 8821313721SCleber RosaTESTS_VENV_DIR=$(BUILD_DIR)/tests/venv 8921313721SCleber RosaTESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt 90a56931eeSCleber RosaTESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results 91a56931eeSCleber Rosa# Controls the output generated by Avocado when running tests. 92a56931eeSCleber Rosa# Any number of command separated loggers are accepted. For more 93a56931eeSCleber Rosa# information please refer to "avocado --help". 9459692a12SCleber RosaAVOCADO_SHOW=app 95b194713fSCleber RosaAVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGET_DIRS))) 9621313721SCleber Rosa 9721313721SCleber Rosa$(TESTS_VENV_DIR): $(TESTS_VENV_REQ) 9821313721SCleber Rosa $(call quiet-command, \ 9921313721SCleber Rosa $(PYTHON) -m venv --system-site-packages $@, \ 10021313721SCleber Rosa VENV, $@) 10121313721SCleber Rosa $(call quiet-command, \ 10221313721SCleber Rosa $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \ 10321313721SCleber Rosa PIP, $(TESTS_VENV_REQ)) 10421313721SCleber Rosa $(call quiet-command, touch $@) 10521313721SCleber Rosa 106a56931eeSCleber Rosa$(TESTS_RESULTS_DIR): 107a56931eeSCleber Rosa $(call quiet-command, mkdir -p $@, \ 108a56931eeSCleber Rosa MKDIR, $@) 109a56931eeSCleber Rosa 11021313721SCleber Rosacheck-venv: $(TESTS_VENV_DIR) 11121313721SCleber Rosa 112*93fca0f2SCleber RosaFEDORA_31_ARCHES_TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGETS))) 113*93fca0f2SCleber RosaFEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(FEDORA_31_ARCHES_TARGETS)) 1144ec49f0fSCleber RosaFEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x 1154ec49f0fSCleber RosaFEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES)) 1164ec49f0fSCleber Rosa 1174ec49f0fSCleber Rosa# download one specific Fedora 31 image 1184ec49f0fSCleber Rosaget-vm-image-fedora-31-%: check-venv 1194ec49f0fSCleber Rosa $(call quiet-command, \ 1204ec49f0fSCleber Rosa $(TESTS_VENV_DIR)/bin/python -m avocado vmimage get \ 1214ec49f0fSCleber Rosa --distro=fedora --distro-version=31 --arch=$*, \ 1224ec49f0fSCleber Rosa "AVOCADO", "Downloading acceptance tests VM image for $*") 1234ec49f0fSCleber Rosa 1244ec49f0fSCleber Rosa# download all vm images, according to defined targets 1254ec49f0fSCleber Rosaget-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD)) 1264ec49f0fSCleber Rosa 1274ec49f0fSCleber Rosacheck-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images 128a56931eeSCleber Rosa $(call quiet-command, \ 129a56931eeSCleber Rosa $(TESTS_VENV_DIR)/bin/python -m avocado \ 130a56931eeSCleber Rosa --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \ 131b194713fSCleber Rosa --filter-by-tags-include-empty --filter-by-tags-include-empty-key \ 132b194713fSCleber Rosa $(AVOCADO_TAGS) \ 13394b4ec24SPavel Dovgalyuk $(if $(GITLAB_CI),,--failfast) tests/acceptance, \ 134a56931eeSCleber Rosa "AVOCADO", "tests/acceptance") 135a56931eeSCleber Rosa 13646e7b706SFam Zheng# Consolidated targets 13746e7b706SFam Zheng 138279588d4SMarc-André Lureau.PHONY: check-block check check-clean get-vm-images 139e781190cSPaolo Bonzinicheck: 140e781190cSPaolo Bonzini 141e781190cSPaolo Bonziniifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy) 142e781190cSPaolo BonziniQEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) = tests/qemu-iotests/socket_scm_helper$(EXESUF) 143e781190cSPaolo Bonzinicheck: check-block 1444cea90beSVladimir Sementsov-Ogievskiyexport PYTHON 145e781190cSPaolo Bonzinicheck-block: $(SRC_PATH)/tests/check-block.sh qemu-img$(EXESUF) \ 146e781190cSPaolo Bonzini qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \ 14709e93326SPaolo Bonzini $(filter qemu-system-%, $(ninja-targets)) 148e781190cSPaolo Bonzini @$< 149e781190cSPaolo Bonziniendif 150e781190cSPaolo Bonzini 151279588d4SMarc-André Lureaucheck-build: $(QEMU_IOTESTS_HELPERS-y) 152a6eeac3bSAlex Bennée 15346e7b706SFam Zhengcheck-clean: 154a56931eeSCleber Rosa rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR) 15546e7b706SFam Zheng 15646e7b706SFam Zhengclean: check-clean 15746e7b706SFam Zheng 1589ed7247aSPaolo Bonzini# For backwards compatibility 1599ed7247aSPaolo Bonzini 1609ed7247aSPaolo Bonzinicheck-speed: bench-speed 1619ed7247aSPaolo Bonzini 162e45eaef9SFam Zhengendif 163