Kaydet (Commit) 177b8eb3 authored tarafından Victor Stinner's avatar Victor Stinner

test_eintr: try to debug hang on FreeBSD

üst e801c360
...@@ -8,6 +8,7 @@ Signals are generated in-process using setitimer(ITIMER_REAL), which allows ...@@ -8,6 +8,7 @@ Signals are generated in-process using setitimer(ITIMER_REAL), which allows
sub-second periodicity (contrarily to signal()). sub-second periodicity (contrarily to signal()).
""" """
import faulthandler
import io import io
import os import os
import select import select
...@@ -36,10 +37,17 @@ class EINTRBaseTest(unittest.TestCase): ...@@ -36,10 +37,17 @@ class EINTRBaseTest(unittest.TestCase):
cls.orig_handler = signal.signal(signal.SIGALRM, lambda *args: None) cls.orig_handler = signal.signal(signal.SIGALRM, lambda *args: None)
signal.setitimer(signal.ITIMER_REAL, cls.signal_delay, signal.setitimer(signal.ITIMER_REAL, cls.signal_delay,
cls.signal_period) cls.signal_period)
if hasattr(faulthandler, 'dump_traceback_later'):
# Most tests take less than 30 seconds, so 15 minutes should be
# enough. dump_traceback_later() is implemented with a thread, but
# pthread_sigmask() is used to mask all signaled on this thread.
faulthandler.dump_traceback_later(15 * 60, exit=True)
@classmethod @classmethod
def stop_alarm(cls): def stop_alarm(cls):
signal.setitimer(signal.ITIMER_REAL, 0, 0) signal.setitimer(signal.ITIMER_REAL, 0, 0)
if hasattr(faulthandler, 'cancel_dump_traceback_later'):
faulthandler.cancel_dump_traceback_later()
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
......
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