|
|
@ -374,9 +374,15 @@ class TestCase(unittest.TestCase):
|
|
|
|
mitogen.core.Latch._on_fork()
|
|
|
|
mitogen.core.Latch._on_fork()
|
|
|
|
if get_fd_count() != self._fd_count_before:
|
|
|
|
if get_fd_count() != self._fd_count_before:
|
|
|
|
if sys.platform == 'linux':
|
|
|
|
if sys.platform == 'linux':
|
|
|
|
os.system('lsof +E -w -p %i | grep -vw mem' % (os.getpid(),))
|
|
|
|
subprocess.check_call(
|
|
|
|
|
|
|
|
'lsof +E -w -p %i | grep -vw mem' % (os.getpid(),),
|
|
|
|
|
|
|
|
shell=True,
|
|
|
|
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
os.system('lsof -w -p %i | grep -vw mem' % (os.getpid(),))
|
|
|
|
subprocess.check_call(
|
|
|
|
|
|
|
|
'lsof -w -p %i | grep -vw mem' % (os.getpid(),),
|
|
|
|
|
|
|
|
shell=True,
|
|
|
|
|
|
|
|
)
|
|
|
|
assert 0, "%s leaked FDs. Count before: %s, after: %s" % (
|
|
|
|
assert 0, "%s leaked FDs. Count before: %s, after: %s" % (
|
|
|
|
self, self._fd_count_before, get_fd_count(),
|
|
|
|
self, self._fd_count_before, get_fd_count(),
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -410,12 +416,18 @@ class TestCase(unittest.TestCase):
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
print('Leaked children of unit test process:')
|
|
|
|
print('Leaked children of unit test process:')
|
|
|
|
os.system('ps -o "user,pid,%%cpu,%%mem,vsz,rss,tty,stat,start,time,command" -ww -p %s'
|
|
|
|
subprocess.check_call(
|
|
|
|
% (','.join(str(p.pid) for p in children_leaked),))
|
|
|
|
['ps', '-o', 'user,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,command', '-ww', '-p',
|
|
|
|
|
|
|
|
','.join(str(p.pid) for p in children_leaked),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)
|
|
|
|
if self._children_before:
|
|
|
|
if self._children_before:
|
|
|
|
print('Pre-existing children of unit test process:')
|
|
|
|
print('Pre-existing children of unit test process:')
|
|
|
|
os.system('ps -o "user,pid,%%cpu,%%mem,vsz,rss,tty,stat,start,time,command" -ww -p %s'
|
|
|
|
subprocess.check_call(
|
|
|
|
% (','.join(str(p.pid) for p in self._children_before),))
|
|
|
|
['ps', '-o', 'user,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,command', '-ww', '-p',
|
|
|
|
|
|
|
|
','.join(str(p.pid) for p in self._children_before),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)
|
|
|
|
assert 0, "%s leaked still-running subprocesses." % (self,)
|
|
|
|
assert 0, "%s leaked still-running subprocesses." % (self,)
|
|
|
|
|
|
|
|
|
|
|
|
def tearDown(self):
|
|
|
|
def tearDown(self):
|
|
|
|