test-runner: Move code kill processes created
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 17 Nov 2020 21:58:37 +0000 (13:58 -0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:33 +0000 (19:08 +0530)
This moves the code that kill processes outside of the loop iteration.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
tools/test-runner.c

index 586152c..f3ad27d 100755 (executable)
@@ -735,17 +735,8 @@ start_next:
                        monitor_pid = -1;
                }
 
-               if (corpse == pid) {
-                       if (!run_auto) {
-                               if (daemon_pid > 0)
-                                       kill(daemon_pid, SIGTERM);
-                               if (dbus_pid > 0)
-                                       kill(dbus_pid, SIGTERM);
-                               if (monitor_pid > 0)
-                                       kill(monitor_pid, SIGTERM);
-                       }
+               if (corpse == pid)
                        break;
-               }
        }
 
        if (run_auto) {
@@ -753,6 +744,15 @@ start_next:
                goto start_next;
        }
 
+       if (daemon_pid > 0)
+               kill(daemon_pid, SIGTERM);
+
+       if (dbus_pid > 0)
+               kill(dbus_pid, SIGTERM);
+
+       if (monitor_pid > 0)
+               kill(monitor_pid, SIGTERM);
+
        if (serial_fd >= 0) {
                close(serial_fd);
                serial_fd = -1;