From b1f24ad3cf545a2e12c76fcc5554959328d1843d Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Thu, 28 May 2015 13:12:48 +0000 Subject: [PATCH] Cleanup the forked child in TestChangeProcessGroup if the test fails for some reason, we can end up leaking a process. This has a tendency to confuse the buildbots. I have added a cleanup hook to make sure we cleanup the child. llvm-svn: 238421 --- .../process_group/TestChangeProcessGroup.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lldb/test/functionalities/process_group/TestChangeProcessGroup.py b/lldb/test/functionalities/process_group/TestChangeProcessGroup.py index da8c8193da76..a6fc2eb8fbc9 100644 --- a/lldb/test/functionalities/process_group/TestChangeProcessGroup.py +++ b/lldb/test/functionalities/process_group/TestChangeProcessGroup.py @@ -65,6 +65,14 @@ class ChangeProcessGroupTestCase(TestBase): self.assertTrue(err.Success() and retcode == 0, "Failed to read file %s: %s, retcode: %d" % (pid_file_path, err.GetCString(), retcode)) + # make sure we cleanup the forked child also + def cleanupChild(): + if lldb.remote_platform: + lldb.remote_platform.Kill(int(pid)) + else: + if os.path.exists("/proc/" + pid): + os.kill(int(pid), signal.SIGKILL) + self.addTearDownHook(cleanupChild) # Create a target by the debugger. target = self.dbg.CreateTarget(exe)