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

Issue #8407: test_signal doesn't check signal delivery order

Tthe signal delivery order is not portable or reliable.
üst e2655974
...@@ -229,12 +229,13 @@ class WakeupSignalTests(unittest.TestCase): ...@@ -229,12 +229,13 @@ class WakeupSignalTests(unittest.TestCase):
def handler(self, signum, frame): def handler(self, signum, frame):
pass pass
def check_signum(self, *signals, **kw): def check_signum(self, *signals):
data = os.read(self.read, len(signals)+1) data = os.read(self.read, len(signals)+1)
raised = struct.unpack('%uB' % len(data), data) raised = struct.unpack('%uB' % len(data), data)
if kw.get('unordered', False): # We don't care of the signal delivery order (it's not portable or
raised = set(raised) # reliable)
signals = set(signals) raised = set(raised)
signals = set(signals)
self.assertEqual(raised, signals) self.assertEqual(raised, signals)
def test_wakeup_fd_early(self): def test_wakeup_fd_early(self):
...@@ -291,7 +292,7 @@ class WakeupSignalTests(unittest.TestCase): ...@@ -291,7 +292,7 @@ class WakeupSignalTests(unittest.TestCase):
# Unblocking the 2 signals calls the C signal handler twice # Unblocking the 2 signals calls the C signal handler twice
signal.pthread_sigmask(signal.SIG_UNBLOCK, (signum1, signum2)) signal.pthread_sigmask(signal.SIG_UNBLOCK, (signum1, signum2))
self.check_signum(signum1, signum2, unordered=True) self.check_signum(signum1, signum2)
def setUp(self): def setUp(self):
import fcntl import fcntl
......
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