From: Yu Watanabe Date: Thu, 29 Aug 2024 09:53:31 +0000 (+0900) Subject: test: add test for GetUnitByPID() D-Bus method X-Git-Tag: v257-rc1~597 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c5d5d769881f801819631d91ea789506c917ea62;p=thirdparty%2Fsystemd.git test: add test for GetUnitByPID() D-Bus method For issue #34104. --- diff --git a/test/units/TEST-07-PID1.issue-34104.sh b/test/units/TEST-07-PID1.issue-34104.sh new file mode 100755 index 00000000000..777065ce635 --- /dev/null +++ b/test/units/TEST-07-PID1.issue-34104.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later +set -eux +set -o pipefail + +# shellcheck source=test/units/util.sh +. "$(dirname "$0")"/util.sh + +systemd-run -u test-sleep.service sleep 1h +SLEEP_PID=$(systemctl show test-sleep.service -p ExecMainPID --value) +SLEEP_OBJECT=$(busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager GetUnitByPID "u" "$SLEEP_PID") +assert_eq "$SLEEP_OBJECT" "o \"/org/freedesktop/systemd1/unit/test_2dsleep_2eservice\"" +systemctl stop test-sleep.service + +# For https://github.com/systemd/systemd/issues/34104 +for ((i = 10000; i < 11000; i++)); do + busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager GetUnitByPID "u" "$i" || : +done + +exit 0