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
This commit is contained in:
Pavel Labath 2015-05-28 13:12:48 +00:00
parent 3d3c60117f
commit b1f24ad3cf
1 changed files with 8 additions and 0 deletions

View File

@ -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)