(Automated Tests) Ensure we kill off any sleeping dbus sessions that we create when... 74/287474/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 30 Jan 2023 10:58:16 +0000 (10:58 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 30 Jan 2023 10:58:16 +0000 (10:58 +0000)
Change-Id: Ia1f8b6c87ee75f8dee30cea64bdc6d455a918576

automated-tests/execute.sh

index 35b4939..152b052 100755 (executable)
@@ -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