mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
[3.13] gh-116622: Switch test_stress_delivery_simultaneous from SIGUSR1 to SIGUSR2 (GH-123981) (#123988)
gh-116622: Switch test_stress_delivery_simultaneous from SIGUSR1 to SIGUSR2 (GH-123981)
Use SIGUSR1 instead of SIGUSR2 to improve reliability of signal stress test on Android.
(cherry picked from commit 43303e362e
)
Co-authored-by: Malcolm Smith <smith@chaquo.com>
This commit is contained in:
parent
87f51a2609
commit
7c9bbaaaa3
2 changed files with 25 additions and 6 deletions
|
@ -1327,15 +1327,18 @@ class StressTest(unittest.TestCase):
|
|||
def handler(signum, frame):
|
||||
sigs.append(signum)
|
||||
|
||||
self.setsig(signal.SIGUSR1, handler)
|
||||
# On Android, SIGUSR1 is unreliable when used in close proximity to
|
||||
# another signal – see Android/testbed/app/src/main/python/main.py.
|
||||
# So we use a different signal.
|
||||
self.setsig(signal.SIGUSR2, handler)
|
||||
self.setsig(signal.SIGALRM, handler) # for ITIMER_REAL
|
||||
|
||||
expected_sigs = 0
|
||||
while expected_sigs < N:
|
||||
# Hopefully the SIGALRM will be received somewhere during
|
||||
# initial processing of SIGUSR1.
|
||||
# initial processing of SIGUSR2.
|
||||
signal.setitimer(signal.ITIMER_REAL, 1e-6 + random.random() * 1e-5)
|
||||
os.kill(os.getpid(), signal.SIGUSR1)
|
||||
os.kill(os.getpid(), signal.SIGUSR2)
|
||||
|
||||
expected_sigs += 2
|
||||
# Wait for handlers to run to avoid signal coalescing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue