[PATCH] test: test-lib.el: replace sleep-for with sit-for in notmuch-test-wait
authorTomi Ollila <tomi.ollila@iki.fi>
Fri, 3 Aug 2012 12:16:03 +0000 (15:16 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:47 +0000 (09:48 -0800)
22/39c8c1186675ca1f7ea5aa89f67d1114b59d88 [new file with mode: 0644]

diff --git a/22/39c8c1186675ca1f7ea5aa89f67d1114b59d88 b/22/39c8c1186675ca1f7ea5aa89f67d1114b59d88
new file mode 100644 (file)
index 0000000..bd0f1ce
--- /dev/null
@@ -0,0 +1,75 @@
+Return-Path: <too@guru-group.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id B3697431E62\r
+       for <notmuch@notmuchmail.org>; Fri,  3 Aug 2012 05:15:58 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id X6Boq9Wku4NS for <notmuch@notmuchmail.org>;\r
+       Fri,  3 Aug 2012 05:15:56 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id 60666431FAE\r
+       for <notmuch@notmuchmail.org>; Fri,  3 Aug 2012 05:15:56 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+       id 49A35100372; Fri,  3 Aug 2012 15:16:05 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] test: test-lib.el: replace sleep-for with sit-for in\r
+       notmuch-test-wait\r
+Date: Fri,  3 Aug 2012 15:16:03 +0300\r
+Message-Id: <1343996163-26720-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.7.1\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 03 Aug 2012 12:15:58 -0000\r
+\r
+The function `notmuch-test-wait` called `get-buffer-process` and\r
+`sleep-for` in a loop. On some emacses neither of these cause emacs\r
+to check whether the process has exited and update it's status\r
+accordingly. In this case the loop does not exit.\r
+\r
+The function `sit-for` goes into event loop via `read-event` function\r
+call. `read-event` does not return when process exits but the event\r
+loop used to determine whether there is keyboard, mouse, etc. event\r
+updates the process status as a side effect of the (more generic)\r
+event loop. `sit-for` is used here to restore the event into queue\r
+in the improbable case `read-event` consumes an event.\r
+---\r
+ test/test-lib.el |    3 ++-\r
+ 1 files changed, 2 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/test/test-lib.el b/test/test-lib.el\r
+index 5dd6271..d14246a 100644\r
+--- a/test/test-lib.el\r
++++ b/test/test-lib.el\r
+@@ -38,7 +38,8 @@\r
+ (defun notmuch-test-wait ()\r
+   "Wait for process completion."\r
+   (while (get-buffer-process (current-buffer))\r
+-    (sleep-for 0.1)))\r
++    ;; sit-for visits event loop for process exit notification.\r
++    (sit-for 0.1)))\r
\r
+ (defun test-output (&optional filename)\r
+   "Save current buffer to file FILENAME.  Default FILENAME is OUTPUT."\r
+-- \r
+1.7.1\r
+\r