diff options
4 files changed, 82 insertions, 2 deletions
diff --git a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc index 0473b60504..74caac6ac0 100644 --- a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc +++ b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc | |||
| @@ -12,6 +12,7 @@ PTESTS_FAST_META_OE = "\ | |||
| 12 | cli11 \ | 12 | cli11 \ |
| 13 | cmocka \ | 13 | cmocka \ |
| 14 | cunit \ | 14 | cunit \ |
| 15 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'dbus-broker', '', d)} \ | ||
| 15 | duktape \ | 16 | duktape \ |
| 16 | exiv2 \ | 17 | exiv2 \ |
| 17 | fuse3 \ | 18 | fuse3 \ |
diff --git a/meta-oe/recipes-core/dbus/dbus-broker/0001-test-sockopt-loosen-verification-of-stale-pidfds.patch b/meta-oe/recipes-core/dbus/dbus-broker/0001-test-sockopt-loosen-verification-of-stale-pidfds.patch new file mode 100644 index 0000000000..fac5be1917 --- /dev/null +++ b/meta-oe/recipes-core/dbus/dbus-broker/0001-test-sockopt-loosen-verification-of-stale-pidfds.patch | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | From cc7f9da25b103aacbb1595d04af9cb70ef8f43d9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 3 | Date: Thu, 4 Sep 2025 10:23:36 +0200 | ||
| 4 | Subject: [PATCH] test/sockopt: loosen verification of stale pidfds | ||
| 5 | |||
| 6 | From: David Rheinsberg <david@readahead.eu> | ||
| 7 | |||
| 8 | Newer kernels now properly return stale pidfds from AF_UNIX sockets, | ||
| 9 | rather than refusing the operation. Ensure that our tests adopt to this | ||
| 10 | and properly verify staleness. | ||
| 11 | |||
| 12 | Signed-off-by: David Rheinsberg <david@readahead.eu> | ||
| 13 | Upstream-Status: Backport [https://github.com/bus1/dbus-broker/commit/fd5c6e191bffcf5b3e6c9abb8b0b03479accc04b] | ||
| 14 | Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 15 | --- | ||
| 16 | src/util/test-sockopt.c | 16 ++++++++++++---- | ||
| 17 | 1 file changed, 12 insertions(+), 4 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/src/util/test-sockopt.c b/src/util/test-sockopt.c | ||
| 20 | index 04148af..eaa8fba 100644 | ||
| 21 | --- a/src/util/test-sockopt.c | ||
| 22 | +++ b/src/util/test-sockopt.c | ||
| 23 | @@ -81,17 +81,25 @@ static void test_peerpidfd_client( | ||
| 24 | |||
| 25 | r = sockopt_get_peerpidfd(fd, &pidfd); | ||
| 26 | if (r != SOCKOPT_E_UNSUPPORTED) { | ||
| 27 | - if (stale) { | ||
| 28 | - c_assert(r == SOCKOPT_E_REAPED); | ||
| 29 | + if (r == SOCKOPT_E_REAPED) { | ||
| 30 | + /* | ||
| 31 | + * Old kernels refused to return stale pidfds. Hence, | ||
| 32 | + * in that case verify that we expected a stale pidfd. | ||
| 33 | + */ | ||
| 34 | + c_assert(stale); | ||
| 35 | } else { | ||
| 36 | c_assert(!r); | ||
| 37 | c_assert(pidfd >= 0); | ||
| 38 | |||
| 39 | r = proc_resolve_pidfd(pidfd, &pid_socket); | ||
| 40 | c_assert(!r); | ||
| 41 | - c_assert(pid_socket > 0); | ||
| 42 | |||
| 43 | - c_assert(pid_socket == pid_server); | ||
| 44 | + if (stale) { | ||
| 45 | + c_assert(pid_socket == -1); | ||
| 46 | + } else { | ||
| 47 | + c_assert(pid_socket > 0); | ||
| 48 | + c_assert(pid_socket == pid_server); | ||
| 49 | + } | ||
| 50 | } | ||
| 51 | } | ||
| 52 | } | ||
diff --git a/meta-oe/recipes-core/dbus/dbus-broker/run-ptest b/meta-oe/recipes-core/dbus/dbus-broker/run-ptest new file mode 100644 index 0000000000..789000523e --- /dev/null +++ b/meta-oe/recipes-core/dbus/dbus-broker/run-ptest | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | RET=0 | ||
| 3 | |||
| 4 | run_tests(){ | ||
| 5 | for t in *; do | ||
| 6 | if ./$t; then | ||
| 7 | echo PASS: $t | ||
| 8 | else | ||
| 9 | echo FAIL: $t | ||
| 10 | RET=1 | ||
| 11 | fi | ||
| 12 | done | ||
| 13 | } | ||
| 14 | |||
| 15 | cd /usr/lib/dbus-broker/tests/dbus | ||
| 16 | run_tests | ||
| 17 | cd /usr/lib/dbus-broker/tests/unit | ||
| 18 | run_tests | ||
| 19 | exit $RET | ||
diff --git a/meta-oe/recipes-core/dbus/dbus-broker_37.bb b/meta-oe/recipes-core/dbus/dbus-broker_37.bb index f0312181b6..c531f555d2 100644 --- a/meta-oe/recipes-core/dbus/dbus-broker_37.bb +++ b/meta-oe/recipes-core/dbus/dbus-broker_37.bb | |||
| @@ -10,7 +10,10 @@ DEPENDS = "\ | |||
| 10 | ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'libselinux (>= 3.2)', '', d)} \ | 10 | ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'libselinux (>= 3.2)', '', d)} \ |
| 11 | " | 11 | " |
| 12 | 12 | ||
| 13 | SRC_URI = "https://github.com/bus1/dbus-broker/releases/download/v${PV}/${BP}.tar.xz" | 13 | SRC_URI = "https://github.com/bus1/dbus-broker/releases/download/v${PV}/${BP}.tar.xz \ |
| 14 | file://0001-test-sockopt-loosen-verification-of-stale-pidfds.patch \ | ||
| 15 | file://run-ptest \ | ||
| 16 | " | ||
| 14 | SRC_URI[sha256sum] = "f819a8db8795fa08c767612e3823fd594694a0990f2543ecf35d6a1a6bf2ab5b" | 17 | SRC_URI[sha256sum] = "f819a8db8795fa08c767612e3823fd594694a0990f2543ecf35d6a1a6bf2ab5b" |
| 15 | 18 | ||
| 16 | UPSTREAM_CHECK_URI = "https://github.com/bus1/${BPN}/releases" | 19 | UPSTREAM_CHECK_URI = "https://github.com/bus1/${BPN}/releases" |
| @@ -18,10 +21,11 @@ UPSTREAM_CHECK_REGEX = "releases/tag/v(?P<pver>\d+)" | |||
| 18 | 21 | ||
| 19 | SYSTEMD_SERVICE:${PN} = "${BPN}.service" | 22 | SYSTEMD_SERVICE:${PN} = "${BPN}.service" |
| 20 | 23 | ||
| 21 | inherit meson pkgconfig systemd features_check | 24 | inherit meson pkgconfig systemd features_check ptest |
| 22 | 25 | ||
| 23 | EXTRA_OEMESON += "-Daudit=${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'true', 'false', d)}" | 26 | EXTRA_OEMESON += "-Daudit=${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'true', 'false', d)}" |
| 24 | EXTRA_OEMESON += "-Dselinux=${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'true', 'false', d)}" | 27 | EXTRA_OEMESON += "-Dselinux=${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'true', 'false', d)}" |
| 28 | EXTRA_OEMESON += "-Dtests=${@bb.utils.contains('PTEST_ENABLED', '1', 'true', 'false', d)}" | ||
| 25 | 29 | ||
| 26 | REQUIRED_DISTRO_FEATURES = "systemd" | 30 | REQUIRED_DISTRO_FEATURES = "systemd" |
| 27 | 31 | ||
| @@ -36,3 +40,7 @@ RDEPENDS:${PN} += "dbus-common dbus-tools" | |||
| 36 | FILES:${PN} += "${nonarch_libdir}/systemd/catalog" | 40 | FILES:${PN} += "${nonarch_libdir}/systemd/catalog" |
| 37 | FILES:${PN} += "${systemd_system_unitdir}" | 41 | FILES:${PN} += "${systemd_system_unitdir}" |
| 38 | FILES:${PN} += "${systemd_user_unitdir}" | 42 | FILES:${PN} += "${systemd_user_unitdir}" |
| 43 | FILES:${PN}-ptest += "${libdir}/${PN}/tests" | ||
| 44 | |||
| 45 | # test-sockopt fails to compile with musl without this flag | ||
| 46 | CFLAGS:append:libc-musl = "${@bb.utils.contains('PTEST_ENABLED', '1', ' -Wno-error=incompatible-pointer-types ', '', d)}" | ||
