Adapt process-tests to Android

* src/android.c (android_init_thread_events)
(android_run_select_thread): Guarantee that the select thread is
initialized before returning.

* test/src/process-tests.el
(process-tests/fd-setsize-no-crash/make-process)
(process-tests/fd-setsize-no-crash/make-pipe-process)
(process-tests/fd-setsize-no-crash/make-network-process)
(process-tests/fd-setsize-no-crash/make-serial-process): Skip on
Android.
This commit is contained in:
Po Lu 2025-02-28 21:05:55 +08:00
parent a04e8812ee
commit 18c8c44bef
2 changed files with 25 additions and 0 deletions

View file

@ -388,6 +388,10 @@ android_init_thread_events (struct android_thread_event_queue *thread)
strerror (errno));
emacs_abort ();
}
/* Wait for the thread to be initialized. */
while (sem_wait (&thread->select_sem) < 0)
;;
}
#ifdef THREADS_ENABLED
@ -521,6 +525,9 @@ android_run_select_thread (void *thread_data)
inside pselect, a file descriptor is selected. Data is written to
the file descriptor whenever select is supposed to return. */
/* Release the user after initialization. */
sem_post (&data->select_sem);
while (true)
{
/* Wait for the thread to be released. */
@ -603,6 +610,8 @@ android_run_select_thread (void *thread_data)
#ifdef THREADS_ENABLED
pthread_setspecific (poll_thread_internal, thread_data);
#endif /* THREADS_ENABLED */
/* Release the user after initialization. */
sem_post (&data->select_sem);
while (true)
{

View file

@ -663,6 +663,10 @@ FD_SETSIZE."
(ert-deftest process-tests/fd-setsize-no-crash/make-process ()
"Check that Emacs doesn't crash when trying to use more than
FD_SETSIZE file descriptors (Bug#24325)."
;; Emacs is terminated on Android or aborts when the toolkit fails to
;; allocate sufficient graphics buffer handles long before FD_SETSIZE
;; is exceeded.
(skip-when (eq system-type 'android))
(with-timeout (60 (ert-fail "Test timed out"))
(let ((cat (executable-find "cat")))
(skip-unless cat)
@ -708,6 +712,10 @@ FD_SETSIZE file descriptors (Bug#24325)."
(ert-deftest process-tests/fd-setsize-no-crash/make-pipe-process ()
"Check that Emacs doesn't crash when trying to use more than
FD_SETSIZE file descriptors (Bug#24325)."
;; Emacs is terminated on Android or aborts when the toolkit fails to
;; allocate sufficient graphics buffer handles long before FD_SETSIZE
;; is exceeded.
(skip-when (eq system-type 'android))
(with-timeout (60 (ert-fail "Test timed out"))
(process-tests--fd-setsize-test
(process-tests--with-buffers buffers
@ -735,6 +743,10 @@ FD_SETSIZE file descriptors (Bug#24325)."
(ert-deftest process-tests/fd-setsize-no-crash/make-network-process ()
"Check that Emacs doesn't crash when trying to use more than
FD_SETSIZE file descriptors (Bug#24325)."
;; Emacs is terminated on Android or aborts when the toolkit fails to
;; allocate sufficient graphics buffer handles long before FD_SETSIZE
;; is exceeded.
(skip-when (eq system-type 'android))
(skip-unless (featurep 'make-network-process '(:server t)))
(skip-unless (featurep 'make-network-process '(:family local)))
;; Avoid hang due to connect/accept handshake on Cygwin (bug#49496).
@ -777,6 +789,10 @@ FD_SETSIZE file descriptors (Bug#24325)."
(ert-deftest process-tests/fd-setsize-no-crash/make-serial-process ()
"Check that Emacs doesn't crash when trying to use more than
FD_SETSIZE file descriptors (Bug#24325)."
;; Emacs is terminated on Android or aborts when the toolkit fails to
;; allocate sufficient graphics buffer handles long before FD_SETSIZE
;; is exceeded.
(skip-when (eq system-type 'android))
;; This test cannot be run if PTYs aren't supported.
(skip-when (eq system-type 'windows-nt))
(with-timeout (60 (ert-fail "Test timed out"))