Commit 252f6abe authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

bpo-33532: Fix test_multiprocessing_forkserver.test_ignore() (GH-7319)

Use also support.SOCK_MAX_SIZE, not only support.PIPE_MAX_SIZE, to
get the size for a blocking send into a multiprocessing pipe.
parent 829fcd06
...@@ -4330,6 +4330,9 @@ class TestCloseFds(unittest.TestCase): ...@@ -4330,6 +4330,9 @@ class TestCloseFds(unittest.TestCase):
class TestIgnoreEINTR(unittest.TestCase): class TestIgnoreEINTR(unittest.TestCase):
# Sending CONN_MAX_SIZE bytes into a multiprocessing pipe must block
CONN_MAX_SIZE = max(support.PIPE_MAX_SIZE, support.SOCK_MAX_SIZE)
@classmethod @classmethod
def _test_ignore(cls, conn): def _test_ignore(cls, conn):
def handler(signum, frame): def handler(signum, frame):
...@@ -4338,7 +4341,7 @@ class TestIgnoreEINTR(unittest.TestCase): ...@@ -4338,7 +4341,7 @@ class TestIgnoreEINTR(unittest.TestCase):
conn.send('ready') conn.send('ready')
x = conn.recv() x = conn.recv()
conn.send(x) conn.send(x)
conn.send_bytes(b'x' * support.PIPE_MAX_SIZE) conn.send_bytes(b'x' * cls.CONN_MAX_SIZE)
@unittest.skipUnless(hasattr(signal, 'SIGUSR1'), 'requires SIGUSR1') @unittest.skipUnless(hasattr(signal, 'SIGUSR1'), 'requires SIGUSR1')
def test_ignore(self): def test_ignore(self):
...@@ -4357,7 +4360,7 @@ class TestIgnoreEINTR(unittest.TestCase): ...@@ -4357,7 +4360,7 @@ class TestIgnoreEINTR(unittest.TestCase):
self.assertEqual(conn.recv(), 1234) self.assertEqual(conn.recv(), 1234)
time.sleep(0.1) time.sleep(0.1)
os.kill(p.pid, signal.SIGUSR1) os.kill(p.pid, signal.SIGUSR1)
self.assertEqual(conn.recv_bytes(), b'x' * support.PIPE_MAX_SIZE) self.assertEqual(conn.recv_bytes(), b'x' * self.CONN_MAX_SIZE)
time.sleep(0.1) time.sleep(0.1)
p.join() p.join()
finally: finally:
......
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