diff options
author | Ross Burton <ross.burton@arm.com> | 2024-05-20 10:18:28 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-05-22 10:21:26 +0100 |
commit | fd2714953d3f376d5ad7014ebd3d341d5d188ac4 (patch) | |
tree | 4aacee934eb3f78bcf1a1a0b189aa85dd87c2feb /meta/lib/oeqa/sdk/cases/cmake.py | |
parent | 4b62fa0f5294552f2d6e1267f9fe609952b3cb6c (diff) | |
download | poky-fd2714953d3f376d5ad7014ebd3d341d5d188ac4.tar.gz |
oeqa/sdk: rename test cases
Instead of having a test called eg "assimp", rename it to "cmake" as the
point of the test is to verify that CMake works. This should make it
clearer what the tests are actually exercising.
(From OE-Core rev: ccf7fdc0e5b6df218b319f972cd5ba142c06c243)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/sdk/cases/cmake.py')
-rw-r--r-- | meta/lib/oeqa/sdk/cases/cmake.py | 45 |
1 files changed, 45 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..db7d826a38 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/cmake.py | |||
@@ -0,0 +1,45 @@ | |||
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 | if not (self.tc.hasHostPackage("nativesdk-cmake") or | ||
23 | self.tc.hasHostPackage("cmake-native")): | ||
24 | raise unittest.SkipTest("CMakeTest: needs cmake") | ||
25 | |||
26 | def test_assimp(self): | ||
27 | with tempfile.TemporaryDirectory(prefix="assimp", dir=self.tc.sdk_dir) as testdir: | ||
28 | tarball = self.fetch(testdir, self.td["DL_DIR"], "https://github.com/assimp/assimp/archive/v5.4.1.tar.gz") | ||
29 | |||
30 | dirs = {} | ||
31 | dirs["source"] = os.path.join(testdir, "assimp-5.4.1") | ||
32 | dirs["build"] = os.path.join(testdir, "build") | ||
33 | dirs["install"] = os.path.join(testdir, "install") | ||
34 | |||
35 | subprocess.check_output(["tar", "xf", tarball, "-C", testdir], stderr=subprocess.STDOUT) | ||
36 | self.assertTrue(os.path.isdir(dirs["source"])) | ||
37 | # Apply the zlib patch https://github.com/madler/zlib/commit/a566e156b3fa07b566ddbf6801b517a9dba04fa3 | ||
38 | # this sed wont be needed once assimp moves its zlib copy to v1.3.1+ | ||
39 | self._run("sed -i '/# ifdef _FILE_OFFSET_BITS/I,+2 d' {source}/contrib/zlib/gzguts.h".format(**dirs)) | ||
40 | os.makedirs(dirs["build"]) | ||
41 | |||
42 | self._run("cd {build} && cmake -DASSIMP_WARNINGS_AS_ERRORS=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DASSIMP_BUILD_ZLIB=ON {source}".format(**dirs)) | ||
43 | self._run("cmake --build {build} -- -j".format(**dirs)) | ||
44 | self._run("cmake --build {build} --target install -- DESTDIR={install}".format(**dirs)) | ||
45 | self.check_elf(os.path.join(dirs["install"], "usr", "local", "lib", "libassimp.so.5.4.1")) | ||