mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 12:59:02 +02:00
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>
This commit is contained in:
parent
1ec91141e5
commit
85f84b4090
60
meta/lib/oeqa/selftest/cases/c_cpp.py
Normal file
60
meta/lib/oeqa/selftest/cases/c_cpp.py
Normal file
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# Copyright OpenEmbedded Contributors
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
from oeqa.selftest.case import OESelftestTestCase
|
||||
from oeqa.core.decorator.data import skipIfNotQemuUsermode
|
||||
from oeqa.utils.commands import bitbake
|
||||
|
||||
|
||||
class CCppTests(OESelftestTestCase):
|
||||
|
||||
@skipIfNotQemuUsermode()
|
||||
def _qemu_usermode(self, recipe_name):
|
||||
self.add_command_to_tearDown("bitbake -c clean %s" % recipe_name)
|
||||
bitbake("%s -c run_tests" % recipe_name)
|
||||
|
||||
@skipIfNotQemuUsermode()
|
||||
def _qemu_usermode_failing(self, recipe_name):
|
||||
config = 'PACKAGECONFIG:pn-%s = "failing_test"' % recipe_name
|
||||
self.write_config(config)
|
||||
self.add_command_to_tearDown("bitbake -c clean %s" % recipe_name)
|
||||
result = bitbake("%s -c run_tests" % recipe_name, ignore_status=True)
|
||||
self.assertNotEqual(0, result.status, "command: %s is expected to fail but passed, status: %s, output: %s, error: %s" % (
|
||||
result.command, result.status, result.output, result.error))
|
||||
|
||||
|
||||
class CMakeTests(CCppTests):
|
||||
def test_cmake_qemu(self):
|
||||
"""Test for cmake-qemu.bbclass good case
|
||||
|
||||
compile the cmake-example and verify the CTests pass in qemu-user.
|
||||
qemu-user is configured by CMAKE_CROSSCOMPILING_EMULATOR.
|
||||
"""
|
||||
self._qemu_usermode("cmake-example")
|
||||
|
||||
def test_cmake_qemu_failing(self):
|
||||
"""Test for cmake-qemu.bbclass bad case
|
||||
|
||||
Break the comparison in the test code and verify the CTests do not pass.
|
||||
"""
|
||||
self._qemu_usermode_failing("cmake-example")
|
||||
|
||||
|
||||
class MesonTests(CCppTests):
|
||||
def test_meson_qemu(self):
|
||||
"""Test the qemu-user feature of the meson.bbclass good case
|
||||
|
||||
compile the meson-example and verify the Unit Test pass in qemu-user.
|
||||
qemu-user is configured by meson's exe_wrapper option.
|
||||
"""
|
||||
self._qemu_usermode("meson-example")
|
||||
|
||||
def test_meson_qemu_failing(self):
|
||||
"""Test the qemu-user feature of the meson.bbclass bad case
|
||||
|
||||
Break the comparison in the test code and verify the Unit Test does not pass in qemu-user.
|
||||
"""
|
||||
self._qemu_usermode_failing("meson-example")
|
Loading…
Reference in New Issue
Block a user