[PATCH v2] test: test-lib.el: replace sleep-for with sit-for in notmuch-test-wait

Subject: [PATCH v2] test: test-lib.el: replace sleep-for with sit-for in notmuch-test-wait

Date: Sun, 5 Aug 2012 02:17:02 +0300

To: notmuch@notmuchmail.org

Cc: Tomi Ollila

From: Tomi Ollila


When running emacs tests using emacs 23.1.1 the tests block (until timeout)
when emacs function (notmuch-test-wait) is called.

There is an emacs bug #2930 titled:
23.0.92; `accept-process-output' and `sleep-for' do not run sentinels

It seems this is still active in emacs 23.1; replacing sleep-for with
sit-for makes the tests work as expected.

The other function in loop executed in notmuch-test-wait: get-buffer-process
just loops through process list, returning matching process object (or nil
if no such process found) without doing any further processing.

By comparing Emacs 23.1 and 23.2 function wait_reading_process_output ()
(changes in do_display variable usage) it seems that this bug has been
fixed in 23.2.
---
 test/test-lib.el |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index 5dd6271..30d6eb7 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -38,7 +38,11 @@
 (defun notmuch-test-wait ()
   "Wait for process completion."
   (while (get-buffer-process (current-buffer))
-    (sleep-for 0.1)))
+    ;; It seems in Emacs 23.1 `accept-process-output' and `sleep-for' do not
+    ;; run sentinels (bug#2930 (bug-gnu-emacs)). `sit-for' works as documented.
+    ;; `sleep-for` may already work in Emacs 23.2 as function
+    ;; wait_reading_process_output() in src/process.c has related change.
+    (sit-for 0.1)))
 
 (defun test-output (&optional filename)
   "Save current buffer to file FILENAME.  Default FILENAME is OUTPUT."
-- 
1.7.1


Thread: