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-unit Run qobject tests" 13 @echo " $(MAKE) check-qapi-schema Run QAPI schema tests" 14 @echo " $(MAKE) check-block Run block tests" 15ifneq ($(filter $(all-check-targets), check-softfloat),) 16 @echo " $(MAKE) check-tcg Run TCG tests" 17 @echo " $(MAKE) check-softfloat Run FPU emulation tests" 18endif 19 @echo " $(MAKE) check-acceptance Run all acceptance (functional) tests" 20 @echo 21 @echo " $(MAKE) check-report.tap Generates an aggregated TAP test report" 22 @echo " $(MAKE) check-venv Creates a Python venv for tests" 23 @echo " $(MAKE) check-clean Clean the tests and related data" 24 @echo 25 @echo "The following are useful for CI builds" 26 @echo " $(MAKE) check-build Build most test binaris" 27 @echo " $(MAKE) get-vm-images Downloads all images used by acceptance tests, according to configured targets (~350 MB each, 1.5 GB max)" 28 @echo 29 @echo 30 @echo "The variable SPEED can be set to control the gtester speed setting." 31 @echo "Default options are -k and (for $(MAKE) V=1) --verbose; they can be" 32 @echo "changed with variable GTESTER_OPTIONS." 33 34ifneq ($(wildcard config-host.mak),) 35export SRC_PATH 36 37# Get the list of all supported sysemu targets 38SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \ 39 $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak))) 40 41SPEED = quick 42 43# Build up our target list from the filtered list of ninja targets 44TARGETS=$(patsubst libqemu-%.fa, %, $(filter libqemu-%.fa, $(ninja-targets))) 45 46# Per guest TCG tests 47BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGETS)) 48CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TARGETS)) 49RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TARGETS)) 50 51# Probe for the Docker Builds needed for each build 52$(foreach PROBE_TARGET,$(TARGET_DIRS), \ 53 $(eval -include $(SRC_PATH)/tests/tcg/Makefile.prereqs)) 54 55$(BUILD_TCG_TARGET_RULES): build-tcg-tests-%: $(if $(CONFIG_PLUGIN),test-plugins) 56 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ 57 -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ 58 SRC_PATH=$(SRC_PATH) \ 59 V="$(V)" TARGET="$*" guest-tests, \ 60 "BUILD", "TCG tests for $*") 61 62$(RUN_TCG_TARGET_RULES): run-tcg-tests-%: build-tcg-tests-% all 63 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ 64 -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ 65 SRC_PATH=$(SRC_PATH) SPEED="$(SPEED)" \ 66 V="$(V)" TARGET="$*" run-guest-tests, \ 67 "RUN", "TCG tests for $*") 68 69$(CLEAN_TCG_TARGET_RULES): clean-tcg-tests-%: 70 $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ 71 -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ 72 SRC_PATH=$(SRC_PATH) TARGET="$*" clean-guest-tests, \ 73 "CLEAN", "TCG tests for $*") 74 75.PHONY: build-tcg 76build-tcg: $(BUILD_TCG_TARGET_RULES) 77 78.PHONY: check-tcg 79check-tcg: $(RUN_TCG_TARGET_RULES) 80 81.PHONY: clean-tcg 82clean-tcg: $(CLEAN_TCG_TARGET_RULES) 83 84# Python venv for running tests 85 86.PHONY: check-venv check-acceptance 87 88TESTS_VENV_DIR=$(BUILD_DIR)/tests/venv 89TESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt 90TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results 91# Controls the output generated by Avocado when running tests. 92# Any number of command separated loggers are accepted. For more 93# information please refer to "avocado --help". 94AVOCADO_SHOW=app 95AVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGETS))) 96 97$(TESTS_VENV_DIR): $(TESTS_VENV_REQ) 98 $(call quiet-command, \ 99 $(PYTHON) -m venv --system-site-packages $@, \ 100 VENV, $@) 101 $(call quiet-command, \ 102 $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \ 103 PIP, $(TESTS_VENV_REQ)) 104 $(call quiet-command, touch $@) 105 106$(TESTS_RESULTS_DIR): 107 $(call quiet-command, mkdir -p $@, \ 108 MKDIR, $@) 109 110check-venv: $(TESTS_VENV_DIR) 111 112FEDORA_31_ARCHES_TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGETS))) 113FEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(FEDORA_31_ARCHES_TARGETS)) 114FEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x 115FEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES)) 116 117# download one specific Fedora 31 image 118get-vm-image-fedora-31-%: check-venv 119 $(call quiet-command, \ 120 $(TESTS_VENV_DIR)/bin/python -m avocado vmimage get \ 121 --distro=fedora --distro-version=31 --arch=$*, \ 122 "AVOCADO", "Downloading acceptance tests VM image for $*") 123 124# download all vm images, according to defined targets 125get-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD)) 126 127check-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images 128 $(call quiet-command, \ 129 $(TESTS_VENV_DIR)/bin/python -m avocado \ 130 --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \ 131 --filter-by-tags-include-empty --filter-by-tags-include-empty-key \ 132 $(AVOCADO_TAGS) \ 133 $(if $(GITLAB_CI),,--failfast) tests/acceptance, \ 134 "AVOCADO", "tests/acceptance") 135 136# Consolidated targets 137 138.PHONY: check-block check check-clean get-vm-images 139check: 140 141ifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy) 142QEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) = tests/qemu-iotests/socket_scm_helper$(EXESUF) 143check: check-block 144export PYTHON 145check-block: $(SRC_PATH)/tests/check-block.sh qemu-img$(EXESUF) \ 146 qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \ 147 $(filter qemu-system-%, $(ninja-targets)) 148 @$< 149endif 150 151check-build: $(QEMU_IOTESTS_HELPERS-y) 152 153check-clean: 154 rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR) 155 156clean: check-clean 157 158endif 159