(Automated Tests) Ensure we kill off any sleeping dbus sessions that we create when... 88/287188/2
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 23 Jan 2023 18:08:58 +0000 (18:08 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 30 Jan 2023 10:57:00 +0000 (10:57 +0000)
Change-Id: Iac299a0ea3f57505fdb0e906d22a38f0a21946f4

automated-tests/execute.sh

index 35b4939a97dc24c8b385b4d669b3624faf80814b..152b0524e6e5412b34e7a153536a770340eff43f 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