diff options
author | Adrian Freihofer <adrian.freihofer@gmail.com> | 2023-12-07 21:52:51 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-13 11:58:15 +0000 |
commit | 85f84b4090f3fc84b377d37a18af7e4cb1b78f69 (patch) | |
tree | a7bff50696e074da62410df354782346564e7d42 /meta/lib/oeqa/selftest | |
parent | 1ec91141e5a06921eafdbdc48b19b1dd17a53ff7 (diff) | |
download | poky-85f84b4090f3fc84b377d37a18af7e4cb1b78f69.tar.gz |
oe-selftest: add tests for C and C++ build tools
Add new file for C and C++ build tools. The initial implemmentation
contains a class for CMake and one for Meson. At least these first
tests for the qemu-usermode share most of the code. That's why there
is only one c_ccp.py file and not for example a cmake.py and a
meson.py file.
(From OE-Core rev: 41390f5202a6ee7472cb82d12c7c32f89d6e52ff)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/c_cpp.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/c_cpp.py b/meta/lib/oeqa/selftest/cases/c_cpp.py new file mode 100644 index 0000000000..9a70ce29f5 --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/c_cpp.py | |||
@@ -0,0 +1,60 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | from oeqa.selftest.case import OESelftestTestCase | ||
8 | from oeqa.core.decorator.data import skipIfNotQemuUsermode | ||
9 | from oeqa.utils.commands import bitbake | ||
10 | |||
11 | |||
12 | class CCppTests(OESelftestTestCase): | ||
13 | |||
14 | @skipIfNotQemuUsermode() | ||
15 | def _qemu_usermode(self, recipe_name): | ||
16 | self.add_command_to_tearDown("bitbake -c clean %s" % recipe_name) | ||
17 | bitbake("%s -c run_tests" % recipe_name) | ||
18 | |||
19 | @skipIfNotQemuUsermode() | ||
20 | def _qemu_usermode_failing(self, recipe_name): | ||
21 | config = 'PACKAGECONFIG:pn-%s = "failing_test"' % recipe_name | ||
22 | self.write_config(config) | ||
23 | self.add_command_to_tearDown("bitbake -c clean %s" % recipe_name) | ||
24 | result = bitbake("%s -c run_tests" % recipe_name, ignore_status=True) | ||
25 | self.assertNotEqual(0, result.status, "command: %s is expected to fail but passed, status: %s, output: %s, error: %s" % ( | ||
26 | result.command, result.status, result.output, result.error)) | ||
27 | |||
28 | |||
29 | class CMakeTests(CCppTests): | ||
30 | def test_cmake_qemu(self): | ||
31 | """Test for cmake-qemu.bbclass good case | ||
32 | |||
33 | compile the cmake-example and verify the CTests pass in qemu-user. | ||
34 | qemu-user is configured by CMAKE_CROSSCOMPILING_EMULATOR. | ||
35 | """ | ||
36 | self._qemu_usermode("cmake-example") | ||
37 | |||
38 | def test_cmake_qemu_failing(self): | ||
39 | """Test for cmake-qemu.bbclass bad case | ||
40 | |||
41 | Break the comparison in the test code and verify the CTests do not pass. | ||
42 | """ | ||
43 | self._qemu_usermode_failing("cmake-example") | ||
44 | |||
45 | |||
46 | class MesonTests(CCppTests): | ||
47 | def test_meson_qemu(self): | ||
48 | """Test the qemu-user feature of the meson.bbclass good case | ||
49 | |||
50 | compile the meson-example and verify the Unit Test pass in qemu-user. | ||
51 | qemu-user is configured by meson's exe_wrapper option. | ||
52 | """ | ||
53 | self._qemu_usermode("meson-example") | ||
54 | |||
55 | def test_meson_qemu_failing(self): | ||
56 | """Test the qemu-user feature of the meson.bbclass bad case | ||
57 | |||
58 | Break the comparison in the test code and verify the Unit Test does not pass in qemu-user. | ||
59 | """ | ||
60 | self._qemu_usermode_failing("meson-example") | ||