Merged revisions 80240 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r80240 | stefan.krah | 2010-04-20 10:13:03 +0200 (Tue, 20 Apr 2010) | 15 lines

  Merged revisions 80238 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r80238 | stefan.krah | 2010-04-20 09:59:10 +0200 (Tue, 20 Apr 2010) | 9 lines


    1) The timeout in the itimer tests was too low for slow or heavily
       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.
  ........
................
This commit is contained in:
Stefan Krah 2010-04-20 08:15:14 +00:00
parent 8e96394f24
commit f1da97304d
1 changed files with 10 additions and 8 deletions

View File

@ -361,15 +361,15 @@ class ItimerTest(unittest.TestCase):
signal.setitimer(self.itimer, 0.3, 0.2) signal.setitimer(self.itimer, 0.3, 0.2)
start_time = time.time() 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 # use up some virtual time by doing real work
_ = pow(12345, 67890, 10000019) _ = pow(12345, 67890, 10000019)
if signal.getitimer(self.itimer) == (0.0, 0.0): if signal.getitimer(self.itimer) == (0.0, 0.0):
break # sig_vtalrm handler stopped this itimer break # sig_vtalrm handler stopped this itimer
else: else: # Issue 8424
self.fail('timeout waiting for sig_vtalrm signal; ' sys.stdout.write("test_itimer_virtual: timeout: likely cause: "
'signal.getitimer(self.itimer) gives: %s' % "machine too slow or load too high.\n")
(signal.getitimer(self.itimer),)) return
# virtual itimer should be (0.0, 0.0) now # virtual itimer should be (0.0, 0.0) now
self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0)) self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0))
@ -382,13 +382,15 @@ class ItimerTest(unittest.TestCase):
signal.setitimer(self.itimer, 0.2, 0.2) signal.setitimer(self.itimer, 0.2, 0.2)
start_time = time.time() start_time = time.time()
while time.time() - start_time < 5.0: while time.time() - start_time < 60.0:
# do some work # do some work
_ = pow(12345, 67890, 10000019) _ = pow(12345, 67890, 10000019)
if signal.getitimer(self.itimer) == (0.0, 0.0): if signal.getitimer(self.itimer) == (0.0, 0.0):
break # sig_prof handler stopped this itimer break # sig_prof handler stopped this itimer
else: else: # Issue 8424
self.fail('timeout waiting for sig_prof signal') 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 # profiling itimer should be (0.0, 0.0) now
self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0)) self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0))