]> git.eshelyaron.com Git - emacs.git/commitdiff
Adapt process-tests to Android
authorPo Lu <luangruo@yahoo.com>
Fri, 28 Feb 2025 13:05:55 +0000 (21:05 +0800)
committerEshel Yaron <me@eshelyaron.com>
Tue, 4 Mar 2025 20:51:28 +0000 (21:51 +0100)
* 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.

(cherry picked from commit 18c8c44bef9b85adf3cff65f08b7f6a8c59687db)

src/android.c
test/src/process-tests.el

index 15edca94fdf3f6bd4f395fd953a7881e72233eea..b7d68def4671529ec5de3a50a0f0f346dbcd4d13 100644 (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)
     {
index 276e9af6ee108d5715a2ff6ce8ccf8cfdc80a4a6..6da960d1af08941a06bd245fe2326d15bc5ddac8 100644 (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"))