[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:
Miss Islington (bot) 2024-09-24 19:21:26 +02:00 committed by GitHub
parent 87f51a2609
commit 7c9bbaaaa3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 6 deletions

View file

@ -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