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 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 438ba0a820SAlex Bennée# Per guest TCG tests 448ba0a820SAlex Bennée 45e24e66f0SAlex BennéeBUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS)) 46e24e66f0SAlex BennéeCLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TARGET_DIRS)) 47e24e66f0SAlex BennéeRUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TARGET_DIRS)) 488ba0a820SAlex Bennée 491a7fab92SAlex Bennée# Probe for the Docker Builds needed for each build 502b1f35b9SAlex Bennée$(foreach PROBE_TARGET,$(TARGET_DIRS), \ 51fc76c56dSPaolo Bonzini $(eval -include $(SRC_PATH)/tests/tcg/Makefile.prereqs)) 521a7fab92SAlex Bennée 53*8c17b840SPaolo Bonzini$(BUILD_TCG_TARGET_RULES): build-tcg-tests-%: $(if $(CONFIG_PLUGIN),test-plugins) 54fc76c56dSPaolo Bonzini $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ 55fc76c56dSPaolo Bonzini -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ 56fc76c56dSPaolo Bonzini SRC_PATH=$(SRC_PATH) \ 572038f8c8SPaolo Bonzini V="$(V)" TARGET="$*" guest-tests, \ 58cff54773SAlex Bennée "BUILD", "TCG tests for $*") 598ba0a820SAlex Bennée 60*8c17b840SPaolo Bonzini$(RUN_TCG_TARGET_RULES): run-tcg-tests-%: build-tcg-tests-% all 61fc76c56dSPaolo Bonzini $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ 62fc76c56dSPaolo Bonzini -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ 63fc76c56dSPaolo Bonzini SRC_PATH=$(SRC_PATH) SPEED="$(SPEED)" \ 642038f8c8SPaolo Bonzini V="$(V)" TARGET="$*" run-guest-tests, \ 65cff54773SAlex Bennée "RUN", "TCG tests for $*") 668ba0a820SAlex Bennée 67*8c17b840SPaolo Bonzini$(CLEAN_TCG_TARGET_RULES): clean-tcg-tests-%: 68fc76c56dSPaolo Bonzini $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ 69fc76c56dSPaolo Bonzini -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ 702038f8c8SPaolo Bonzini SRC_PATH=$(SRC_PATH) TARGET="$*" clean-guest-tests, \ 71dda60da3SAlex Bennée "CLEAN", "TCG tests for $*") 728ba0a820SAlex Bennée 738ba0a820SAlex Bennée.PHONY: build-tcg 748ba0a820SAlex Bennéebuild-tcg: $(BUILD_TCG_TARGET_RULES) 758ba0a820SAlex Bennée 768ba0a820SAlex Bennée.PHONY: check-tcg 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 8221313721SCleber Rosa# Python venv for running tests 8321313721SCleber Rosa 84a56931eeSCleber Rosa.PHONY: check-venv check-acceptance 8521313721SCleber Rosa 8621313721SCleber RosaTESTS_VENV_DIR=$(BUILD_DIR)/tests/venv 8721313721SCleber RosaTESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt 88a56931eeSCleber RosaTESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results 89a56931eeSCleber Rosa# Controls the output generated by Avocado when running tests. 90a56931eeSCleber Rosa# Any number of command separated loggers are accepted. For more 91a56931eeSCleber Rosa# information please refer to "avocado --help". 9259692a12SCleber RosaAVOCADO_SHOW=app 93b194713fSCleber RosaAVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGET_DIRS))) 9421313721SCleber Rosa 9521313721SCleber Rosa$(TESTS_VENV_DIR): $(TESTS_VENV_REQ) 9621313721SCleber Rosa $(call quiet-command, \ 9721313721SCleber Rosa $(PYTHON) -m venv --system-site-packages $@, \ 9821313721SCleber Rosa VENV, $@) 9921313721SCleber Rosa $(call quiet-command, \ 10021313721SCleber Rosa $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \ 10121313721SCleber Rosa PIP, $(TESTS_VENV_REQ)) 10221313721SCleber Rosa $(call quiet-command, touch $@) 10321313721SCleber Rosa 104a56931eeSCleber Rosa$(TESTS_RESULTS_DIR): 105a56931eeSCleber Rosa $(call quiet-command, mkdir -p $@, \ 106a56931eeSCleber Rosa MKDIR, $@) 107a56931eeSCleber Rosa 10821313721SCleber Rosacheck-venv: $(TESTS_VENV_DIR) 10921313721SCleber Rosa 1104ec49f0fSCleber RosaFEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(TARGETS)) 1114ec49f0fSCleber RosaFEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x 1124ec49f0fSCleber RosaFEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES)) 1134ec49f0fSCleber Rosa 1144ec49f0fSCleber Rosa# download one specific Fedora 31 image 1154ec49f0fSCleber Rosaget-vm-image-fedora-31-%: check-venv 1164ec49f0fSCleber Rosa $(call quiet-command, \ 1174ec49f0fSCleber Rosa $(TESTS_VENV_DIR)/bin/python -m avocado vmimage get \ 1184ec49f0fSCleber Rosa --distro=fedora --distro-version=31 --arch=$*, \ 1194ec49f0fSCleber Rosa "AVOCADO", "Downloading acceptance tests VM image for $*") 1204ec49f0fSCleber Rosa 1214ec49f0fSCleber Rosa# download all vm images, according to defined targets 1224ec49f0fSCleber Rosaget-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD)) 1234ec49f0fSCleber Rosa 1244ec49f0fSCleber Rosacheck-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images 125a56931eeSCleber Rosa $(call quiet-command, \ 126a56931eeSCleber Rosa $(TESTS_VENV_DIR)/bin/python -m avocado \ 127a56931eeSCleber Rosa --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \ 128b194713fSCleber Rosa --filter-by-tags-include-empty --filter-by-tags-include-empty-key \ 129b194713fSCleber Rosa $(AVOCADO_TAGS) \ 13094b4ec24SPavel Dovgalyuk $(if $(GITLAB_CI),,--failfast) tests/acceptance, \ 131a56931eeSCleber Rosa "AVOCADO", "tests/acceptance") 132a56931eeSCleber Rosa 13346e7b706SFam Zheng# Consolidated targets 13446e7b706SFam Zheng 135279588d4SMarc-André Lureau.PHONY: check-block check check-clean get-vm-images 136e781190cSPaolo Bonzinicheck: 137e781190cSPaolo Bonzini 138e781190cSPaolo Bonziniifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy) 139e781190cSPaolo BonziniQEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) = tests/qemu-iotests/socket_scm_helper$(EXESUF) 140e781190cSPaolo Bonzinicheck: check-block 141e781190cSPaolo Bonzinicheck-block: $(SRC_PATH)/tests/check-block.sh qemu-img$(EXESUF) \ 142e781190cSPaolo Bonzini qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \ 143e781190cSPaolo Bonzini $(patsubst %-softmmu,qemu-system-%,$(filter %-softmmu,$(TARGET_DIRS))) 144e781190cSPaolo Bonzini @$< 145e781190cSPaolo Bonziniendif 146e781190cSPaolo Bonzini 147279588d4SMarc-André Lureaucheck-build: $(QEMU_IOTESTS_HELPERS-y) 148a6eeac3bSAlex Bennée 14946e7b706SFam Zhengcheck-clean: 150a56931eeSCleber Rosa rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR) 15146e7b706SFam Zheng 15246e7b706SFam Zhengclean: check-clean 15346e7b706SFam Zheng 1549ed7247aSPaolo Bonzini# For backwards compatibility 1559ed7247aSPaolo Bonzini 1569ed7247aSPaolo Bonzinicheck-speed: bench-speed 1579ed7247aSPaolo Bonzini 158e45eaef9SFam Zhengendif 159