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