mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
[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 7879081198
)
Co-authored-by: Diego Russo <diego.russo@arm.com>
This commit is contained in:
parent
94b94d0b12
commit
597a953484
1 changed files with 3 additions and 3 deletions
|
@ -840,11 +840,11 @@ class ItimerTest(unittest.TestCase):
|
||||||
def test_itimer_virtual(self):
|
def test_itimer_virtual(self):
|
||||||
self.itimer = signal.ITIMER_VIRTUAL
|
self.itimer = signal.ITIMER_VIRTUAL
|
||||||
signal.signal(signal.SIGVTALRM, self.sig_vtalrm)
|
signal.signal(signal.SIGVTALRM, self.sig_vtalrm)
|
||||||
signal.setitimer(self.itimer, 0.3, 0.2)
|
signal.setitimer(self.itimer, 0.001, 0.001)
|
||||||
|
|
||||||
for _ in support.busy_retry(support.LONG_TIMEOUT):
|
for _ in support.busy_retry(support.LONG_TIMEOUT):
|
||||||
# use up some virtual time by doing real work
|
# use up some virtual time by doing real work
|
||||||
_ = pow(12345, 67890, 10000019)
|
_ = sum(i * i for i in range(10**5))
|
||||||
if signal.getitimer(self.itimer) == (0.0, 0.0):
|
if signal.getitimer(self.itimer) == (0.0, 0.0):
|
||||||
# sig_vtalrm handler stopped this itimer
|
# sig_vtalrm handler stopped this itimer
|
||||||
break
|
break
|
||||||
|
@ -861,7 +861,7 @@ class ItimerTest(unittest.TestCase):
|
||||||
|
|
||||||
for _ in support.busy_retry(support.LONG_TIMEOUT):
|
for _ in support.busy_retry(support.LONG_TIMEOUT):
|
||||||
# do some work
|
# do some work
|
||||||
_ = pow(12345, 67890, 10000019)
|
_ = sum(i * i for i in range(10**5))
|
||||||
if signal.getitimer(self.itimer) == (0.0, 0.0):
|
if signal.getitimer(self.itimer) == (0.0, 0.0):
|
||||||
# sig_prof handler stopped this itimer
|
# sig_prof handler stopped this itimer
|
||||||
break
|
break
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue