oeqa/sdk/meson: add check that meson has detected the target correctly

Use 'meson introspect' to dump JSON describing the build configuration
and validate that the target architectures and cross-compiler is
correctly set.

(From OE-Core rev: 1c84361829921e91d782b189e2bde818a2d1491c)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton 2025-05-10 09:43:47 +01:00 committed by Richard Purdie
parent a916ac3844
commit b8009efc19

View File

@ -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: