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 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" 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# Build up our target list from the filtered list of ninja targets 40c401c058SAlex BennéeTARGETS=$(patsubst libqemu-%.fa, %, $(filter libqemu-%.fa, $(ninja-targets))) 418ba0a820SAlex Bennée 42c401c058SAlex Bennée# Per guest TCG tests 43c401c058SAlex BennéeBUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGETS)) 44c401c058SAlex BennéeCLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TARGETS)) 45c401c058SAlex BennéeRUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TARGETS)) 468ba0a820SAlex Bennée 471a7fab92SAlex Bennée# Probe for the Docker Builds needed for each build 482b1f35b9SAlex Bennée$(foreach PROBE_TARGET,$(TARGET_DIRS), \ 49fc76c56dSPaolo Bonzini $(eval -include $(SRC_PATH)/tests/tcg/Makefile.prereqs)) 501a7fab92SAlex Bennée 518c17b840SPaolo Bonzini$(BUILD_TCG_TARGET_RULES): build-tcg-tests-%: $(if $(CONFIG_PLUGIN),test-plugins) 52fc76c56dSPaolo Bonzini $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ 53fc76c56dSPaolo Bonzini -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ 54fc76c56dSPaolo Bonzini SRC_PATH=$(SRC_PATH) \ 552038f8c8SPaolo Bonzini V="$(V)" TARGET="$*" guest-tests, \ 56cff54773SAlex Bennée "BUILD", "TCG tests for $*") 578ba0a820SAlex Bennée 588c17b840SPaolo Bonzini$(RUN_TCG_TARGET_RULES): run-tcg-tests-%: build-tcg-tests-% all 59fc76c56dSPaolo Bonzini $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ 60fc76c56dSPaolo Bonzini -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ 61fc76c56dSPaolo Bonzini SRC_PATH=$(SRC_PATH) SPEED="$(SPEED)" \ 622038f8c8SPaolo Bonzini V="$(V)" TARGET="$*" run-guest-tests, \ 63cff54773SAlex Bennée "RUN", "TCG tests for $*") 648ba0a820SAlex Bennée 658c17b840SPaolo Bonzini$(CLEAN_TCG_TARGET_RULES): clean-tcg-tests-%: 66fc76c56dSPaolo Bonzini $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ 67fc76c56dSPaolo Bonzini -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ 682038f8c8SPaolo Bonzini SRC_PATH=$(SRC_PATH) TARGET="$*" clean-guest-tests, \ 69dda60da3SAlex Bennée "CLEAN", "TCG tests for $*") 708ba0a820SAlex Bennée 718ba0a820SAlex Bennée.PHONY: build-tcg 728ba0a820SAlex Bennéebuild-tcg: $(BUILD_TCG_TARGET_RULES) 738ba0a820SAlex Bennée 748ba0a820SAlex Bennée.PHONY: check-tcg 75df2bb38eSAlex Bennéecheck-tcg: $(RUN_TCG_TARGET_RULES) 768ba0a820SAlex Bennée 778ba0a820SAlex Bennée.PHONY: clean-tcg 788ba0a820SAlex Bennéeclean-tcg: $(CLEAN_TCG_TARGET_RULES) 7946e7b706SFam Zheng 8021313721SCleber Rosa# Python venv for running tests 8121313721SCleber Rosa 82333d7036SWillian Rampazzo.PHONY: check-venv check-avocado check-acceptance check-acceptance-deprecated-warning 8321313721SCleber Rosa 8421313721SCleber RosaTESTS_VENV_DIR=$(BUILD_DIR)/tests/venv 8521313721SCleber RosaTESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt 86a56931eeSCleber RosaTESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results 8794c71462SWillian Rampazzoifndef AVOCADO_TESTS 88bbbd9b6eSWillian Rampazzo AVOCADO_TESTS=tests/avocado 8994c71462SWillian Rampazzoendif 90a56931eeSCleber Rosa# Controls the output generated by Avocado when running tests. 91a56931eeSCleber Rosa# Any number of command separated loggers are accepted. For more 92a56931eeSCleber Rosa# information please refer to "avocado --help". 9359692a12SCleber RosaAVOCADO_SHOW=app 9423022794SWillian Rampazzoifndef AVOCADO_TAGS 9523022794SWillian Rampazzo AVOCADO_CMDLINE_TAGS=$(patsubst %-softmmu,-t arch:%, \ 9623022794SWillian Rampazzo $(filter %-softmmu,$(TARGETS))) 9723022794SWillian Rampazzoelse 9823022794SWillian Rampazzo AVOCADO_CMDLINE_TAGS=$(addprefix -t , $(AVOCADO_TAGS)) 9923022794SWillian Rampazzoendif 10021313721SCleber Rosa 10121313721SCleber Rosa$(TESTS_VENV_DIR): $(TESTS_VENV_REQ) 10221313721SCleber Rosa $(call quiet-command, \ 103414e9ae3SCleber Rosa $(PYTHON) -m venv $@, \ 10421313721SCleber Rosa VENV, $@) 10521313721SCleber Rosa $(call quiet-command, \ 10621313721SCleber Rosa $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \ 10721313721SCleber Rosa PIP, $(TESTS_VENV_REQ)) 10821313721SCleber Rosa $(call quiet-command, touch $@) 10921313721SCleber Rosa 110a56931eeSCleber Rosa$(TESTS_RESULTS_DIR): 111a56931eeSCleber Rosa $(call quiet-command, mkdir -p $@, \ 112a56931eeSCleber Rosa MKDIR, $@) 113a56931eeSCleber Rosa 11421313721SCleber Rosacheck-venv: $(TESTS_VENV_DIR) 11521313721SCleber Rosa 11693fca0f2SCleber RosaFEDORA_31_ARCHES_TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGETS))) 11793fca0f2SCleber RosaFEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(FEDORA_31_ARCHES_TARGETS)) 1184ec49f0fSCleber RosaFEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x 1194ec49f0fSCleber RosaFEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES)) 1204ec49f0fSCleber Rosa 1214ec49f0fSCleber Rosa# download one specific Fedora 31 image 1224ec49f0fSCleber Rosaget-vm-image-fedora-31-%: check-venv 1234ec49f0fSCleber Rosa $(call quiet-command, \ 1244ec49f0fSCleber Rosa $(TESTS_VENV_DIR)/bin/python -m avocado vmimage get \ 1254ec49f0fSCleber Rosa --distro=fedora --distro-version=31 --arch=$*, \ 126333d7036SWillian Rampazzo "AVOCADO", "Downloading avocado tests VM image for $*") 1274ec49f0fSCleber Rosa 1284ec49f0fSCleber Rosa# download all vm images, according to defined targets 1294ec49f0fSCleber Rosaget-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD)) 1304ec49f0fSCleber Rosa 131333d7036SWillian Rampazzocheck-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-images 132a56931eeSCleber Rosa $(call quiet-command, \ 133a56931eeSCleber Rosa $(TESTS_VENV_DIR)/bin/python -m avocado \ 134a56931eeSCleber Rosa --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \ 13523022794SWillian Rampazzo $(if $(AVOCADO_TAGS),, --filter-by-tags-include-empty \ 13623022794SWillian Rampazzo --filter-by-tags-include-empty-key) \ 13723022794SWillian Rampazzo $(AVOCADO_CMDLINE_TAGS) \ 13894c71462SWillian Rampazzo $(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \ 139bbbd9b6eSWillian Rampazzo "AVOCADO", "tests/avocado") 140a56931eeSCleber Rosa 141333d7036SWillian Rampazzocheck-acceptance-deprecated-warning: 142333d7036SWillian Rampazzo @echo 143333d7036SWillian Rampazzo @echo "Note '$(MAKE) check-acceptance' is deprecated, use '$(MAKE) check-avocado' instead." 144333d7036SWillian Rampazzo @echo 145333d7036SWillian Rampazzo 146333d7036SWillian Rampazzocheck-acceptance: check-acceptance-deprecated-warning | check-avocado 147333d7036SWillian Rampazzo 14846e7b706SFam Zheng# Consolidated targets 14946e7b706SFam Zheng 150e287072bSThomas Huth.PHONY: check check-clean get-vm-images 151e781190cSPaolo Bonzinicheck: 152e781190cSPaolo Bonzini 153097a5f19SPaolo Bonzinicheck-build: run-ninja 154a6eeac3bSAlex Bennée 15546e7b706SFam Zhengcheck-clean: 156a56931eeSCleber Rosa rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR) 15746e7b706SFam Zheng 158*425d6abaSThomas Huthclean: check-clean clean-tcg 15946e7b706SFam Zheng 160e45eaef9SFam Zhengendif 161