Commit 7242e51517 for qemu.org

commit 7242e51517cbc2df9121d6674ea53d3aebac1d3e
Author: Alex Bennée <alex.bennee@linaro.org>
Date:   Thu Dec 4 19:48:54 2025 +0000

    tests/tcg: honour the available QEMU binaries when running check-tcg

    Currently configure can identify all the targets that have
    cross-compilers available from the supplied target-list. By default
    this is the default_target_list which is all possible targets we can
    build.

    At the same time the target list passed to meson is filtered down
    depending on various factors including not building 64 bit targets on
    32 bit hosts. As a result make check-tcg will erroneously attempt to
    run tests for which we haven't built a QEMU.

    Solve this by filtering the final list of TCG_TEST_TARGETS based on
    what actually was configured by meson. Rename the variable that
    configure spits out to TCG_TESTS_WITH_COMPILERS for clarity and to
    avoid larger churn in the Makefile.

    Message-ID: <20251204194902.1340008-4-alex.bennee@linaro.org>
    Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

diff --git a/configure b/configure
index a2f66f7ff9..82cace1bc9 100755
--- a/configure
+++ b/configure
@@ -1801,7 +1801,7 @@ if test "$plugins" = "yes" ; then
 fi
 echo "PYTHON=$python" >> tests/tcg/$config_host_mak

-tcg_tests_targets=
+tcg_tests_with_compilers=
 for target in $target_list; do
   arch=${target%%-*}

@@ -1852,12 +1852,12 @@ for target in $target_list; do
       fi

       echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs
-      tcg_tests_targets="$tcg_tests_targets $target"
+      tcg_tests_with_compilers="$tcg_tests_with_compilers $target"
   fi
 done

 if test "$tcg" = "enabled"; then
-    echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> $config_host_mak
+    echo "TCG_TESTS_WITH_COMPILERS=$tcg_tests_with_compilers" >> $config_host_mak
 fi

 if test "$skip_meson" = no; then
diff --git a/tests/Makefile.include b/tests/Makefile.include
index d4dfbf3716..7728098981 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -37,6 +37,15 @@ export SRC_PATH

 SPEED = quick

+
+# TCG_TESTS_WITH_COMPILERS represents the test targets we have cross compiler
+# support for, CONFIGURED_TEST_TARGETS it what meson has finally
+# configured having rejected stuff we can't build.
+CONFIGURED_TCG_TARGETS=$(patsubst %-config-target.h, %, $(wildcard *-config-target.h))
+
+# This is the intersection of what tests we can build and is configured
+TCG_TESTS_TARGETS=$(filter $(CONFIGURED_TCG_TARGETS), $(TCG_TESTS_WITH_COMPILERS))
+
 # Per guest TCG tests
 BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS))
 CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS))