diff options
author | Ross Burton <ross.burton@arm.com> | 2025-05-10 09:43:47 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-05-12 22:01:55 +0100 |
commit | b8009efc1976faa906a5fcaef1ef0ea30c6441d5 (patch) | |
tree | b568812f7e7d78a257e95b7745003acb2f8af0fd | |
parent | a916ac384456960e5aac4e0ebd72808ce927067d (diff) | |
download | poky-b8009efc1976faa906a5fcaef1ef0ea30c6441d5.tar.gz |
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>
-rw-r--r-- | meta/lib/oeqa/sdk/cases/meson.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/meta/lib/oeqa/sdk/cases/meson.py b/meta/lib/oeqa/sdk/cases/meson.py index 4fb101f9f7..a809ca3a53 100644 --- a/meta/lib/oeqa/sdk/cases/meson.py +++ b/meta/lib/oeqa/sdk/cases/meson.py | |||
@@ -4,6 +4,7 @@ | |||
4 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
5 | # | 5 | # |
6 | 6 | ||
7 | import json | ||
7 | import os | 8 | import os |
8 | import subprocess | 9 | import subprocess |
9 | import tempfile | 10 | import tempfile |
@@ -36,6 +37,14 @@ class MesonTestBase(OESDKTestCase): | |||
36 | # Check that Meson thinks we're doing a cross build and not a native | 37 | # Check that Meson thinks we're doing a cross build and not a native |
37 | self.assertIn("Build type: cross build", log) | 38 | self.assertIn("Build type: cross build", log) |
38 | 39 | ||
40 | # Check that the cross-compiler used is the one we set. | ||
41 | data = json.loads(self._run(f"meson introspect --compilers {builddir}")) | ||
42 | self.assertIn(self.td.get("CC").split()[0], data["host"]["c"]["exelist"]) | ||
43 | |||
44 | # Check that the target architectures was set correctly. | ||
45 | data = json.loads(self._run(f"meson introspect --machines {builddir}")) | ||
46 | self.assertEqual(data["host"]["cpu"], self.td["HOST_ARCH"]) | ||
47 | |||
39 | self._run(f"meson compile -C {builddir} -v") | 48 | self._run(f"meson compile -C {builddir} -v") |
40 | 49 | ||
41 | if installdir: | 50 | if installdir: |