summaryrefslogtreecommitdiffstats
path: root/Android
diff options
context:
space:
mode:
authorMalcolm Smith <smith@chaquo.com>2024-09-12 05:52:07 (GMT)
committerGitHub <noreply@github.com>2024-09-12 05:52:07 (GMT)
commit43303e362e3a7e2d96747d881021a14c7f7e3d0b (patch)
tree5bb2b54f0d68529c0f77d5cd0a5e35259960bb2c /Android
parentba687d9481c04fd160795ff8d8568f5c9f877128 (diff)
downloadcpython-43303e362e3a7e2d96747d881021a14c7f7e3d0b.zip
cpython-43303e362e3a7e2d96747d881021a14c7f7e3d0b.tar.gz
cpython-43303e362e3a7e2d96747d881021a14c7f7e3d0b.tar.bz2
gh-116622: Switch test_stress_delivery_simultaneous from SIGUSR1 to SIGUSR2 (#123981)
Use SIGUSR1 instead of SIGUSR2 to improve reliability of signal stress test on Android.
Diffstat (limited to 'Android')
-rw-r--r--Android/testbed/app/src/main/python/main.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/Android/testbed/app/src/main/python/main.py b/Android/testbed/app/src/main/python/main.py
index c7314b5..d6941b1 100644
--- a/Android/testbed/app/src/main/python/main.py
+++ b/Android/testbed/app/src/main/python/main.py
@@ -5,9 +5,25 @@ import signal
import sys
# Some tests use SIGUSR1, but that's blocked by default in an Android app in
-# order to make it available to `sigwait` in the "Signal Catcher" thread. That
-# thread's functionality is only relevant to the JVM ("forcing GC (no HPROF) and
-# profile save"), so disabling it should not weaken the tests.
+# order to make it available to `sigwait` in the Signal Catcher thread.
+# (https://cs.android.com/android/platform/superproject/+/android14-qpr3-release:art/runtime/signal_catcher.cc).
+# That thread's functionality is only useful for debugging the JVM, so disabling
+# it should not weaken the tests.
+#
+# There's no safe way of stopping the thread completely (#123982), but simply
+# unblocking SIGUSR1 is enough to fix most tests.
+#
+# However, in tests that generate multiple different signals in quick
+# succession, it's possible for SIGUSR1 to arrive while the main thread is busy
+# running the C-level handler for a different signal. In that case, the SIGUSR1
+# may be sent to the Signal Catcher thread instead, which will generate a log
+# message containing the text "reacting to signal".
+#
+# Such tests may need to be changed in one of the following ways:
+# * Use a signal other than SIGUSR1 (e.g. test_stress_delivery_simultaneous in
+# test_signal.py).
+# * Send the signal to a specific thread rather than the whole process (e.g.
+# test_signals in test_threadsignals.py.
signal.pthread_sigmask(signal.SIG_UNBLOCK, [signal.SIGUSR1])
sys.argv[1:] = shlex.split(os.environ["PYTHON_ARGS"])