Allows us to kill the test and any children it has spawned.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
 
        pid = fork();
        if (pid == 0) {
+               setpgid(0, 0);
                exit(test_function());
        } else if (pid == -1) {
                perror("fork");
                return 1;
        }
 
+       setpgid(pid, pid);
+
        /* Wake us up in timeout seconds */
        alarm(TIMEOUT);
        terminated = false;
 
                if (terminated) {
                        printf("!! force killing %s\n", name);
-                       kill(pid, SIGKILL);
+                       kill(-pid, SIGKILL);
                        return 1;
                } else {
                        printf("!! killing %s\n", name);
-                       kill(pid, SIGTERM);
+                       kill(-pid, SIGTERM);
                        terminated = true;
                        alarm(KILL_TIMEOUT);
                        goto wait;
                }
        }
 
+       /* Kill anything else in the process group that is still running */
+       kill(-pid, SIGTERM);
+
        if (WIFEXITED(status))
                status = WEXITSTATUS(status);
        else {