]> git.proxmox.com Git - mirror_qemu.git/blob - tests/Makefile.include
migration: save_compress_page() can take block through pss
[mirror_qemu.git] / tests / Makefile.include
1 # -*- Mode: makefile -*-
2
3 .PHONY: check-help
4 check-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"
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"
18 endif
19 @echo " $(MAKE) check-avocado Run avocado (integration) tests for currently configured targets"
20 @echo
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"
24 @echo
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)"
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
34 ifneq ($(wildcard config-host.mak),)
35 export SRC_PATH
36
37 SPEED = quick
38
39 # Per guest TCG tests
40 BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS))
41 CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS))
42 DISTCLEAN_TCG_TARGET_RULES=$(patsubst %,distclean-tcg-tests-%, $(TCG_TESTS_TARGETS))
43 RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TCG_TESTS_TARGETS))
44
45 $(foreach TARGET,$(TCG_TESTS_TARGETS), \
46 $(eval $(BUILD_DIR)/tests/tcg/config-$(TARGET).mak: config-host.mak))
47
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, \
51 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS), \
52 "BUILD","$* guest-tests")
53
54 .PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%)
55 $(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-%
56 $(call quiet-command, \
57 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) run, \
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, \
63 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) clean, \
64 "CLEAN", "$* guest-tests")
65
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
72 .PHONY: build-tcg
73 build-tcg: $(BUILD_TCG_TARGET_RULES)
74
75 .PHONY: check-tcg
76 .ninja-goals.check-tcg = all test-plugins
77 check-tcg: $(RUN_TCG_TARGET_RULES)
78
79 .PHONY: clean-tcg
80 clean-tcg: $(CLEAN_TCG_TARGET_RULES)
81
82 .PHONY: distclean-tcg
83 distclean-tcg: $(DISTCLEAN_TCG_TARGET_RULES)
84
85 # Python venv for running tests
86
87 .PHONY: check-venv check-avocado check-acceptance check-acceptance-deprecated-warning
88
89 # Build up our target list from the filtered list of ninja targets
90 TARGETS=$(patsubst libqemu-%.fa, %, $(filter libqemu-%.fa, $(ninja-targets)))
91
92 TESTS_VENV_TOKEN=$(BUILD_DIR)/pyvenv/tests.group
93 TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
94 ifndef AVOCADO_TESTS
95 AVOCADO_TESTS=tests/avocado
96 endif
97 # Controls the output generated by Avocado when running tests.
98 # Any number of command separated loggers are accepted. For more
99 # information please refer to "avocado --help".
100 AVOCADO_SHOW=app
101 ifndef AVOCADO_TAGS
102 AVOCADO_CMDLINE_TAGS=$(patsubst %-softmmu,-t arch:%, \
103 $(filter %-softmmu,$(TARGETS)))
104 else
105 AVOCADO_CMDLINE_TAGS=$(addprefix -t , $(AVOCADO_TAGS))
106 endif
107
108 quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \
109 $(PYTHON) -m pip -q --disable-pip-version-check $1, \
110 "VENVPIP","$1")
111
112 $(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml
113 $(call quiet-venv-pip,install -e "$(SRC_PATH)/python/")
114 $(PYTHON) python/scripts/mkvenv.py ensuregroup --online $< avocado
115 $(call quiet-command, touch $@)
116
117 $(TESTS_RESULTS_DIR):
118 $(call quiet-command, mkdir -p $@, \
119 MKDIR, $@)
120
121 check-venv: $(TESTS_VENV_TOKEN)
122
123 FEDORA_31_ARCHES_TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGETS)))
124 FEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(FEDORA_31_ARCHES_TARGETS))
125 FEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x
126 FEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES))
127
128 # download one specific Fedora 31 image
129 get-vm-image-fedora-31-%: check-venv
130 $(call quiet-command, \
131 $(PYTHON) -m avocado vmimage get \
132 --distro=fedora --distro-version=31 --arch=$*, \
133 "AVOCADO", "Downloading avocado tests VM image for $*")
134
135 # download all vm images, according to defined targets
136 get-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD))
137
138 check-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-images
139 $(call quiet-command, \
140 $(PYTHON) -m avocado \
141 --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
142 $(if $(AVOCADO_TAGS),, --filter-by-tags-include-empty \
143 --filter-by-tags-include-empty-key) \
144 $(AVOCADO_CMDLINE_TAGS) \
145 $(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \
146 "AVOCADO", "tests/avocado")
147
148 check-acceptance-deprecated-warning:
149 @echo
150 @echo "Note '$(MAKE) check-acceptance' is deprecated, use '$(MAKE) check-avocado' instead."
151 @echo
152
153 check-acceptance: check-acceptance-deprecated-warning | check-avocado
154
155 # Consolidated targets
156
157 .PHONY: check check-clean get-vm-images
158 check:
159
160 check-build: run-ninja
161
162 check-clean:
163 rm -rf $(TESTS_RESULTS_DIR)
164
165 clean: check-clean clean-tcg
166 distclean: distclean-tcg
167
168 endif