diff mbox series

[14/23] oeqa/sdk/meson: add check that meson has detected the target correctly

Message ID 20250510084400.269726-14-ross.burton@arm.com
State New
Headers show
Series [01/23] buildtools-tarball: fix default_cases assignment | expand

Commit Message

Ross Burton May 10, 2025, 8:43 a.m. UTC
Use 'meson introspect' to dump JSON describing the build configuration
and validate that the target architectures and cross-compiler is
correctly set.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/lib/oeqa/sdk/cases/meson.py | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/sdk/cases/meson.py b/meta/lib/oeqa/sdk/cases/meson.py
index 4fb101f9f73..a809ca3a537 100644
--- a/meta/lib/oeqa/sdk/cases/meson.py
+++ b/meta/lib/oeqa/sdk/cases/meson.py
@@ -4,6 +4,7 @@ 
 # SPDX-License-Identifier: MIT
 #
 
+import json
 import os
 import subprocess
 import tempfile
@@ -36,6 +37,14 @@  class MesonTestBase(OESDKTestCase):
         # Check that Meson thinks we're doing a cross build and not a native
         self.assertIn("Build type: cross build", log)
 
+        # Check that the cross-compiler used is the one we set.
+        data = json.loads(self._run(f"meson introspect --compilers {builddir}"))
+        self.assertIn(self.td.get("CC").split()[0], data["host"]["c"]["exelist"])
+
+        # Check that the target architectures was set correctly.
+        data = json.loads(self._run(f"meson introspect --machines {builddir}"))
+        self.assertEqual(data["host"]["cpu"], self.td["HOST_ARCH"])
+
         self._run(f"meson compile -C {builddir} -v")
 
         if installdir: