cd362defbb
tests/tcg/configure.sh has a complicated story. In the beginning its code ran as part of the creation of config-target.mak files, and that is where it placed the information on the target compiler. However, probing for the buildability of TCG tests required multiple inclusions of config-target.mak in the _main_ Makefile (not in Makefile.target, which took care of building the QEMU executables in the pre-Meson era), which polluted the namespace. Thus, it was moved to a separate directory. It created small config-*.mak files in $(BUILD_DIR)/tests/tcg. Those were also included multiple times, but at least they were small and manageable; this was also an important step in disentangling the TCG tests from Makefile.target. Since then, Meson has allowed the configure script to go on a diet. A few compilation tests survive (mostly for sanitizers) but these days it mostly takes care of command line parsing, looking for tools, and setting up the environment for Meson to do its stuff. It's time to extend configure with the capability to build for more than just one target: not just tests, but also firmware. As a first step, integrate all the logic to find cross compilers in the configure script, and move tests/tcg/configure.sh back there (though as a separate loop, not integrated in the one that generates target configurations for Meson). tests/tcg is actually very close to being buildable as a standalone project, so I actually expect the compiler tests to move back to tests/tcg, as a "configure" script of sorts which would run at Make time after the docker images are built. The GCC tree has a similar idea of doing only bare-bones tree-wide configuration and leaving the rest for Make time. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220517092616.1272238-8-pbonzini@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220527153603.887929-19-alex.bennee@linaro.org>
166 lines
6.1 KiB
Makefile
166 lines
6.1 KiB
Makefile
# -*- Mode: makefile -*-
|
|
|
|
.PHONY: check-help
|
|
check-help:
|
|
@echo "Regression testing targets:"
|
|
@echo " $(MAKE) check Run block, qapi-schema, unit, softfloat, qtest and decodetree tests"
|
|
@echo " $(MAKE) bench Run speed tests"
|
|
@echo
|
|
@echo "Individual test suites:"
|
|
@echo " $(MAKE) check-qtest-TARGET Run qtest tests for given target"
|
|
@echo " $(MAKE) check-qtest Run qtest tests"
|
|
@echo " $(MAKE) check-unit Run qobject tests"
|
|
@echo " $(MAKE) check-qapi-schema Run QAPI schema tests"
|
|
@echo " $(MAKE) check-block Run block tests"
|
|
ifneq ($(filter $(all-check-targets), check-softfloat),)
|
|
@echo " $(MAKE) check-tcg Run TCG tests"
|
|
@echo " $(MAKE) check-softfloat Run FPU emulation tests"
|
|
endif
|
|
@echo " $(MAKE) check-avocado Run avocado (integration) tests for currently configured targets"
|
|
@echo
|
|
@echo " $(MAKE) check-report.tap Generates an aggregated TAP test report"
|
|
@echo " $(MAKE) check-venv Creates a Python venv for tests"
|
|
@echo " $(MAKE) check-clean Clean the tests and related data"
|
|
@echo
|
|
@echo "The following are useful for CI builds"
|
|
@echo " $(MAKE) check-build Build most test binaries"
|
|
@echo " $(MAKE) get-vm-images Downloads all images used by avocado tests, according to configured targets (~350 MB each, 1.5 GB max)"
|
|
@echo
|
|
@echo
|
|
@echo "The variable SPEED can be set to control the gtester speed setting."
|
|
@echo "Default options are -k and (for $(MAKE) V=1) --verbose; they can be"
|
|
@echo "changed with variable GTESTER_OPTIONS."
|
|
|
|
ifneq ($(wildcard config-host.mak),)
|
|
export SRC_PATH
|
|
|
|
SPEED = quick
|
|
|
|
-include tests/tcg/Makefile.prereqs
|
|
tests/tcg/Makefile.prereqs: config-host.mak
|
|
|
|
# Per guest TCG tests
|
|
BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS))
|
|
CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS))
|
|
RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TCG_TESTS_TARGETS))
|
|
|
|
$(foreach TARGET,$(TCG_TESTS_TARGETS), \
|
|
$(eval $(BUILD_DIR)/tests/tcg/config-$(TARGET).mak: config-host.mak))
|
|
|
|
.PHONY: $(TCG_TESTS_TARGETS:%=build-tcg-tests-%)
|
|
$(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/tests/tcg/config-%.mak
|
|
$(call quiet-command, \
|
|
$(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \
|
|
DOCKER_SCRIPT="$(DOCKER_SCRIPT)" \
|
|
TARGET="$*" SRC_PATH="$(SRC_PATH)", \
|
|
"BUILD","$* guest-tests")
|
|
|
|
.PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%)
|
|
$(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-%
|
|
$(call quiet-command, \
|
|
$(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \
|
|
TARGET="$*" SRC_PATH="$(SRC_PATH)" SPEED=$(SPEED) run, \
|
|
"RUN", "$* guest-tests")
|
|
|
|
.PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%)
|
|
$(TCG_TESTS_TARGETS:%=clean-tcg-tests-%): clean-tcg-tests-%:
|
|
$(call quiet-command, \
|
|
$(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \
|
|
TARGET="$*" SRC_PATH="$(SRC_PATH)" clean, \
|
|
"CLEAN", "$* guest-tests")
|
|
|
|
.PHONY: build-tcg
|
|
build-tcg: $(BUILD_TCG_TARGET_RULES)
|
|
|
|
.PHONY: check-tcg
|
|
.ninja-goals.check-tcg = all $(if $(CONFIG_PLUGIN),test-plugins)
|
|
check-tcg: $(RUN_TCG_TARGET_RULES)
|
|
|
|
.PHONY: clean-tcg
|
|
clean-tcg: $(CLEAN_TCG_TARGET_RULES)
|
|
|
|
# Python venv for running tests
|
|
|
|
.PHONY: check-venv check-avocado check-acceptance check-acceptance-deprecated-warning
|
|
|
|
# Build up our target list from the filtered list of ninja targets
|
|
TARGETS=$(patsubst libqemu-%.fa, %, $(filter libqemu-%.fa, $(ninja-targets)))
|
|
|
|
TESTS_VENV_DIR=$(BUILD_DIR)/tests/venv
|
|
TESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt
|
|
TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
|
|
ifndef AVOCADO_TESTS
|
|
AVOCADO_TESTS=tests/avocado
|
|
endif
|
|
# Controls the output generated by Avocado when running tests.
|
|
# Any number of command separated loggers are accepted. For more
|
|
# information please refer to "avocado --help".
|
|
AVOCADO_SHOW=app
|
|
ifndef AVOCADO_TAGS
|
|
AVOCADO_CMDLINE_TAGS=$(patsubst %-softmmu,-t arch:%, \
|
|
$(filter %-softmmu,$(TARGETS)))
|
|
else
|
|
AVOCADO_CMDLINE_TAGS=$(addprefix -t , $(AVOCADO_TAGS))
|
|
endif
|
|
|
|
$(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
|
|
$(call quiet-command, \
|
|
$(PYTHON) -m venv $@, \
|
|
VENV, $@)
|
|
$(call quiet-command, \
|
|
$(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
|
|
PIP, $(TESTS_VENV_REQ))
|
|
$(call quiet-command, touch $@)
|
|
|
|
$(TESTS_RESULTS_DIR):
|
|
$(call quiet-command, mkdir -p $@, \
|
|
MKDIR, $@)
|
|
|
|
check-venv: $(TESTS_VENV_DIR)
|
|
|
|
FEDORA_31_ARCHES_TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGETS)))
|
|
FEDORA_31_ARCHES_CANDIDATES=$(patsubst ppc64,ppc64le,$(FEDORA_31_ARCHES_TARGETS))
|
|
FEDORA_31_ARCHES := x86_64 aarch64 ppc64le s390x
|
|
FEDORA_31_DOWNLOAD=$(filter $(FEDORA_31_ARCHES),$(FEDORA_31_ARCHES_CANDIDATES))
|
|
|
|
# download one specific Fedora 31 image
|
|
get-vm-image-fedora-31-%: check-venv
|
|
$(call quiet-command, \
|
|
$(TESTS_VENV_DIR)/bin/python -m avocado vmimage get \
|
|
--distro=fedora --distro-version=31 --arch=$*, \
|
|
"AVOCADO", "Downloading avocado tests VM image for $*")
|
|
|
|
# download all vm images, according to defined targets
|
|
get-vm-images: check-venv $(patsubst %,get-vm-image-fedora-31-%, $(FEDORA_31_DOWNLOAD))
|
|
|
|
check-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-images
|
|
$(call quiet-command, \
|
|
$(TESTS_VENV_DIR)/bin/python -m avocado \
|
|
--show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
|
|
$(if $(AVOCADO_TAGS),, --filter-by-tags-include-empty \
|
|
--filter-by-tags-include-empty-key) \
|
|
$(AVOCADO_CMDLINE_TAGS) \
|
|
$(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \
|
|
"AVOCADO", "tests/avocado")
|
|
|
|
check-acceptance-deprecated-warning:
|
|
@echo
|
|
@echo "Note '$(MAKE) check-acceptance' is deprecated, use '$(MAKE) check-avocado' instead."
|
|
@echo
|
|
|
|
check-acceptance: check-acceptance-deprecated-warning | check-avocado
|
|
|
|
# Consolidated targets
|
|
|
|
.PHONY: check check-clean get-vm-images
|
|
check:
|
|
|
|
check-build: run-ninja
|
|
|
|
check-clean:
|
|
rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
|
|
|
|
clean: check-clean clean-tcg
|
|
|
|
endif
|