Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Nosthoff via buildroot <buildroot@buildroot.org>
To: buildroot@buildroot.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: [Buildroot] [PATCH] support/testing: add sdbus-cpp runtime test
Date: Mon, 30 Nov 2026 21:14:01 +0100	[thread overview]
Message-ID: <20261130201402.657202-1-buildroot@heine.tech> (raw)

Build a subset of the upstream integration tests in a test-only external package against the installed sdbus-c++ library. Run selected connection, method, signal and property tests using both event loops on an emulated systemd target.

Signed-off-by: Michael Nosthoff <buildroot@heine.tech>
Assisted-By: gpt-6.1-terra
---
 DEVELOPERS                                    |  2 +
 .../package/br2-external/sdbus-cpp/Config.in  |  1 +
 .../br2-external/sdbus-cpp/external.desc      |  1 +
 .../br2-external/sdbus-cpp/external.mk        |  1 +
 .../package/sdbus-cpp-test/Config.in          |  8 ++++
 .../package/sdbus-cpp-test/sdbus-cpp-test.mk  | 37 ++++++++++++++++
 .../testing/tests/package/test_sdbus_cpp.py   | 44 +++++++++++++++++++
 7 files changed, 94 insertions(+)
 create mode 100644 support/testing/tests/package/br2-external/sdbus-cpp/Config.in
 create mode 100644 support/testing/tests/package/br2-external/sdbus-cpp/external.desc
 create mode 100644 support/testing/tests/package/br2-external/sdbus-cpp/external.mk
 create mode 100644 support/testing/tests/package/br2-external/sdbus-cpp/package/sdbus-cpp-test/Config.in
 create mode 100644 support/testing/tests/package/br2-external/sdbus-cpp/package/sdbus-cpp-test/sdbus-cpp-test.mk
 create mode 100644 support/testing/tests/package/test_sdbus_cpp.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 59fad7f26b..7a4e5a67db 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2494,7 +2494,9 @@ F:	package/protobuf/
 F:	package/sdbus-cpp/
 F:	package/spdlog/
 F:	package/sqlitecpp/
+F:	support/testing/tests/package/br2-external/sdbus-cpp/
 F:	support/testing/tests/package/br2-external/sqlitecpp/
+F:	support/testing/tests/package/test_sdbus_cpp.py
 F:	support/testing/tests/package/test_sqlitecpp.py
 
 N:	Michael Trimarchi <michael@amarulasolutions.com>
diff --git a/support/testing/tests/package/br2-external/sdbus-cpp/Config.in b/support/testing/tests/package/br2-external/sdbus-cpp/Config.in
new file mode 100644
index 0000000000..33c6f3161d
--- /dev/null
+++ b/support/testing/tests/package/br2-external/sdbus-cpp/Config.in
@@ -0,0 +1 @@
+source "$BR2_EXTERNAL_SDBUS_CPP_TEST_PATH/package/sdbus-cpp-test/Config.in"
diff --git a/support/testing/tests/package/br2-external/sdbus-cpp/external.desc b/support/testing/tests/package/br2-external/sdbus-cpp/external.desc
new file mode 100644
index 0000000000..5cc8d178fb
--- /dev/null
+++ b/support/testing/tests/package/br2-external/sdbus-cpp/external.desc
@@ -0,0 +1 @@
+name: SDBUS_CPP_TEST
diff --git a/support/testing/tests/package/br2-external/sdbus-cpp/external.mk b/support/testing/tests/package/br2-external/sdbus-cpp/external.mk
new file mode 100644
index 0000000000..ea6169fb67
--- /dev/null
+++ b/support/testing/tests/package/br2-external/sdbus-cpp/external.mk
@@ -0,0 +1 @@
+include $(sort $(wildcard $(BR2_EXTERNAL_SDBUS_CPP_TEST_PATH)/package/*/*.mk))
diff --git a/support/testing/tests/package/br2-external/sdbus-cpp/package/sdbus-cpp-test/Config.in b/support/testing/tests/package/br2-external/sdbus-cpp/package/sdbus-cpp-test/Config.in
new file mode 100644
index 0000000000..17aef9a571
--- /dev/null
+++ b/support/testing/tests/package/br2-external/sdbus-cpp/package/sdbus-cpp-test/Config.in
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_SDBUS_CPP_TEST
+	bool "sdbus-c++ integration tests"
+	depends on BR2_PACKAGE_SDBUS_CPP
+	depends on BR2_USE_WCHAR # gtest
+	select BR2_PACKAGE_GTEST
+	select BR2_PACKAGE_GTEST_GMOCK
+	help
+	  Build a subset of the upstream sdbus-c++ integration tests.
diff --git a/support/testing/tests/package/br2-external/sdbus-cpp/package/sdbus-cpp-test/sdbus-cpp-test.mk b/support/testing/tests/package/br2-external/sdbus-cpp/package/sdbus-cpp-test/sdbus-cpp-test.mk
new file mode 100644
index 0000000000..500c446f9d
--- /dev/null
+++ b/support/testing/tests/package/br2-external/sdbus-cpp/package/sdbus-cpp-test/sdbus-cpp-test.mk
@@ -0,0 +1,37 @@
+################################################################################
+#
+# sdbus-cpp-test
+#
+################################################################################
+
+SDBUS_CPP_TEST_DEPENDENCIES = gtest sdbus-cpp
+SDBUS_CPP_TEST_UPSTREAM_DIR = $(SDBUS_CPP_DIR)/tests/integrationtests
+SDBUS_CPP_TEST_SOURCES = \
+	DBusConnectionTests.cpp \
+	DBusMethodsTests.cpp \
+	DBusSignalsTests.cpp \
+	DBusPropertiesTests.cpp \
+	TestFixture.cpp \
+	TestAdaptor.cpp \
+	TestProxy.cpp \
+	sdbus-c++-integration-tests.cpp
+
+define SDBUS_CPP_TEST_BUILD_CMDS
+	$(TARGET_CXX) $(TARGET_CXXFLAGS) -std=c++20 -pthread \
+		-DLIBSYSTEMD_VERSION=$(firstword $(subst ., ,$(SYSTEMD_VERSION))) \
+		-DSDBUS_systemd \
+		-I$(SDBUS_CPP_TEST_UPSTREAM_DIR)/dbus-api/gen-cpp \
+		$(addprefix $(SDBUS_CPP_TEST_UPSTREAM_DIR)/,$(SDBUS_CPP_TEST_SOURCES)) \
+		-o $(@D)/sdbus-c++-integration-tests \
+		$(TARGET_LDFLAGS) -lsdbus-c++ -lgmock -lgtest -lsystemd
+endef
+
+define SDBUS_CPP_TEST_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/sdbus-c++-integration-tests \
+		$(TARGET_DIR)/usr/bin/sdbus-c++-integration-tests
+	$(INSTALL) -D -m 0644 \
+		$(SDBUS_CPP_TEST_UPSTREAM_DIR)/files/org.sdbuscpp.integrationtests.conf \
+		$(TARGET_DIR)/etc/dbus-1/system.d/org.sdbuscpp.integrationtests.conf
+endef
+
+$(eval $(generic-package))
diff --git a/support/testing/tests/package/test_sdbus_cpp.py b/support/testing/tests/package/test_sdbus_cpp.py
new file mode 100644
index 0000000000..e39e619cd3
--- /dev/null
+++ b/support/testing/tests/package/test_sdbus_cpp.py
@@ -0,0 +1,44 @@
+import os
+
+import infra.basetest
+
+
+class TestSdbusCpp(infra.basetest.BRTest):
+    br2_external = [infra.filepath("tests/package/br2-external/sdbus-cpp")]
+    config = \
+        """
+        BR2_arm=y
+        BR2_cortex_a9=y
+        BR2_ARM_ENABLE_VFP=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
+        BR2_INIT_SYSTEMD=y
+        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+        BR2_PACKAGE_SDBUS_CPP=y
+        BR2_PACKAGE_SDBUS_CPP_TEST=y
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def test_run(self):
+        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv7", kernel="builtin",
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+
+        tests = [
+            "Connection.CanBeDefaultConstructed",
+            "Connection.CanRequestName",
+            "SdbusTestObject/0.CallsMethodsWithBaseTypesSuccessfully",
+            "SdbusTestObject/0.CallsMethodWithVariantSuccessfully",
+            "SdbusTestObject/0.EmitsSimpleSignalSuccessfully",
+            "SdbusTestObject/0.WritesAndReadsReadWritePropertySuccessfully",
+            "SdbusTestObject/1.CallsMethodsWithBaseTypesSuccessfully",
+            "SdbusTestObject/1.CallsMethodWithVariantSuccessfully",
+            "SdbusTestObject/1.EmitsSimpleSignalSuccessfully",
+            "SdbusTestObject/1.WritesAndReadsReadWritePropertySuccessfully",
+        ]
+        cmd = f"/usr/bin/sdbus-c++-integration-tests --gtest_filter='{':'.join(tests)}'"
+        output, exit_code = self.emulator.run(cmd, timeout=120)
+        self.assertEqual(exit_code, 0, output)
+        self.assertIn(f"[  PASSED  ] {len(tests)} tests.", output)
-- 
2.53.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

                 reply	other threads:[~2026-11-30 20:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130201402.657202-1-buildroot@heine.tech \
    --to=buildroot@buildroot.org \
    --cc=buildroot@heine.tech \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox