Skip to content

Commit 597a953

Browse files
[3.13] gh-130917: update timer and workload in test_signal (GH-130918) (#130969)
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 94b94d0 commit 597a953

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
@@ -840,11 +840,11 @@ def test_itimer_real(self):
840840
def test_itimer_virtual(self):
841841
self.itimer = signal.ITIMER_VIRTUAL
842842
signal.signal(signal.SIGVTALRM, self.sig_vtalrm)
843-
signal.setitimer(self.itimer, 0.3, 0.2)
843+
signal.setitimer(self.itimer, 0.001, 0.001)
844844

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

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

0 commit comments

Comments
 (0)