We have a lot of TCG tests now which can be fiddly if we just want to
check one particular test type across the targets. Introduce
TCG_TEST_FILTER to allow this:
make check-tcg TCG_TEST_FILTER=gdb
to run all the gdb tests across the suites.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
tests/Makefile.include | 8 +++++---
tests/tcg/Makefile.target | 12 +++++++++++-
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 59b9a4b9220..f257288194d 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -16,9 +16,11 @@ check-help:
@echo " $(MAKE) check-tracetool Run tracetool generator 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"
- @echo " $(MAKE) run-tcg-tests-TARGET-softmmu Run TCG tests for a given target"
+ @echo " $(MAKE) check-tcg Run TCG tests"
+ @echo " $(MAKE) run-tcg-tests-TARGET Run TCG tests for a given target"
+ @echo
+ @echo "The variable TCG_TEST_FILTER will select the subset of matching tests."
endif
@echo
@echo " $(MAKE) check-report.junit.xml Generates an aggregated XML test report"
@@ -64,7 +66,7 @@ $(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/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/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) run, \
+ $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) TCG_TEST_FILTER=$(TCG_TEST_FILTER) run, \
"RUN", "$* guest-tests")
.PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%)
diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
index af72903f898..1b83824ff4e 100644
--- a/tests/tcg/Makefile.target
+++ b/tests/tcg/Makefile.target
@@ -254,8 +254,15 @@ endif
gdb-%: %
gdb --args $(QEMU) $(QEMU_OPTS) $<
+# Filter tests based on TCG_TEST_FILTER if set
+ifdef TCG_TEST_FILTER
+FILTERED_RUN_TESTS=$(foreach test,$(RUN_TESTS),$(if $(findstring $(TCG_TEST_FILTER),$(test)),$(test)))
+else
+FILTERED_RUN_TESTS=$(RUN_TESTS)
+endif
+
.PHONY: run
-run: $(RUN_TESTS)
+run: $(FILTERED_RUN_TESTS)
clean:
rm -f $(TESTS) *.o $(CLEANFILES)
@@ -269,3 +276,6 @@ help:
@echo "Built with $(CC)"
@echo "Available tests:"
@$(foreach t,$(RUN_TESTS),echo " $t";)
+ @echo ""
+ @echo "Environment variables:"
+ @echo " TCG_TEST_FILTER=<pattern> Filter tests matching pattern"
--
2.47.3