Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ross Burton <ross.burton@arm.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 6/6] oeqa/sdk/meson: improve test to validate host/build target assignments
Date: Mon, 20 May 2024 10:18:33 +0000	[thread overview]
Message-ID: <20240520101833.1798907-6-ross.burton@arm.com> (raw)
In-Reply-To: <20240520101833.1798907-1-ross.burton@arm.com>

Use 'meson introspect' to dump JSON describing the build configuration
and validate that the build and host architectures are correctly set in
the meson.cross file.

Also instead of calling ninja directly, call the relevant meson commands.

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

diff --git a/meta/lib/oeqa/sdk/cases/meson.py b/meta/lib/oeqa/sdk/cases/meson.py
index be53df204a5..5b53668c958 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
@@ -35,10 +36,17 @@ class MesonTest(OESDKTestCase):
             self.assertTrue(os.path.isdir(dirs["source"]))
             os.makedirs(dirs["build"])
 
-            log = self._run("meson --warnlevel 1 -Degl=no -Dglx=no -Dx11=false {build} {source}".format(**dirs))
-            # Check that Meson thinks we're doing a cross build and not a native
-            self.assertIn("Build type: cross build", log)
-            self._run("ninja -C {build} -v".format(**dirs))
-            self._run("DESTDIR={install} ninja -C {build} -v install".format(**dirs))
+            log = self._run("meson setup --warnlevel 1 -Degl=no -Dglx=no -Dx11=false {build} {source}".format(**dirs))
+
+            # Check that the host (gcc) and build (cross-gcc) compilers are different
+            data = json.loads(self._run("meson introspect --compilers {build}".format(**dirs)))
+            self.assertNotEqual(data["build"]["c"]["exelist"], data["host"]["c"]["exelist"])
+            # Check that the system architectures were set correctly
+            data = json.loads(self._run("meson introspect --machines {build}".format(**dirs)))
+            self.assertEqual(data["build"]["cpu"], self.td["SDK_ARCH"])
+            self.assertEqual(data["host"]["cpu"], self.td["HOST_ARCH"])
+
+            self._run("meson compile -C {build} -v".format(**dirs))
+            self._run("meson install -C {build} --destdir {install}".format(**dirs))
 
             self.check_elf(os.path.join(dirs["install"], "usr", "local", "lib", "libepoxy.so"))
-- 
2.34.1



      parent reply	other threads:[~2024-05-20 10:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20 10:18 [PATCH 1/6] oeqa/sdk: rename test cases Ross Burton
2024-05-20 10:18 ` [PATCH 2/6] oeqa/sdk: remove unused imports from " Ross Burton
2024-05-20 10:18 ` [PATCH 3/6] meson: don't use deprecated pkgconfig variable Ross Burton
2024-05-20 10:18 ` [PATCH 4/6] toolchain-scripts: export the target endianism and word size Ross Burton
2024-05-20 10:18 ` [PATCH 5/6] meson: correct the host machine definition in SDKs Ross Burton
2024-05-21  9:46   ` [OE-core] " Alexandre Belloni
2024-05-20 10:18 ` Ross Burton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240520101833.1798907-6-ross.burton@arm.com \
    --to=ross.burton@arm.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox