]> git.eshelyaron.com Git - emacs.git/commitdiff
; Fix 'threads-join-error' test
authorEli Zaretskii <eliz@gnu.org>
Mon, 14 Jul 2025 12:48:45 +0000 (15:48 +0300)
committerEshel Yaron <me@eshelyaron.com>
Thu, 24 Jul 2025 08:50:46 +0000 (10:50 +0200)
* test/src/thread-tests.el (threads-thread-sleeps): New helper
function.
(threads-join-error): Fix to work as intended, and remove the
'unstable' tag.  (Bug#40823)

(cherry picked from commit d0f96de277ff89adae4bc29ce934b7fca1d9bf00)

test/src/thread-tests.el

index 322547c2e6af52bdf2c151aa3042d74817f4ed38..9a065187b5e78b8d5f1ce07b3fc3338bb0c9e583 100644 (file)
   (skip-unless (featurep 'threads))
   (should-error (thread-join (current-thread))))
 
+(defun threads-thread-sleeps ()
+  "Put current thread to sleep."
+  (sleep-for 5))
+
 (ert-deftest threads-join-error ()
   "Test of error signaling from `thread-join'."
-  :tags '(:unstable)
   (skip-unless (featurep 'threads))
-  (let ((thread (make-thread #'threads-call-error)))
-    (while (thread-live-p thread)
-      (thread-yield))
-    (should-error (thread-join thread))))
+  (let ((thread (make-thread #'threads-thread-sleeps))
+        err)
+    (thread-signal thread 'error "Error signal for thread")
+    (thread-yield)
+    (setq err (should-error (thread-join thread)))
+    (should (equal err '(error . "Error signal for thread")))))
 
 (defvar threads-test-binding nil)