]> git.proxmox.com Git - mirror_qemu.git/blame - tests/Makefile.include
tests/requirements.txt: bump up avocado-framework version to 101.0
[mirror_qemu.git] / tests / Makefile.include
CommitLineData
3b8593ee 1# -*- Mode: makefile -*-
e45eaef9
FZ
2
3.PHONY: check-help
4check-help:
5 @echo "Regression testing targets:"
d426ff93
DF
6 @echo " $(MAKE) check Run block, qapi-schema, unit, softfloat, qtest and decodetree tests"
7 @echo " $(MAKE) bench Run speed tests"
54f96b45 8 @echo
8e19c009 9 @echo "Individual test suites:"
d426ff93
DF
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"
47e3424a 15ifneq ($(filter $(all-check-targets), check-softfloat),)
d426ff93
DF
16 @echo " $(MAKE) check-tcg Run TCG tests"
17 @echo " $(MAKE) check-softfloat Run FPU emulation tests"
ca6db469 18endif
d426ff93 19 @echo " $(MAKE) check-avocado Run avocado (integration) tests for currently configured targets"
54f96b45 20 @echo
d426ff93
DF
21 @echo " $(MAKE) check-report.junit.xml Generates an aggregated XML test report"
22 @echo " $(MAKE) check-venv Creates a Python venv for tests"
23 @echo " $(MAKE) check-clean Clean the tests and related data"
e45eaef9 24 @echo
a6eeac3b 25 @echo "The following are useful for CI builds"
d426ff93
DF
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)"
4ec49f0f 28 @echo
e45eaef9
FZ
29 @echo
30 @echo "The variable SPEED can be set to control the gtester speed setting."
b98a3bae 31 @echo "Default options are -k and (for $(MAKE) V=1) --verbose; they can be"
e45eaef9
FZ
32 @echo "changed with variable GTESTER_OPTIONS."
33
34ifneq ($(wildcard config-host.mak),)
8959449b
KW
35export SRC_PATH
36
b93b63f5 37SPEED = quick
dbfe06c6 38
c401c058 39# Per guest TCG tests
5377a100
PB
40BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS))
41CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS))
6ffe8137 42DISTCLEAN_TCG_TARGET_RULES=$(patsubst %,distclean-tcg-tests-%, $(TCG_TESTS_TARGETS))
5377a100 43RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TCG_TESTS_TARGETS))
8ba0a820 44
5377a100 45$(foreach TARGET,$(TCG_TESTS_TARGETS), \
f2d59351 46 $(eval $(BUILD_DIR)/tests/tcg/config-$(TARGET).mak: config-host.mak))
1a7fab92 47
eebf199c
PB
48.PHONY: $(TCG_TESTS_TARGETS:%=build-tcg-tests-%)
49$(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/tests/tcg/config-%.mak
50 $(call quiet-command, \
d674342e 51 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS), \
eebf199c
PB
52 "BUILD","$* guest-tests")
53
54.PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%)
95808875 55$(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-%
eebf199c 56 $(call quiet-command, \
d674342e 57 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) run, \
eebf199c
PB
58 "RUN", "$* guest-tests")
59
60.PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%)
61$(TCG_TESTS_TARGETS:%=clean-tcg-tests-%): clean-tcg-tests-%:
62 $(call quiet-command, \
d674342e 63 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) clean, \
eebf199c 64 "CLEAN", "$* guest-tests")
8ba0a820 65
6ffe8137
PB
66.PHONY: $(TCG_TESTS_TARGETS:%=distclean-tcg-tests-%)
67$(TCG_TESTS_TARGETS:%=distclean-tcg-tests-%): distclean-tcg-tests-%:
68 $(call quiet-command, \
69 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) distclean, \
70 "CLEAN", "$* guest-tests")
71
8ba0a820
AB
72.PHONY: build-tcg
73build-tcg: $(BUILD_TCG_TARGET_RULES)
74
75.PHONY: check-tcg
95808875 76.ninja-goals.check-tcg = all $(if $(CONFIG_PLUGIN),test-plugins)
df2bb38e 77check-tcg: $(RUN_TCG_TARGET_RULES)
8ba0a820
AB
78
79.PHONY: clean-tcg
80clean-tcg: $(CLEAN_TCG_TARGET_RULES)
b93b63f5 81
6ffe8137
PB
82.PHONY: distclean-tcg
83distclean-tcg: $(DISTCLEAN_TCG_TARGET_RULES)
84
21313721
CR
85# Python venv for running tests
86
333d7036 87.PHONY: check-venv check-avocado check-acceptance check-acceptance-deprecated-warning
21313721 88
5377a100
PB
89# Build up our target list from the filtered list of ninja targets
90TARGETS=$(patsubst libqemu-%.fa, %, $(filter libqemu-%.fa, $(ninja-targets)))
91
21313721
CR
92TESTS_VENV_DIR=$(BUILD_DIR)/tests/venv
93TESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt
a56931ee 94TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
aa19dd33 95TESTS_PYTHON=$(TESTS_VENV_DIR)/bin/python3
94c71462 96ifndef AVOCADO_TESTS
bbbd9b6e 97 AVOCADO_TESTS=tests/avocado
94c71462 98endif
a56931ee
CR
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".
59692a12 102AVOCADO_SHOW=app
23022794
WR
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
21313721 109
5a6f1199
JS
110quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \
111 $(TESTS_PYTHON) -m pip -q --disable-pip-version-check $1, \
112 "VENVPIP","$1")
113
21313721 114$(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
5a6f1199 115 $(call quiet-command, $(PYTHON) -m venv $@, VENV, $@)
0e7647aa 116 $(call quiet-venv-pip,install -e "$(SRC_PATH)/python/")
5a6f1199 117 $(call quiet-venv-pip,install -r $(TESTS_VENV_REQ))
21313721 118 $(call quiet-command, touch $@)
21313721 119
a56931ee
CR
120$(TESTS_RESULTS_DIR):
121 $(call quiet-command, mkdir -p $@, \
122 MKDIR, $@)
123
21313721
CR
124check-venv: $(TESTS_VENV_DIR)
125
93fca0f2
CR
126FEDORA_31_ARCHES_TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGETS)))
127FEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(FEDORA_31_ARCHES_TARGETS))
4ec49f0f
CR
128FEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x
129FEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES))
130
131# download one specific Fedora 31 image
132get-vm-image-fedora-31-%: check-venv
133 $(call quiet-command, \
caa0f7cb 134 $(TESTS_PYTHON) -m avocado vmimage get \
4ec49f0f 135 --distro=fedora --distro-version=31 --arch=$*, \
333d7036 136 "AVOCADO", "Downloading avocado tests VM image for $*")
4ec49f0f
CR
137
138# download all vm images, according to defined targets
139get-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD))
140
ec5ffa00
KC
141JOBS_OPTION=$(lastword -j1 $(filter-out -j, $(filter -j%,$(MAKEFLAGS))))
142
333d7036 143check-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-images
ec5ffa00
KC
144 $(call quiet-command, \
145 $(TESTS_PYTHON) -m avocado \
146 --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
147 $(if $(AVOCADO_TAGS),, \
148 --filter-by-tags-include-empty \
149 --filter-by-tags-include-empty-key) \
150 --max-parallel-tasks $(JOBS_OPTION:-j%=%) \
151 $(AVOCADO_CMDLINE_TAGS) \
152 $(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \
bbbd9b6e 153 "AVOCADO", "tests/avocado")
a56931ee 154
333d7036
WR
155check-acceptance-deprecated-warning:
156 @echo
157 @echo "Note '$(MAKE) check-acceptance' is deprecated, use '$(MAKE) check-avocado' instead."
158 @echo
159
160check-acceptance: check-acceptance-deprecated-warning | check-avocado
161
b93b63f5
PB
162# Consolidated targets
163
e287072b 164.PHONY: check check-clean get-vm-images
e781190c
PB
165check:
166
097a5f19 167check-build: run-ninja
a6eeac3b 168
2cdfb123 169check-clean:
a56931ee 170 rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
2cdfb123 171
425d6aba 172clean: check-clean clean-tcg
6ffe8137 173distclean: distclean-tcg
14117c7b 174
e45eaef9 175endif