tests/tcg: allow filtering of TCG tests
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> Message-ID: <20260320155107.2143191-2-alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Alex Bennée committed
Mar 20, 2026 at 15:51 UTC
fb37a16694bf135ef7737f7d10bdbaf995f90800
2 files changed
+16
-4
tests/Makefile.include
+5
-3
@@ -16,9 +16,11 @@ check-help:
16
@echo " $(MAKE) check-tracetool Run tracetool generator tests"
17
@echo " $(MAKE) check-block Run block tests"
18
ifneq ($(filter $(all-check-targets), check-softfloat),)
19
- @echo " $(MAKE) check-tcg Run TCG tests"
19
@echo " $(MAKE) check-softfloat Run FPU emulation tests"
21
- @echo " $(MAKE) run-tcg-tests-TARGET-softmmu Run TCG tests for a given target"
20
+ @echo " $(MAKE) check-tcg Run TCG tests"
21
+ @echo " $(MAKE) run-tcg-tests-TARGET Run TCG tests for a given target"
22
+ @echo
23
+ @echo "The variable TCG_TEST_FILTER will select the subset of matching tests."
24
endif
25
@echo
26
@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/
66
.PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%)
67
$(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-%
68
$(call quiet-command, \
67
- $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) run, \
69
+ $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) TCG_TEST_FILTER=$(TCG_TEST_FILTER) run, \
70
"RUN", "$* guest-tests")
71
72
.PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%)
tests/tcg/Makefile.target
+11
-1
@@ -254,8 +254,15 @@ endif
254
gdb-%: %
255
gdb --args $(QEMU) $(QEMU_OPTS) $<
256
257
+# Filter tests based on TCG_TEST_FILTER if set
258
+ifdef TCG_TEST_FILTER
259
+FILTERED_RUN_TESTS=$(foreach test,$(RUN_TESTS),$(if $(findstring $(TCG_TEST_FILTER),$(test)),$(test)))
260
+else
261
+FILTERED_RUN_TESTS=$(RUN_TESTS)
262
+endif
263
+
264
.PHONY: run
258
-run: $(RUN_TESTS)
265
+run: $(FILTERED_RUN_TESTS)
266
267
clean:
268
rm -f $(TESTS) *.o $(CLEANFILES)
@@ -269,3 +276,6 @@ help:
276
@echo "Built with $(CC)"
277
@echo "Available tests:"
278
@$(foreach t,$(RUN_TESTS),echo " $t";)
279
+ @echo ""
280
+ @echo "Environment variables:"
281
+ @echo " TCG_TEST_FILTER=<pattern> Filter tests matching pattern"