From: Diego Russo Date: Fri, 7 Mar 2025 21:10:02 +0000 (+0000) Subject: gh-130917: update timer and workload in test_signal (#130918) X-Git-Tag: v3.14.0a6~117 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=78790811989ab47319e2ee725e0c435b3cdd21ab;p=thirdparty%2FPython%2Fcpython.git gh-130917: update timer and workload in test_signal (#130918) 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. --- diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index 72a01cd1e451..1497a98f9e65 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -838,11 +838,11 @@ class ItimerTest(unittest.TestCase): def test_itimer_virtual(self): self.itimer = signal.ITIMER_VIRTUAL 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): # 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): # sig_vtalrm handler stopped this itimer break @@ -859,7 +859,7 @@ class ItimerTest(unittest.TestCase): for _ in support.busy_retry(support.LONG_TIMEOUT): # 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): # sig_prof handler stopped this itimer break