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.
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
On 3/6/26 8:17 AM, Alex Bennée wrote: > 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. > > 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(-) > Ideally, we should have a list command available also, so we don't have to guess what magic pattern names follow. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes:
> On 3/6/26 8:17 AM, Alex Bennée wrote:
>> 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.
>> 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(-)
>>
>
> Ideally, we should have a list command available also, so we don't
> have to guess what magic pattern names follow.
>
> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
If you run "make help" in one of the TCG test dirs you will get a list:
➜ cd tests/tcg/aarch64-softmmu/
🕙18:35:48 alex@draig:tests/tcg/aarch64-softmmu on pr/060326-11.0-virtio-gpu-updates-1:master [$?⇡]
➜ make help
tests/tcg/aarch64-softmmu: -march=armv8.3-a detected
tests/tcg/aarch64-softmmu: -march=armv8.5-a+memtag detected
TCG tests help aarch64
Built with aarch64-linux-gnu-gcc
Available tests:
run-asid2
run-feat-xs
run-pauth-3
run-semiconsole
run-semiheap
run-vtimer
run-mte
run-hello
run-interrupt
run-memory-sve
run-plugin-hello-with-libdiscons.so
run-plugin-interrupt-with-libempty.so
run-gdbstub-memory
run-gdbstub-interrupt
run-gdbstub-untimely-packet
run-gdbstub-registers
run-memory-replay
run-gdbstub-mte
run-plugin-memory-with-libmem.so
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
On 3/6/26 10:36 AM, Alex Bennée wrote: > Pierrick Bouvier <pierrick.bouvier@linaro.org> writes: > >> On 3/6/26 8:17 AM, Alex Bennée wrote: >>> 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. >>> 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(-) >>> >> >> Ideally, we should have a list command available also, so we don't >> have to guess what magic pattern names follow. >> >> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> > > If you run "make help" in one of the TCG test dirs you will get a list: > > ➜ cd tests/tcg/aarch64-softmmu/ > 🕙18:35:48 alex@draig:tests/tcg/aarch64-softmmu on pr/060326-11.0-virtio-gpu-updates-1:master [$?⇡] > ➜ make help > tests/tcg/aarch64-softmmu: -march=armv8.3-a detected > tests/tcg/aarch64-softmmu: -march=armv8.5-a+memtag detected > TCG tests help aarch64 > Built with aarch64-linux-gnu-gcc > Available tests: > run-asid2 > run-feat-xs > run-pauth-3 > run-semiconsole > run-semiheap > run-vtimer > run-mte > run-hello > run-interrupt > run-memory-sve > run-plugin-hello-with-libdiscons.so > run-plugin-interrupt-with-libempty.so > run-gdbstub-memory > run-gdbstub-interrupt > run-gdbstub-untimely-packet > run-gdbstub-registers > run-memory-replay > run-gdbstub-mte > run-plugin-memory-with-libmem.so > Yes, but I was more thinking at something from the top, without needing to dive into every arch.
© 2016 - 2026 Red Hat, Inc.