Re: [PATCH] test: test-lib.el: replace sleep-for with sit-for in notmuch-test-wait
authorAustin Clements <amdragon@MIT.EDU>
Fri, 3 Aug 2012 20:52:16 +0000 (16:52 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:48 +0000 (09:48 -0800)
eb/4da40e9b9d51fdc391d358d335ed23a1b82a52 [new file with mode: 0644]

diff --git a/eb/4da40e9b9d51fdc391d358d335ed23a1b82a52 b/eb/4da40e9b9d51fdc391d358d335ed23a1b82a52
new file mode 100644 (file)
index 0000000..b50ac71
--- /dev/null
@@ -0,0 +1,114 @@
+Return-Path: <amdragon@mit.edu>\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 417C6431FAF\r
+       for <notmuch@notmuchmail.org>; Fri,  3 Aug 2012 13:52:24 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 TIw1N-qKU50e for <notmuch@notmuchmail.org>;\r
+       Fri,  3 Aug 2012 13:52:22 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
+       [18.7.68.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id 22CF7431FAE\r
+       for <notmuch@notmuchmail.org>; Fri,  3 Aug 2012 13:52:22 -0700 (PDT)\r
+X-AuditID: 12074422-b7f1f6d00000090b-10-501c3a05f66e\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 56.C8.02315.50A3C105; Fri,  3 Aug 2012 16:52:21 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q73KqK9H023417; \r
+       Fri, 3 Aug 2012 16:52:21 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q73KqGcu005055\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Fri, 3 Aug 2012 16:52:19 -0400 (EDT)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1SxOr2-00017v-MF; Fri, 03 Aug 2012 16:52:16 -0400\r
+Date: Fri, 3 Aug 2012 16:52:16 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>\r
+Subject: Re: [PATCH] test: test-lib.el: replace sleep-for with sit-for in\r
+       notmuch-test-wait\r
+Message-ID: <20120803205216.GG22601@mit.edu>\r
+References: <1343996163-26720-1-git-send-email-tomi.ollila@iki.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <1343996163-26720-1-git-send-email-tomi.ollila@iki.fi>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42IR4hRV1mW1kgkwmHFE0+L6zZnMFm9WzmN1\r
+       YPI4/HUhi8ezVbeYA5iiuGxSUnMyy1KL9O0SuDKW7tnCXHCBt2LDxIlMDYzfuLoYOTkkBEwk\r
+       Dh68xwhhi0lcuLeerYuRi0NIYB+jxIKfD1kgnPWMEoc2HYdyTjBJnHgxnx3CWcIocXjZRVaQ\r
+       fhYBFYlN34+xg9hsAhoS2/YvB5srAhR/0LYerIZZQFri2+9mJhBbWCBWYt+MRWD1vAI6En/O\r
+       9IDZQgJOEje//ICKC0qcnPmEBaJXS+LGv5dAvRxgc5b/4wAJcwo4S0x6+BmsXBRo1ZST29gm\r
+       MArNQtI9C0n3LITuBYzMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3RN9XIzS/RSU0o3MYICm91F\r
+       aQfjz4NKhxgFOBiVeHiTVWQChFgTy4orcw8xSnIwKYny5hgBhfiS8lMqMxKLM+KLSnNSiw8x\r
+       SnAwK4nw7lIEyvGmJFZWpRblw6SkOViUxHmvpdz0FxJITyxJzU5NLUgtgsnKcHAoSfC6WgI1\r
+       ChalpqdWpGXmlCCkmTg4QYbzAA2PBanhLS5IzC3OTIfIn2JUlBLnlQBJCIAkMkrz4HphiecV\r
+       ozjQK8K85iBVPMCkBdf9CmgwE9BgOzMpkMEliQgpqQbG+LBFnquN/y1w8ayZ9enMHP7ieR63\r
+       Tzto6aQeiVeckLKwsqWff7p3M2/LmVmCXUdNtDcLCy0tZny4NF54iU+Mj7ZKx4TlCyfIzNLc\r
+       E7nv8e5NNav731f02hUfWrHrmMzXxNOhk+98US+RyPr78GHP+kkVHvdDfY9sVNMvtbG/erOr\r
+       0Dtu94ZyJZbijERDLeai4kQA7hXvLBcDAAA=\r
+Cc: notmuch@notmuchmail.org\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 20:52:24 -0000\r
+\r
+Code LGTM, but maybe the comment should explain that this is a\r
+workaround for a bug in Emacs, given that both sleep-for and sit-for\r
+are supposed to process process output and run sentinels (which has\r
+been stated in the Elisp reference at least as far back as Emacs 21).\r
+In light of this (and our better understanding of sleep-for and\r
+sit-for from IRC discussions), the commit message is also misleading.\r
+\r
+Quoth Tomi Ollila on Aug 03 at  3:16 pm:\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