1# -*- Mode: makefile -*- 2 3.PHONY: check-help 4check-help: 5 @echo "Regression testing targets:" 6 @echo " $(MAKE) check Run block, qapi-schema, unit, softfloat, qtest and decodetree tests" 7 @echo " $(MAKE) bench Run speed tests" 8 @echo 9 @echo "Individual test suites:" 10 @echo " $(MAKE) check-qtest-TARGET Run qtest tests for given target" 11 @echo " $(MAKE) check-qtest Run qtest tests" 12 @echo " $(MAKE) check-functional Run python-based functional tests" 13 @echo " $(MAKE) check-functional-TARGET Run functional tests for a given target" 14 @echo " $(MAKE) check-unit Run qobject tests" 15 @echo " $(MAKE) check-qapi-schema Run QAPI schema tests" 16 @echo " $(MAKE) check-block Run block tests" 17ifneq ($(filter $(all-check-targets), check-softfloat),) 18 @echo " $(MAKE) check-tcg Run TCG tests" 19 @echo " $(MAKE) check-softfloat Run FPU emulation tests" 20endif 21 @echo " $(MAKE) check-avocado Run avocado (integration) tests for currently configured targets" 22 @echo 23 @echo " $(MAKE) check-report.junit.xml Generates an aggregated XML test report" 24 @echo " $(MAKE) check-venv Creates a Python venv for tests" 25 @echo " $(MAKE) check-clean Clean the tests and related data" 26 @echo 27 @echo "The following are useful for CI builds" 28 @echo " $(MAKE) check-build Build most test binaries" 29 @echo " $(MAKE) get-vm-images Downloads all images used by avocado tests, according to configured targets (~350 MB each, 1.5 GB max)" 30 @echo 31 @echo 32 @echo "The variable SPEED can be set to control the gtester speed setting." 33 @echo "Default options are -k and (for $(MAKE) V=1) --verbose; they can be" 34 @echo "changed with variable GTESTER_OPTIONS." 35 36ifneq ($(wildcard config-host.mak),) 37export SRC_PATH 38 39SPEED = quick 40 41# Per guest TCG tests 42BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS)) 43CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS)) 44DISTCLEAN_TCG_TARGET_RULES=$(patsubst %,distclean-tcg-tests-%, $(TCG_TESTS_TARGETS)) 45RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TCG_TESTS_TARGETS)) 46 47$(foreach TARGET,$(TCG_TESTS_TARGETS), \ 48 $(eval $(BUILD_DIR)/tests/tcg/config-$(TARGET).mak: config-host.mak)) 49 50.PHONY: $(TCG_TESTS_TARGETS:%=build-tcg-tests-%) 51$(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/tests/tcg/config-%.mak 52 $(call quiet-command, \ 53 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS), \ 54 "BUILD","$* guest-tests") 55 56.PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%) 57$(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-% 58 $(call quiet-command, \ 59 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) run, \ 60 "RUN", "$* guest-tests") 61 62.PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%) 63$(TCG_TESTS_TARGETS:%=clean-tcg-tests-%): clean-tcg-tests-%: 64 $(call quiet-command, \ 65 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) clean, \ 66 "CLEAN", "$* guest-tests") 67 68.PHONY: $(TCG_TESTS_TARGETS:%=distclean-tcg-tests-%) 69$(TCG_TESTS_TARGETS:%=distclean-tcg-tests-%): distclean-tcg-tests-%: 70 $(call quiet-command, \ 71 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) distclean, \ 72 "CLEAN", "$* guest-tests") 73 74.PHONY: build-tcg 75build-tcg: $(BUILD_TCG_TARGET_RULES) 76 77.PHONY: check-tcg 78.ninja-goals.check-tcg = all test-plugins 79check-tcg: $(RUN_TCG_TARGET_RULES) 80 81.PHONY: clean-tcg 82clean-tcg: $(CLEAN_TCG_TARGET_RULES) 83 84.PHONY: distclean-tcg 85distclean-tcg: $(DISTCLEAN_TCG_TARGET_RULES) 86 87# Python venv for running tests 88 89.PHONY: check-venv check-avocado check-acceptance check-acceptance-deprecated-warning 90 91# Build up our target list from the filtered list of ninja targets 92TARGETS=$(patsubst libqemu-%.a, %, $(filter libqemu-%.a, $(ninja-targets))) 93 94TESTS_VENV_TOKEN=$(BUILD_DIR)/pyvenv/tests.group 95TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results 96ifndef AVOCADO_TESTS 97 AVOCADO_TESTS=tests/avocado 98endif 99# Controls the output generated by Avocado when running tests. 100# Any number of command separated loggers are accepted. For more 101# information please refer to "avocado --help". 102AVOCADO_SHOW?=app 103ifndef AVOCADO_TAGS 104 AVOCADO_CMDLINE_TAGS=$(patsubst %-softmmu,-t arch:%, \ 105 $(filter %-softmmu,$(TARGETS))) 106else 107 AVOCADO_CMDLINE_TAGS=$(addprefix -t , $(AVOCADO_TAGS)) 108endif 109 110quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \ 111 $(PYTHON) -m pip -q --disable-pip-version-check $1, \ 112 "VENVPIP","$1") 113 114$(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml 115 $(call quiet-venv-pip,install -e "$(SRC_PATH)/python/") 116 $(MKVENV_ENSUREGROUP) $< avocado 117 $(call quiet-command, touch $@) 118 119$(TESTS_RESULTS_DIR): 120 $(call quiet-command, mkdir -p $@, \ 121 MKDIR, $@) 122 123check-venv: $(TESTS_VENV_TOKEN) 124 125FEDORA_31_ARCHES_TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGETS))) 126FEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(FEDORA_31_ARCHES_TARGETS)) 127FEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x 128FEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES)) 129 130# download one specific Fedora 31 image 131get-vm-image-fedora-31-%: check-venv 132 $(call quiet-command, \ 133 $(PYTHON) -m avocado vmimage get \ 134 --distro=fedora --distro-version=31 --arch=$*, \ 135 "AVOCADO", "Downloading avocado tests VM image for $*") 136 137# download all vm images, according to defined targets 138get-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD)) 139 140check-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-images 141 $(call quiet-command, \ 142 $(PYTHON) -m avocado \ 143 --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \ 144 $(if $(AVOCADO_TAGS),, --filter-by-tags-include-empty \ 145 --filter-by-tags-include-empty-key) \ 146 $(AVOCADO_CMDLINE_TAGS) --max-parallel-tasks=1 \ 147 $(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \ 148 "AVOCADO", "tests/avocado") 149 150check-acceptance-deprecated-warning: 151 @echo 152 @echo "Note '$(MAKE) check-acceptance' is deprecated, use '$(MAKE) check-avocado' instead." 153 @echo 154 155check-acceptance: check-acceptance-deprecated-warning | check-avocado 156 157FUNCTIONAL_TARGETS=$(patsubst %-softmmu,check-functional-%, $(filter %-softmmu,$(TARGETS))) 158.PHONY: $(FUNCTIONAL_TARGETS) 159$(FUNCTIONAL_TARGETS): 160 @$(MAKE) SPEED=thorough $(subst -functional,-func,$@) 161 162.PHONY: check-functional 163check-functional: 164 @$(NINJA) precache-functional 165 @QEMU_TEST_NO_DOWNLOAD=1 $(MAKE) SPEED=thorough check-func check-func-quick 166 167# Consolidated targets 168 169.PHONY: check check-clean get-vm-images 170check: 171 172check-build: run-ninja 173 174check-clean: 175 rm -rf $(TESTS_RESULTS_DIR) 176 177clean: check-clean clean-tcg 178distclean: distclean-tcg 179 180endif 181