diff options
Diffstat (limited to 'meta/lib/oeqa/sdk/cases/meson.py')
-rw-r--r-- | meta/lib/oeqa/sdk/cases/meson.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/meta/lib/oeqa/sdk/cases/meson.py b/meta/lib/oeqa/sdk/cases/meson.py new file mode 100644 index 0000000000..be53df204a --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/meson.py | |||
@@ -0,0 +1,44 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import os | ||
8 | import subprocess | ||
9 | import tempfile | ||
10 | import unittest | ||
11 | |||
12 | from oeqa.sdk.case import OESDKTestCase | ||
13 | from oeqa.utils.subprocesstweak import errors_have_output | ||
14 | errors_have_output() | ||
15 | |||
16 | class MesonTest(OESDKTestCase): | ||
17 | """ | ||
18 | Test that Meson builds correctly. | ||
19 | """ | ||
20 | def setUp(self): | ||
21 | if not (self.tc.hasHostPackage("nativesdk-meson") or | ||
22 | self.tc.hasHostPackage("meson-native")): | ||
23 | raise unittest.SkipTest("MesonTest: needs meson") | ||
24 | |||
25 | def test_epoxy(self): | ||
26 | with tempfile.TemporaryDirectory(prefix="epoxy", dir=self.tc.sdk_dir) as testdir: | ||
27 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://github.com/anholt/libepoxy/releases/download/1.5.3/libepoxy-1.5.3.tar.xz") | ||
28 | |||
29 | dirs = {} | ||
30 | dirs["source"] = os.path.join(testdir, "libepoxy-1.5.3") | ||
31 | dirs["build"] = os.path.join(testdir, "build") | ||
32 | dirs["install"] = os.path.join(testdir, "install") | ||
33 | |||
34 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) | ||
35 | self.assertTrue(os.path.isdir(dirs["source"])) | ||
36 | os.makedirs(dirs["build"]) | ||
37 | |||
38 | log = self._run("meson --warnlevel 1 -Degl=no -Dglx=no -Dx11=false {build} {source}".format(**dirs)) | ||
39 | # Check that Meson thinks we're doing a cross build and not a native | ||
40 | self.assertIn("Build type: cross build", log) | ||
41 | self._run("ninja -C {build} -v".format(**dirs)) | ||
42 | self._run("DESTDIR={install} ninja -C {build} -v install".format(**dirs)) | ||
43 | |||
44 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "lib", "libepoxy.so")) | ||