Message ID | 20250406164909.270945-4-tom.hochstein@oss.nxp.com |
---|---|
State | New |
Headers | show |
Series | [v4,1/5] toolchain-scripts: Add Meson settings for Yocto build SDK | expand |
On Sun Apr 6, 2025 at 6:49 PM CEST, Tom Hochstein via lists.openembedded.org wrote: > From: Ross Burton <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. > > Fixes: [YOCTO #15485] > Signed-off-by: Ross Burton <ross.burton@arm.com> > Signed-off-by: Tom Hochstein <tom.hochstein@oss.nxp.com> > --- Hi, Thanks for your patch. > meta/lib/oeqa/sdk/cases/meson.py | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/meta/lib/oeqa/sdk/cases/meson.py b/meta/lib/oeqa/sdk/cases/meson.py > index 1edf78720a..f70177a033 100644 > --- a/meta/lib/oeqa/sdk/cases/meson.py > +++ b/meta/lib/oeqa/sdk/cases/meson.py > @@ -39,10 +39,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))) I have the following error on the autobuilder: Traceback (most recent call last): File "/srv/pokybuild/yocto-worker/beaglebone/build/meta/lib/oeqa/sdk/cases/meson.py", line 45, in test_epoxy data = json.loads(self._run("meson introspect --compilers {build}".format(**dirs))) NameError: name 'json' is not defined https://autobuilder.yoctoproject.org/valkyrie/#/builders/2/builds/1348 Can you have a look at this please?
diff --git a/meta/lib/oeqa/sdk/cases/meson.py b/meta/lib/oeqa/sdk/cases/meson.py index 1edf78720a..f70177a033 100644 --- a/meta/lib/oeqa/sdk/cases/meson.py +++ b/meta/lib/oeqa/sdk/cases/meson.py @@ -39,10 +39,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"))