support/testing/tests: new NetworkManager/GOI test

This test is inspired from the details provided by Fiona Klute's cover
letter for a GOI/glib bump series at:

  https://lore.kernel.org/buildroot/20250120211707.2381182-1-fiona.klute@gmx.de/

Which itself uses the example code at:

  https://networkmanager.dev/docs/developers/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Thomas Petazzoni
2025-02-04 11:40:42 +01:00
parent 03df6d1a26
commit 3ea79058c0
3 changed files with 52 additions and 0 deletions

View File

@@ -1103,6 +1103,8 @@ F: package/python-dunamai/
F: package/python-poetry-dynamic-versioning/
F: package/python-pyasynchat/
F: package/python-pyasyncore/
F: support/testing/tests/package/sample_python_networkmanager_goi.py
F: support/testing/tests/package/test_python_networkmanager_goi.py
N: Flávio Tapajós <flavio.tapajos@newtesc.com.br>
F: configs/asus_tinker-s_rk3288_defconfig

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env python3
# This script is from https://networkmanager.dev/docs/developers/
import gi
gi.require_version("NM", "1.0")
from gi.repository import NM # noqa: E402
def print_values(setting, key, value, flags, data):
print(" {}.{}: {}".format(setting.get_name(), key, value))
# Create the client object. This automatically loads all the D-Bus
# tree and creates in-memory objects for connections, devices, access
# points, etc.
client = NM.Client.new(None)
# Obtain a list of connection profiles ...
connections = client.get_connections()
# ... and print their properties
for c in connections:
print("{}:".format(c.get_id()))
c.for_each_setting_value(print_values, None)
print("\n")

View File

@@ -0,0 +1,24 @@
from tests.package.test_python import TestPythonPackageBase
class TestPythonPy3NetworkmanagerGoi(TestPythonPackageBase):
__test__ = True
# Can't use TestPythonPackageBase.config because we need headers
# >= 4.20 for network-manager, so we have to use the bleeding-edge
# toolchain.
config = \
"""
BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV5_EABI_GLIBC_BLEEDING_EDGE=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_GOBJECT=y
BR2_INIT_SYSTEMD=y
BR2_PACKAGE_NETWORK_MANAGER=y
BR2_TARGET_ROOTFS_CPIO=y
# BR2_TARGET_ROOTFS_TAR is not set
"""
sample_scripts = ["tests/package/sample_python_networkmanager_goi.py"]
timeout = 30