From e506e1af294d346e7bf6d9ea8957ac2b0951d0f4 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Mon, 30 Jan 2023 10:57:23 +0000 Subject: [PATCH] (Automated Tests) Ensure we kill off any sleeping dbus sessions that we create when running Change-Id: Ic3058b2cc6218abdd5ae3e65efaf78d6821cf222 --- automated-tests/execute.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/automated-tests/execute.sh b/automated-tests/execute.sh index 35b4939..152b052 100755 --- a/automated-tests/execute.sh +++ b/automated-tests/execute.sh @@ -187,6 +187,19 @@ else done echo $1 not found fi + + # Kill off any dangling or sleeping dbus sessions that we would have created + cgroup=$(awk -F ':' '$2 == "name=systemd" { print $3 }' /proc/self/cgroup) + if [ -n "$cgroup" ] ; then + for pid in $(cat /sys/fs/cgroup/systemd/$cgroup/tasks 2>/dev/null); do + comm=$(cat /proc/$pid/comm 2>/dev/null) + case "$comm" in + dbus-daemon|dbus-launch) + kill $pid + ;; + esac + done + fi fi if [ -f summary.xml ] ; then -- 2.7.4