Commit 26f92680 authored by Richard Oudkerk's avatar Richard Oudkerk

Stop trying to use strace, but add a sleep before terminate().

parent 86823a52
...@@ -300,12 +300,14 @@ class _TestProcess(BaseTestCase): ...@@ -300,12 +300,14 @@ class _TestProcess(BaseTestCase):
self.assertTimingAlmostEqual(join.elapsed, 0.0) self.assertTimingAlmostEqual(join.elapsed, 0.0)
self.assertEqual(p.is_alive(), True) self.assertEqual(p.is_alive(), True)
# XXX maybe terminating too soon causes the problems on Gentoo...
time.sleep(1)
p.terminate() p.terminate()
if hasattr(signal, 'alarm'): if hasattr(signal, 'alarm'):
# On the Gentoo buildbot waitpid() often seems to block forever. # On the Gentoo buildbot waitpid() often seems to block forever.
# We use alarm() to interrupt it if it blocks for too long, and # We use alarm() to interrupt it if it blocks for too long.
# then try to print a backtrace for the child process using gdb.
def handler(*args): def handler(*args):
raise RuntimeError('join took too long: %s' % p) raise RuntimeError('join took too long: %s' % p)
old_handler = signal.signal(signal.SIGALRM, handler) old_handler = signal.signal(signal.SIGALRM, handler)
...@@ -315,12 +317,6 @@ class _TestProcess(BaseTestCase): ...@@ -315,12 +317,6 @@ class _TestProcess(BaseTestCase):
signal.alarm(0) signal.alarm(0)
except RuntimeError: except RuntimeError:
print('os.waitpid() =', os.waitpid(p.pid, os.WNOHANG)) print('os.waitpid() =', os.waitpid(p.pid, os.WNOHANG))
import subprocess
try:
subprocess.check_call(['strace', '-p', str(p.pid)],
timeout=10)
except subprocess.TimeoutExpired:
pass
raise raise
finally: finally:
signal.signal(signal.SIGALRM, old_handler) signal.signal(signal.SIGALRM, old_handler)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment