]> granicus.if.org Git - python/commitdiff
1) The timeout in the itimer tests was too low for slow or heavily
authorStefan Krah <stefan@bytereef.org>
Tue, 20 Apr 2010 07:59:10 +0000 (07:59 +0000)
committerStefan Krah <stefan@bytereef.org>
Tue, 20 Apr 2010 07:59:10 +0000 (07:59 +0000)
   loaded machines.

2) Even with the increased timeout, the OS does not guarantee that
   a process will get a certain amount of virtual time in 60s, so
   the failure is changed to a diagnostic.

Lib/test/test_signal.py

index 23b0553cb8d828c5cbfd4a9c77f2668cb0cc1e46..202dc5383a591fcb749f93ba06883fe3ebce6ef2 100644 (file)
@@ -139,7 +139,7 @@ class InterProcessSignalTests(unittest.TestCase):
             self.fail("pause returned of its own accord, and the signal"
                       " didn't arrive after another second.")
 
-    # Unknown if this affects earlier versions of freebsd also
+    # Issue 3864. Unknown if this affects earlier versions of freebsd also.
     @unittest.skipIf(sys.platform=='freebsd6',
         'inter process signals not reliable (do not mix well with threading) '
         'on freebsd6')
@@ -359,7 +359,7 @@ class ItimerTest(unittest.TestCase):
 
         self.assertEqual(self.hndl_called, True)
 
-    # Unknown if this affects earlier versions of freebsd also
+    # Issue 3864. Unknown if this affects earlier versions of freebsd also.
     @unittest.skipIf(sys.platform=='freebsd6',
         'itimer not reliable (does not mix well with threading) on freebsd6')
     def test_itimer_virtual(self):
@@ -368,22 +368,22 @@ class ItimerTest(unittest.TestCase):
         signal.setitimer(self.itimer, 0.3, 0.2)
 
         start_time = time.time()
-        while time.time() - start_time < 5.0:
+        while time.time() - start_time < 60.0:
             # use up some virtual time by doing real work
             _ = pow(12345, 67890, 10000019)
             if signal.getitimer(self.itimer) == (0.0, 0.0):
                 break # sig_vtalrm handler stopped this itimer
-        else:
-            self.fail('timeout waiting for sig_vtalrm signal; '
-                      'signal.getitimer(self.itimer) gives: %s' %
-                       (signal.getitimer(self.itimer),))
+        else: # Issue 8424
+            sys.stdout.write("test_itimer_virtual: timeout: likely cause: "
+                             "machine too slow or load too high.\n")
+            return
 
         # virtual itimer should be (0.0, 0.0) now
         self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0))
         # and the handler should have been called
         self.assertEquals(self.hndl_called, True)
 
-    # Unknown if this affects earlier versions of freebsd also
+    # Issue 3864. Unknown if this affects earlier versions of freebsd also.
     @unittest.skipIf(sys.platform=='freebsd6',
         'itimer not reliable (does not mix well with threading) on freebsd6')
     def test_itimer_prof(self):
@@ -392,13 +392,15 @@ class ItimerTest(unittest.TestCase):
         signal.setitimer(self.itimer, 0.2, 0.2)
 
         start_time = time.time()
-        while time.time() - start_time < 5.0:
+        while time.time() - start_time < 60.0:
             # do some work
             _ = pow(12345, 67890, 10000019)
             if signal.getitimer(self.itimer) == (0.0, 0.0):
                 break # sig_prof handler stopped this itimer
-        else:
-            self.fail('timeout waiting for sig_prof signal')
+        else: # Issue 8424
+            sys.stdout.write("test_itimer_prof: timeout: likely cause: "
+                             "machine too slow or load too high.\n")
+            return
 
         # profiling itimer should be (0.0, 0.0) now
         self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0))