mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-19 13:53:41 -09:00
Test an actual D-Bus round-trip using easydbus: - obtain a name on the system bus - subscribe to a signal on a chosen object/interface - emit signal with a string payload - run the easydbus mainloop - verify the handler received the expected payload This covers both the default Lua interpreter (Lua 5.4) and LuaJIT (Lua 5.1 ABI). Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> [Julien: - move test files into a rootfs-overlay - move common BR2_PACKAGE_{,EASY}DBUS configs to EasyDBusBase - make stricter check of script output - add DEVELOPERS entry for rootfs-overlay files ] Signed-off-by: Julien Olivain <ju.o@free.fr>
45 lines
1.0 KiB
Python
45 lines
1.0 KiB
Python
import infra.basetest
|
|
|
|
from tests.package.test_lua import TestLuaBase
|
|
|
|
|
|
class EasyDBusBase(TestLuaBase):
|
|
rootfs_overlay = \
|
|
infra.filepath("tests/package/test_easydbus/rootfs-overlay")
|
|
config = TestLuaBase.config + \
|
|
f"""
|
|
BR2_PACKAGE_DBUS=y
|
|
BR2_PACKAGE_EASYDBUS=y
|
|
BR2_ROOTFS_OVERLAY="{rootfs_overlay}"
|
|
"""
|
|
|
|
def signal_round_trip(self):
|
|
cmd = "lua /root/easydbus-sample.lua"
|
|
output, exit_code = self.emulator.run(cmd)
|
|
self.assertEqual(exit_code, 0)
|
|
self.assertEqual(output[0], "OK")
|
|
|
|
|
|
class TestLuaEasyDBus(EasyDBusBase):
|
|
config = EasyDBusBase.config + \
|
|
"""
|
|
BR2_PACKAGE_LUA=y
|
|
"""
|
|
|
|
def test_run(self):
|
|
self.login()
|
|
self.module_test("easydbus")
|
|
self.signal_round_trip()
|
|
|
|
|
|
class TestLuajitEasyDBus(EasyDBusBase):
|
|
config = EasyDBusBase.config + \
|
|
"""
|
|
BR2_PACKAGE_LUAJIT=y
|
|
"""
|
|
|
|
def test_run(self):
|
|
self.login()
|
|
self.module_test("easydbus")
|
|
self.signal_round_trip()
|