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-functional Run python-based functional tests" 13 @echo " $(MAKE) check-functional-TARGET Run functional tests for a given target" 14 @echo " $(MAKE) check-unit Run qobject tests" 15 @echo " $(MAKE) check-qapi-schema Run QAPI schema tests" 16 @echo " $(MAKE) check-tracetool Run tracetool generator tests" 17 @echo " $(MAKE) check-block Run block tests" 18ifneq ($(filter $(all-check-targets), check-softfloat),) 19 @echo " $(MAKE) check-tcg Run TCG tests" 20 @echo " $(MAKE) check-softfloat Run FPU emulation tests" 21endif 22 @echo 23 @echo " $(MAKE) check-report.junit.xml Generates an aggregated XML test report" 24 @echo " $(MAKE) check-venv Creates a Python venv for tests" 25 @echo " $(MAKE) check-clean Clean the tests and related data" 26 @echo 27 @echo "The following are useful for CI builds" 28 @echo " $(MAKE) check-build Build most test binaries" 29 @echo 30 @echo 31 @echo "The variable SPEED can be set to control the gtester speed setting." 32 @echo "Default options are -k and (for $(MAKE) V=1) --verbose; they can be" 33 @echo "changed with variable GTESTER_OPTIONS." 34 35ifneq ($(wildcard config-host.mak),) 36export SRC_PATH 37 38SPEED = quick 39 40 41# TCG_TESTS_WITH_COMPILERS represents the test targets we have cross compiler 42# support for, CONFIGURED_TEST_TARGETS it what meson has finally 43# configured having rejected stuff we can't build. 44CONFIGURED_TCG_TARGETS=$(patsubst %-config-target.h, %, $(wildcard *-config-target.h)) 45 46# This is the intersection of what tests we can build and is configured 47TCG_TESTS_TARGETS=$(filter $(CONFIGURED_TCG_TARGETS), $(TCG_TESTS_WITH_COMPILERS)) 48 49# Per guest TCG tests 50BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS)) 51CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS)) 52DISTCLEAN_TCG_TARGET_RULES=$(patsubst %,distclean-tcg-tests-%, $(TCG_TESTS_TARGETS)) 53RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TCG_TESTS_TARGETS)) 54 55$(foreach TARGET,$(TCG_TESTS_TARGETS), \ 56 $(eval $(BUILD_DIR)/tests/tcg/config-$(TARGET).mak: config-host.mak)) 57 58.PHONY: $(TCG_TESTS_TARGETS:%=build-tcg-tests-%) 59$(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/tests/tcg/config-%.mak 60 $(call quiet-command, \ 61 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS), \ 62 "BUILD","$* guest-tests") 63 64.PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%) 65$(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-% 66 $(call quiet-command, \ 67 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) run, \ 68 "RUN", "$* guest-tests") 69 70.PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%) 71$(TCG_TESTS_TARGETS:%=clean-tcg-tests-%): clean-tcg-tests-%: 72 $(call quiet-command, \ 73 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) clean, \ 74 "CLEAN", "$* guest-tests") 75 76.PHONY: $(TCG_TESTS_TARGETS:%=distclean-tcg-tests-%) 77$(TCG_TESTS_TARGETS:%=distclean-tcg-tests-%): distclean-tcg-tests-%: 78 $(call quiet-command, \ 79 $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) distclean, \ 80 "CLEAN", "$* guest-tests") 81 82.PHONY: build-tcg 83build-tcg: $(BUILD_TCG_TARGET_RULES) 84 85.PHONY: check-tcg 86.ninja-goals.check-tcg = all test-plugins 87check-tcg: $(RUN_TCG_TARGET_RULES) 88 89.PHONY: clean-tcg 90clean-tcg: $(CLEAN_TCG_TARGET_RULES) 91 92.PHONY: distclean-tcg 93distclean-tcg: $(DISTCLEAN_TCG_TARGET_RULES) 94 95# Python venv for running tests 96 97.PHONY: check-venv 98 99# Build up our target list from the filtered list of ninja targets 100TARGETS=$(patsubst libqemu-%.a, %, $(filter libqemu-%.a, $(ninja-targets))) 101 102TESTS_VENV_TOKEN=$(BUILD_DIR)/pyvenv/tests.group 103 104quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \ 105 $(PYTHON) -m pip -q --disable-pip-version-check $1, \ 106 "VENVPIP","$1") 107 108$(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml 109 $(call quiet-venv-pip,install -e "$(SRC_PATH)/python/") 110 $(MKVENV_ENSUREGROUP) $< testdeps 111 $(call quiet-command, touch $@) 112 113check-venv: $(TESTS_VENV_TOKEN) 114 115FUNCTIONAL_TARGETS=$(patsubst %-softmmu,check-functional-%, $(filter %-softmmu,$(TARGETS))) 116.PHONY: $(FUNCTIONAL_TARGETS) 117$(FUNCTIONAL_TARGETS): check-venv 118 @$(MAKE) SPEED=thorough $(subst -functional,-func,$@) 119 120.PHONY: check-functional 121check-functional: check-venv 122 @$(NINJA) precache-functional 123 @$(PYTHON) $(SRC_PATH)/scripts/clean_functional_cache.py 124 @QEMU_TEST_NO_DOWNLOAD=1 $(MAKE) SPEED=thorough check-func check-func-quick 125 126.PHONY: check-func check-func-quick 127check-func check-func-quick: 128 129# Consolidated targets 130 131.PHONY: check check-clean 132check: 133 134check-build: run-ninja 135 136check-clean: 137 rm -rf $(BUILD_DIR)/tests/functional 138 139clean: check-clean clean-tcg 140distclean: distclean-tcg 141 142endif 143