Skip to content

Commit a69107b

Browse files
[3.12] gh-130917: update timer and workload in test_signal (GH-130918) (#130968)
The workload to advance the virtual timeout is too lightweight for some platforms. As result the test goes in timeout as it never reaches the end of the timer. By having a heavier workload, the virtual timer advances rapidly and the SIGVTALRM is sent before the timeout. (cherry picked from commit 7879081) Co-authored-by: Diego Russo <[email protected]>
1 parent 4eb4785 commit a69107b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/test/test_signal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -839,11 +839,11 @@ def test_itimer_real(self):
839839
def test_itimer_virtual(self):
840840
self.itimer = signal.ITIMER_VIRTUAL
841841
signal.signal(signal.SIGVTALRM, self.sig_vtalrm)
842-
signal.setitimer(self.itimer, 0.3, 0.2)
842+
signal.setitimer(self.itimer, 0.001, 0.001)
843843

844844
for _ in support.busy_retry(support.LONG_TIMEOUT):
845845
# use up some virtual time by doing real work
846-
_ = pow(12345, 67890, 10000019)
846+
_ = sum(i * i for i in range(10**5))
847847
if signal.getitimer(self.itimer) == (0.0, 0.0):
848848
# sig_vtalrm handler stopped this itimer
849849
break
@@ -860,7 +860,7 @@ def test_itimer_prof(self):
860860

861861
for _ in support.busy_retry(support.LONG_TIMEOUT):
862862
# do some work
863-
_ = pow(12345, 67890, 10000019)
863+
_ = sum(i * i for i in range(10**5))
864864
if signal.getitimer(self.itimer) == (0.0, 0.0):
865865
# sig_prof handler stopped this itimer
866866
break

0 commit comments

Comments
 (0)