Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | # |
| 2 | # SPDX-License-Identifier: MIT |
| 3 | # |
| 4 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 5 | import os |
| 6 | import subprocess |
| 7 | import tempfile |
| 8 | import unittest |
| 9 | |
| 10 | from oeqa.sdk.case import OESDKTestCase |
| 11 | from oeqa.utils.subprocesstweak import errors_have_output |
| 12 | errors_have_output() |
| 13 | |
| 14 | class EpoxyTest(OESDKTestCase): |
| 15 | """ |
| 16 | Test that Meson builds correctly. |
| 17 | """ |
| 18 | def setUp(self): |
Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 19 | if not (self.tc.hasHostPackage("nativesdk-meson") or |
| 20 | self.tc.hasHostPackage("meson-native")): |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 21 | raise unittest.SkipTest("EpoxyTest class: SDK doesn't contain Meson") |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 22 | |
| 23 | def test_epoxy(self): |
| 24 | with tempfile.TemporaryDirectory(prefix="epoxy", dir=self.tc.sdk_dir) as testdir: |
| 25 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://github.com/anholt/libepoxy/releases/download/1.5.3/libepoxy-1.5.3.tar.xz") |
| 26 | |
| 27 | dirs = {} |
| 28 | dirs["source"] = os.path.join(testdir, "libepoxy-1.5.3") |
| 29 | dirs["build"] = os.path.join(testdir, "build") |
| 30 | dirs["install"] = os.path.join(testdir, "install") |
| 31 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 32 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 33 | self.assertTrue(os.path.isdir(dirs["source"])) |
| 34 | os.makedirs(dirs["build"]) |
| 35 | |
Brad Bishop | f3f93bb | 2019-10-16 14:33:32 -0400 | [diff] [blame] | 36 | log = self._run("meson -Degl=no -Dglx=no -Dx11=false {build} {source}".format(**dirs)) |
| 37 | # Check that Meson thinks we're doing a cross build and not a native |
| 38 | self.assertIn("Build type: cross build", log) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 39 | self._run("ninja -C {build} -v".format(**dirs)) |
| 40 | self._run("DESTDIR={install} ninja -C {build} -v install".format(**dirs)) |
| 41 | |
| 42 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "lib", "libepoxy.so")) |