1 # -*- Mode: makefile -*-
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"
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"
15 ifneq ($(filter $(all-check-targets), check-softfloat),)
16 @echo " $(MAKE) check-tcg Run TCG tests"
17 @echo " $(MAKE) check-softfloat Run FPU emulation tests"
19 @echo " $(MAKE) check-avocado Run avocado (integration) tests for currently configured targets"
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"
25 @echo "The following are useful for CI builds"
26 @echo " $(MAKE) check-build Build most test binaries"
27 @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 "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."
34 ifneq ($(wildcard config-host.mak),)
39 -include tests/tcg/Makefile.prereqs
40 config-host.mak: $(SRC_PATH)/tests/tcg/configure.sh
41 tests/tcg/Makefile.prereqs: config-host.mak
44 BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS))
45 CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS))
46 RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TCG_TESTS_TARGETS))
48 $(foreach TARGET,$(TCG_TESTS_TARGETS), \
49 $(eval $(BUILD_DIR)/tests/tcg/config-$(TARGET).mak: config-host.mak))
51 .PHONY: $(TCG_TESTS_TARGETS:%=build-tcg-tests-%)
52 $(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/tests/tcg/config-%.mak
53 $(call quiet-command, \
54 $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \
55 DOCKER_SCRIPT="$(DOCKER_SCRIPT)" \
56 TARGET="$*" SRC_PATH="$(SRC_PATH)", \
57 "BUILD","$* guest-tests")
59 .PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%)
60 $(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-% $(if $(CONFIG_PLUGIN),test-plugins)
61 $(call quiet-command, \
62 $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \
63 TARGET="$*" SRC_PATH="$(SRC_PATH)" SPEED=$(SPEED) run, \
64 "RUN", "$* guest-tests")
66 .PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%)
67 $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%): clean-tcg-tests-%:
68 $(call quiet-command, \
69 $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \
70 TARGET="$*" SRC_PATH="$(SRC_PATH)" clean, \
71 "CLEAN", "$* guest-tests")
74 build-tcg: $(BUILD_TCG_TARGET_RULES)
77 check-tcg: $(RUN_TCG_TARGET_RULES)
80 clean-tcg: $(CLEAN_TCG_TARGET_RULES)
82 # Python venv for running tests
84 .PHONY: check-venv check-avocado check-acceptance check-acceptance-deprecated-warning
86 # Build up our target list from the filtered list of ninja targets
87 TARGETS=$(patsubst libqemu-%.fa, %, $(filter libqemu-%.fa, $(ninja-targets)))
89 TESTS_VENV_DIR=$(BUILD_DIR)/tests/venv
90 TESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt
91 TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
93 AVOCADO_TESTS=tests/avocado
95 # Controls the output generated by Avocado when running tests.
96 # Any number of command separated loggers are accepted. For more
97 # information please refer to "avocado --help".
100 AVOCADO_CMDLINE_TAGS=$(patsubst %-softmmu,-t arch:%, \
101 $(filter %-softmmu,$(TARGETS)))
103 AVOCADO_CMDLINE_TAGS=$(addprefix -t , $(AVOCADO_TAGS))
106 $(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
107 $(call quiet-command, \
108 $(PYTHON) -m venv $@, \
110 $(call quiet-command, \
111 $(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
112 PIP, $(TESTS_VENV_REQ))
113 $(call quiet-command, touch $@)
115 $(TESTS_RESULTS_DIR):
116 $(call quiet-command, mkdir -p $@, \
119 check-venv: $(TESTS_VENV_DIR)
121 FEDORA_31_ARCHES_TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGETS)))
122 FEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(FEDORA_31_ARCHES_TARGETS))
123 FEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x
124 FEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES))
126 # download one specific Fedora 31 image
127 get-vm-image-fedora-31-%: check-venv
128 $(call quiet-command, \
129 $(TESTS_VENV_DIR)/bin/python -m avocado vmimage get \
130 --distro=fedora --distro-version=31 --arch=$*, \
131 "AVOCADO", "Downloading avocado tests VM image for $*")
133 # download all vm images, according to defined targets
134 get-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD))
136 check-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-images
137 $(call quiet-command, \
138 $(TESTS_VENV_DIR)/bin/python -m avocado \
139 --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
140 $(if $(AVOCADO_TAGS),, --filter-by-tags-include-empty \
141 --filter-by-tags-include-empty-key) \
142 $(AVOCADO_CMDLINE_TAGS) \
143 $(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \
144 "AVOCADO", "tests/avocado")
146 check-acceptance-deprecated-warning:
148 @echo "Note '$(MAKE) check-acceptance' is deprecated, use '$(MAKE) check-avocado' instead."
151 check-acceptance: check-acceptance-deprecated-warning | check-avocado
153 # Consolidated targets
155 .PHONY: check check-clean get-vm-images
158 check-build: run-ninja
161 rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
163 clean: check-clean clean-tcg