qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] tests/tcg: Fix run for tests with specific plugin
@ 2025-08-01  0:13 Gustavo Romero
  2025-08-01  0:44 ` Pierrick Bouvier
  2025-08-01 13:29 ` Peter Maydell
  0 siblings, 2 replies; 5+ messages in thread
From: Gustavo Romero @ 2025-08-01  0:13 UTC (permalink / raw)
  To: qemu-devel, alex.bennee, pierrick.bouvier, manos.pitsidianakis
  Cc: qemu-arm, gustavo.romero

Commit 25aaf0cb7f (“tests/tcg: reduce the number of plugin test
combinations”) added support for running tests with specific plugins
passed via the EXTRA_RUNS variable.

However, due to the optimization, the rules generated as a shuffled
combination of tests and plugins might not cover the rules required to
run the tests with a specific plugin passed via EXTRA_RUNS.

This commit fixes it by correctly generating the rules for the tests
that require a specific plugin to run, which are now passed via the
EXTRA_RUNS_WITH_PLUGIN instead of via the EXTRA_RUNS variable.

The fix essentially excludes the tests passed via EXTRA_RUNS_WITH_PLUGIN
from the rules created by the shuffled combination of tests and plugins,
to avoid running the tests twice, and generates the rules for the
test/plugin combinations listed in the EXTRA_RUNS_WITH_PLUGIN variable.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
---
 tests/tcg/Makefile.target                     | 20 ++++++++++++++++---
 tests/tcg/multiarch/Makefile.target           |  2 +-
 .../multiarch/system/Makefile.softmmu-target  |  2 +-
 tests/tcg/x86_64/Makefile.softmmu-target      |  2 +-
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
index 18afd5be19..af72903f89 100644
--- a/tests/tcg/Makefile.target
+++ b/tests/tcg/Makefile.target
@@ -170,6 +170,10 @@ endif
 PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
 	$(patsubst %.c, lib%.so, $(notdir $(wildcard $(PLUGIN_SRC)/*.c))))
 
+strip-plugin = $(wordlist 1, 1, $(subst -with-, ,$1))
+extract-plugin = $(wordlist 2, 2, $(subst -with-, ,$1))
+extract-test = $(subst run-plugin-,,$(wordlist 1, 1, $(subst -with-, ,$1)))
+
 # We need to ensure expand the run-plugin-TEST-with-PLUGIN
 # pre-requistes manually here as we can't use stems to handle it. We
 # only expand MULTIARCH_TESTS which are common on most of our targets
@@ -179,6 +183,13 @@ PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
 
 ifneq ($(MULTIARCH_TESTS),)
 
+# Extract extra tests from the extra test+plugin combination.
+EXTRA_TESTS_WITH_PLUGIN=$(foreach test, \
+                        $(EXTRA_RUNS_WITH_PLUGIN),$(call extract-test,$(test)))
+# Exclude tests that were specified to run with specific plugins from the tests
+# which can run with any plugin combination, so we don't run it twice.
+MULTIARCH_TESTS:=$(filter-out $(EXTRA_TESTS_WITH_PLUGIN), $(MULTIARCH_TESTS))
+
 NUM_PLUGINS := $(words $(PLUGINS))
 NUM_TESTS := $(words $(MULTIARCH_TESTS))
 
@@ -186,19 +197,22 @@ define mod_plus_one
   $(shell $(PYTHON) -c "print( ($(1) % $(2)) + 1 )")
 endef
 
+# Rules for running tests with any plugin combination, i.e., no specific plugin.
 $(foreach _idx, $(shell seq 1 $(NUM_TESTS)), \
 	$(eval _test := $(word $(_idx), $(MULTIARCH_TESTS))) \
 	$(eval _plugin := $(word $(call mod_plus_one, $(_idx), $(NUM_PLUGINS)), $(PLUGINS))) \
 	$(eval run-plugin-$(_test)-with-$(_plugin): $(_test) $(_plugin)) \
 	$(eval RUN_TESTS+=run-plugin-$(_test)-with-$(_plugin)))
 
+# Rules for running extra tests with specific plugins.
+$(foreach f,$(EXTRA_RUNS_WITH_PLUGIN), \
+    $(eval $(f): $(call extract-test,$(f)) $(call extract-plugin,$(f))))
+
 endif # MULTIARCH_TESTS
 endif # CONFIG_PLUGIN
 
-strip-plugin = $(wordlist 1, 1, $(subst -with-, ,$1))
-extract-plugin = $(wordlist 2, 2, $(subst -with-, ,$1))
-
 RUN_TESTS+=$(EXTRA_RUNS)
+RUN_TESTS+=$(EXTRA_RUNS_WITH_PLUGIN)
 
 # Some plugins need additional arguments above the default to fully
 # exercise things. We can define them on a per-test basis here.
diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target
index 38345ff880..8dc65d7a06 100644
--- a/tests/tcg/multiarch/Makefile.target
+++ b/tests/tcg/multiarch/Makefile.target
@@ -201,7 +201,7 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
 	$(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \
 	$(QEMU) $<
 
-EXTRA_RUNS += run-plugin-test-plugin-mem-access-with-libmem.so
+EXTRA_RUNS_WITH_PLUGIN += run-plugin-test-plugin-mem-access-with-libmem.so
 endif
 
 # Update TESTS
diff --git a/tests/tcg/multiarch/system/Makefile.softmmu-target b/tests/tcg/multiarch/system/Makefile.softmmu-target
index 4171b4e6aa..98c4eda5e0 100644
--- a/tests/tcg/multiarch/system/Makefile.softmmu-target
+++ b/tests/tcg/multiarch/system/Makefile.softmmu-target
@@ -77,5 +77,5 @@ run-plugin-memory-with-libmem.so: memory libmem.so
 run-plugin-memory-with-libmem.so: PLUGIN_ARGS=$(COMMA)region-summary=true
 run-plugin-memory-with-libmem.so: CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py $@.out
 
-EXTRA_RUNS += run-plugin-memory-with-libmem.so
+EXTRA_RUNS_WITH_PLUGIN += run-plugin-memory-with-libmem.so
 endif
diff --git a/tests/tcg/x86_64/Makefile.softmmu-target b/tests/tcg/x86_64/Makefile.softmmu-target
index 3e30ca9307..4e65f58b57 100644
--- a/tests/tcg/x86_64/Makefile.softmmu-target
+++ b/tests/tcg/x86_64/Makefile.softmmu-target
@@ -40,5 +40,5 @@ run-plugin-patch-target-with-libpatch.so:		\
 run-plugin-patch-target-with-libpatch.so:		\
 	CHECK_PLUGIN_OUTPUT_COMMAND=$(X64_SYSTEM_SRC)/validate-patch.py $@.out
 run-plugin-patch-target-with-libpatch.so: patch-target libpatch.so
-EXTRA_RUNS+=run-plugin-patch-target-with-libpatch.so
+EXTRA_RUNS_WITH_PLUGIN+=run-plugin-patch-target-with-libpatch.so
 endif
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] tests/tcg: Fix run for tests with specific plugin
  2025-08-01  0:13 [PATCH v2] tests/tcg: Fix run for tests with specific plugin Gustavo Romero
@ 2025-08-01  0:44 ` Pierrick Bouvier
  2025-08-01 13:29 ` Peter Maydell
  1 sibling, 0 replies; 5+ messages in thread
From: Pierrick Bouvier @ 2025-08-01  0:44 UTC (permalink / raw)
  To: Gustavo Romero, qemu-devel, alex.bennee, manos.pitsidianakis; +Cc: qemu-arm

On 7/31/25 5:13 PM, Gustavo Romero wrote:
> Commit 25aaf0cb7f (“tests/tcg: reduce the number of plugin test
> combinations”) added support for running tests with specific plugins
> passed via the EXTRA_RUNS variable.
> 
> However, due to the optimization, the rules generated as a shuffled
> combination of tests and plugins might not cover the rules required to
> run the tests with a specific plugin passed via EXTRA_RUNS.
> 
> This commit fixes it by correctly generating the rules for the tests
> that require a specific plugin to run, which are now passed via the
> EXTRA_RUNS_WITH_PLUGIN instead of via the EXTRA_RUNS variable.
> 
> The fix essentially excludes the tests passed via EXTRA_RUNS_WITH_PLUGIN
> from the rules created by the shuffled combination of tests and plugins,
> to avoid running the tests twice, and generates the rules for the
> test/plugin combinations listed in the EXTRA_RUNS_WITH_PLUGIN variable.
> 
> Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
> ---
>   tests/tcg/Makefile.target                     | 20 ++++++++++++++++---
>   tests/tcg/multiarch/Makefile.target           |  2 +-
>   .../multiarch/system/Makefile.softmmu-target  |  2 +-
>   tests/tcg/x86_64/Makefile.softmmu-target      |  2 +-
>   4 files changed, 20 insertions(+), 6 deletions(-)

Looks ok now, thanks.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] tests/tcg: Fix run for tests with specific plugin
  2025-08-01  0:13 [PATCH v2] tests/tcg: Fix run for tests with specific plugin Gustavo Romero
  2025-08-01  0:44 ` Pierrick Bouvier
@ 2025-08-01 13:29 ` Peter Maydell
  2025-08-04  9:48   ` Alex Bennée
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2025-08-01 13:29 UTC (permalink / raw)
  To: Gustavo Romero
  Cc: qemu-devel, alex.bennee, pierrick.bouvier, manos.pitsidianakis,
	qemu-arm

On Fri, 1 Aug 2025 at 01:18, Gustavo Romero <gustavo.romero@linaro.org> wrote:
>
> Commit 25aaf0cb7f (“tests/tcg: reduce the number of plugin test
> combinations”) added support for running tests with specific plugins
> passed via the EXTRA_RUNS variable.
>
> However, due to the optimization, the rules generated as a shuffled
> combination of tests and plugins might not cover the rules required to
> run the tests with a specific plugin passed via EXTRA_RUNS.
>
> This commit fixes it by correctly generating the rules for the tests
> that require a specific plugin to run, which are now passed via the
> EXTRA_RUNS_WITH_PLUGIN instead of via the EXTRA_RUNS variable.
>
> The fix essentially excludes the tests passed via EXTRA_RUNS_WITH_PLUGIN
> from the rules created by the shuffled combination of tests and plugins,
> to avoid running the tests twice, and generates the rules for the
> test/plugin combinations listed in the EXTRA_RUNS_WITH_PLUGIN variable.
>

Since Alex is away and I'm doing a target-arm pullreq for rc2
anyway, I'll take this via target-arm.next.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] tests/tcg: Fix run for tests with specific plugin
  2025-08-01 13:29 ` Peter Maydell
@ 2025-08-04  9:48   ` Alex Bennée
  2025-08-04  9:56     ` Peter Maydell
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Bennée @ 2025-08-04  9:48 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Gustavo Romero, qemu-devel, pierrick.bouvier, manos.pitsidianakis,
	qemu-arm

Peter Maydell <peter.maydell@linaro.org> writes:

> On Fri, 1 Aug 2025 at 01:18, Gustavo Romero <gustavo.romero@linaro.org> wrote:
>>
>> Commit 25aaf0cb7f (“tests/tcg: reduce the number of plugin test
>> combinations”) added support for running tests with specific plugins
>> passed via the EXTRA_RUNS variable.
>>
>> However, due to the optimization, the rules generated as a shuffled
>> combination of tests and plugins might not cover the rules required to
>> run the tests with a specific plugin passed via EXTRA_RUNS.
>>
>> This commit fixes it by correctly generating the rules for the tests
>> that require a specific plugin to run, which are now passed via the
>> EXTRA_RUNS_WITH_PLUGIN instead of via the EXTRA_RUNS variable.
>>
>> The fix essentially excludes the tests passed via EXTRA_RUNS_WITH_PLUGIN
>> from the rules created by the shuffled combination of tests and plugins,
>> to avoid running the tests twice, and generates the rules for the
>> test/plugin combinations listed in the EXTRA_RUNS_WITH_PLUGIN variable.
>>
>
> Since Alex is away and I'm doing a target-arm pullreq for rc2
> anyway, I'll take this via target-arm.next.

Are you sending that today? Otherwise I'm happy to pull it now I'm back.

>
> thanks
> -- PMM

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] tests/tcg: Fix run for tests with specific plugin
  2025-08-04  9:48   ` Alex Bennée
@ 2025-08-04  9:56     ` Peter Maydell
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2025-08-04  9:56 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Gustavo Romero, qemu-devel, pierrick.bouvier, manos.pitsidianakis,
	qemu-arm

On Mon, 4 Aug 2025 at 10:48, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> Peter Maydell <peter.maydell@linaro.org> writes:
>
> > On Fri, 1 Aug 2025 at 01:18, Gustavo Romero <gustavo.romero@linaro.org> wrote:
> >>
> >> Commit 25aaf0cb7f (“tests/tcg: reduce the number of plugin test
> >> combinations”) added support for running tests with specific plugins
> >> passed via the EXTRA_RUNS variable.
> >>
> >> However, due to the optimization, the rules generated as a shuffled
> >> combination of tests and plugins might not cover the rules required to
> >> run the tests with a specific plugin passed via EXTRA_RUNS.
> >>
> >> This commit fixes it by correctly generating the rules for the tests
> >> that require a specific plugin to run, which are now passed via the
> >> EXTRA_RUNS_WITH_PLUGIN instead of via the EXTRA_RUNS variable.
> >>
> >> The fix essentially excludes the tests passed via EXTRA_RUNS_WITH_PLUGIN
> >> from the rules created by the shuffled combination of tests and plugins,
> >> to avoid running the tests twice, and generates the rules for the
> >> test/plugin combinations listed in the EXTRA_RUNS_WITH_PLUGIN variable.
> >>
> >
> > Since Alex is away and I'm doing a target-arm pullreq for rc2
> > anyway, I'll take this via target-arm.next.
>
> Are you sending that today? Otherwise I'm happy to pull it now I'm back.

Pullreq went out on Friday, just hasn't been merged yet:
 https://lore.kernel.org/qemu-devel/20250801155159.400947-1-peter.maydell@linaro.org/

thanks
-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-04  9:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-01  0:13 [PATCH v2] tests/tcg: Fix run for tests with specific plugin Gustavo Romero
2025-08-01  0:44 ` Pierrick Bouvier
2025-08-01 13:29 ` Peter Maydell
2025-08-04  9:48   ` Alex Bennée
2025-08-04  9:56     ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).