mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-01-01 13:58:06 +00:00
dbus-broker: add ptest support
It takes less than 30 seconds to execute. Add a backported patch that fixes a broken test. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
parent
c7812d7f9f
commit
05230420ab
|
|
@ -12,6 +12,7 @@ PTESTS_FAST_META_OE = "\
|
|||
cli11 \
|
||||
cmocka \
|
||||
cunit \
|
||||
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'dbus-broker', '', d)} \
|
||||
duktape \
|
||||
exiv2 \
|
||||
fuse3 \
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
From cc7f9da25b103aacbb1595d04af9cb70ef8f43d9 Mon Sep 17 00:00:00 2001
|
||||
From: Gyorgy Sarvari <skandigraun@gmail.com>
|
||||
Date: Thu, 4 Sep 2025 10:23:36 +0200
|
||||
Subject: [PATCH] test/sockopt: loosen verification of stale pidfds
|
||||
|
||||
From: David Rheinsberg <david@readahead.eu>
|
||||
|
||||
Newer kernels now properly return stale pidfds from AF_UNIX sockets,
|
||||
rather than refusing the operation. Ensure that our tests adopt to this
|
||||
and properly verify staleness.
|
||||
|
||||
Signed-off-by: David Rheinsberg <david@readahead.eu>
|
||||
Upstream-Status: Backport [https://github.com/bus1/dbus-broker/commit/fd5c6e191bffcf5b3e6c9abb8b0b03479accc04b]
|
||||
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
|
||||
---
|
||||
src/util/test-sockopt.c | 16 ++++++++++++----
|
||||
1 file changed, 12 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/util/test-sockopt.c b/src/util/test-sockopt.c
|
||||
index 04148af..eaa8fba 100644
|
||||
--- a/src/util/test-sockopt.c
|
||||
+++ b/src/util/test-sockopt.c
|
||||
@@ -81,17 +81,25 @@ static void test_peerpidfd_client(
|
||||
|
||||
r = sockopt_get_peerpidfd(fd, &pidfd);
|
||||
if (r != SOCKOPT_E_UNSUPPORTED) {
|
||||
- if (stale) {
|
||||
- c_assert(r == SOCKOPT_E_REAPED);
|
||||
+ if (r == SOCKOPT_E_REAPED) {
|
||||
+ /*
|
||||
+ * Old kernels refused to return stale pidfds. Hence,
|
||||
+ * in that case verify that we expected a stale pidfd.
|
||||
+ */
|
||||
+ c_assert(stale);
|
||||
} else {
|
||||
c_assert(!r);
|
||||
c_assert(pidfd >= 0);
|
||||
|
||||
r = proc_resolve_pidfd(pidfd, &pid_socket);
|
||||
c_assert(!r);
|
||||
- c_assert(pid_socket > 0);
|
||||
|
||||
- c_assert(pid_socket == pid_server);
|
||||
+ if (stale) {
|
||||
+ c_assert(pid_socket == -1);
|
||||
+ } else {
|
||||
+ c_assert(pid_socket > 0);
|
||||
+ c_assert(pid_socket == pid_server);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
19
meta-oe/recipes-core/dbus/dbus-broker/run-ptest
Normal file
19
meta-oe/recipes-core/dbus/dbus-broker/run-ptest
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
RET=0
|
||||
|
||||
run_tests(){
|
||||
for t in *; do
|
||||
if ./$t; then
|
||||
echo PASS: $t
|
||||
else
|
||||
echo FAIL: $t
|
||||
RET=1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
cd /usr/lib/dbus-broker/tests/dbus
|
||||
run_tests
|
||||
cd /usr/lib/dbus-broker/tests/unit
|
||||
run_tests
|
||||
exit $RET
|
||||
|
|
@ -10,7 +10,10 @@ DEPENDS = "\
|
|||
${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'libselinux (>= 3.2)', '', d)} \
|
||||
"
|
||||
|
||||
SRC_URI = "https://github.com/bus1/dbus-broker/releases/download/v${PV}/${BP}.tar.xz"
|
||||
SRC_URI = "https://github.com/bus1/dbus-broker/releases/download/v${PV}/${BP}.tar.xz \
|
||||
file://0001-test-sockopt-loosen-verification-of-stale-pidfds.patch \
|
||||
file://run-ptest \
|
||||
"
|
||||
SRC_URI[sha256sum] = "f819a8db8795fa08c767612e3823fd594694a0990f2543ecf35d6a1a6bf2ab5b"
|
||||
|
||||
UPSTREAM_CHECK_URI = "https://github.com/bus1/${BPN}/releases"
|
||||
|
|
@ -18,10 +21,11 @@ UPSTREAM_CHECK_REGEX = "releases/tag/v(?P<pver>\d+)"
|
|||
|
||||
SYSTEMD_SERVICE:${PN} = "${BPN}.service"
|
||||
|
||||
inherit meson pkgconfig systemd features_check
|
||||
inherit meson pkgconfig systemd features_check ptest
|
||||
|
||||
EXTRA_OEMESON += "-Daudit=${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'true', 'false', d)}"
|
||||
EXTRA_OEMESON += "-Dselinux=${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'true', 'false', d)}"
|
||||
EXTRA_OEMESON += "-Dtests=${@bb.utils.contains('PTEST_ENABLED', '1', 'true', 'false', d)}"
|
||||
|
||||
REQUIRED_DISTRO_FEATURES = "systemd"
|
||||
|
||||
|
|
@ -36,3 +40,7 @@ RDEPENDS:${PN} += "dbus-common dbus-tools"
|
|||
FILES:${PN} += "${nonarch_libdir}/systemd/catalog"
|
||||
FILES:${PN} += "${systemd_system_unitdir}"
|
||||
FILES:${PN} += "${systemd_user_unitdir}"
|
||||
FILES:${PN}-ptest += "${libdir}/${PN}/tests"
|
||||
|
||||
# test-sockopt fails to compile with musl without this flag
|
||||
CFLAGS:append:libc-musl = "${@bb.utils.contains('PTEST_ENABLED', '1', ' -Wno-error=incompatible-pointer-types ', '', d)}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user