]> granicus.if.org Git - python/commitdiff
Issue #25277: Use a longer sleep in test_eintr to reduce the risk of race
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 12 Oct 2015 21:37:02 +0000 (23:37 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 12 Oct 2015 21:37:02 +0000 (23:37 +0200)
condition in test_eintr.

Lib/test/eintrdata/eintr_tester.py

index e1e0d91006f7348594387a472d0f65a9b25feeb2..e3c36f9ce3688eb9e85189613c128d6379c0cf62 100644 (file)
@@ -59,11 +59,6 @@ class EINTRBaseTest(unittest.TestCase):
         cls.stop_alarm()
         signal.signal(signal.SIGALRM, cls.orig_handler)
 
-    @classmethod
-    def _sleep(cls):
-        # default sleep time
-        time.sleep(cls.sleep_time)
-
     def subprocess(self, *args, **kw):
         cmd_args = (sys.executable, '-c') + args
         return subprocess.Popen(cmd_args, **kw)
@@ -375,6 +370,11 @@ class SignalEINTRTest(EINTRBaseTest):
     @unittest.skipUnless(hasattr(signal, 'sigwaitinfo'),
                          'need signal.sigwaitinfo()')
     def test_sigwaitinfo(self):
+        # Issue #25277: The sleep is a weak synchronization between the parent
+        # and the child process. If the sleep is too low, the test hangs on
+        # slow or highly loaded systems.
+        self.sleep_time = 2.0
+
         signum = signal.SIGUSR1
         pid = os.getpid()