diff options
Diffstat (limited to 'meta/lib/oeqa/sdk/cases/cmake.py')
| -rw-r--r-- | meta/lib/oeqa/sdk/cases/cmake.py | 51 | 
1 files changed, 51 insertions, 0 deletions
diff --git a/meta/lib/oeqa/sdk/cases/cmake.py b/meta/lib/oeqa/sdk/cases/cmake.py new file mode 100644 index 0000000000..81fd327ca3 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/cmake.py  | |||
| @@ -0,0 +1,51 @@ | |||
| 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 | from oeqa.sdk.case import OESDKTestCase | ||
| 12 | |||
| 13 | from oeqa.utils.subprocesstweak import errors_have_output | ||
| 14 | errors_have_output() | ||
| 15 | |||
| 16 | class CMakeTest(OESDKTestCase): | ||
| 17 | """ | ||
| 18 | Test case to build a project using cmake. | ||
| 19 | """ | ||
| 20 | |||
| 21 | def setUp(self): | ||
| 22 | libc = self.td.get("TCLIBC") | ||
| 23 | if libc in [ 'newlib' ]: | ||
| 24 | raise unittest.SkipTest("CMakeTest class: SDK doesn't contain a supported C library") | ||
| 25 | |||
| 26 | self.ensure_host_package("cmake") | ||
| 27 | |||
| 28 | def test_assimp(self): | ||
| 29 | from oe.utils import parallel_make_value | ||
| 30 | pmv = parallel_make_value((self.td.get('PARALLEL_MAKE') or '').split()) | ||
| 31 | |||
| 32 | with tempfile.TemporaryDirectory(prefix="assimp", dir=self.tc.sdk_dir) as testdir: | ||
| 33 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://github.com/assimp/assimp/archive/v5.4.1.tar.gz") | ||
| 34 | |||
| 35 | opts = {} | ||
| 36 | opts["source"] = os.path.join(testdir, "assimp-5.4.1") | ||
| 37 | opts["build"] = os.path.join(testdir, "build") | ||
| 38 | opts["install"] = os.path.join(testdir, "install") | ||
| 39 | opts["parallel_make"] = "-j %d" % (pmv) if pmv else "" | ||
| 40 | |||
| 41 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) | ||
| 42 | self.assertTrue(os.path.isdir(opts["source"])) | ||
| 43 | # Apply the zlib patch https://github.com/madler/zlib/commit/a566e156b3fa07b566ddbf6801b517a9dba04fa3 | ||
| 44 | # this sed wont be needed once assimp moves its zlib copy to v1.3.1+ | ||
| 45 | self._run("sed -i '/# ifdef _FILE_OFFSET_BITS/I,+2 d' {source}/contrib/zlib/gzguts.h".format(**opts)) | ||
| 46 | os.makedirs(opts["build"]) | ||
| 47 | |||
| 48 | self._run("cd {build} && cmake -DASSIMP_WARNINGS_AS_ERRORS=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DASSIMP_BUILD_ZLIB=ON {source}".format(**opts)) | ||
| 49 | self._run("cmake --build {build} -- {parallel_make}".format(**opts)) | ||
| 50 | self._run("cmake --build {build} --target install -- DESTDIR={install}".format(**opts)) | ||
| 51 | self.check_elf(os.path.join(opts["install"], "usr", "local", "lib", "libassimp.so.5.4.1")) | ||
