From: Tomi Ollila Date: Sun, 5 Aug 2012 11:13:01 +0000 (+0300) Subject: [PATCH 1/2] test: emacs: call accept-process-output in notmuch-test-wait X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=d086ad826375a0e1f21185c952508281ac96f937;p=notmuch-archives.git [PATCH 1/2] test: emacs: call accept-process-output in notmuch-test-wait --- diff --git a/7b/140cde62bee9820d1a55bd8f0120d63f3b381a b/7b/140cde62bee9820d1a55bd8f0120d63f3b381a new file mode 100644 index 000000000..63dcbe21d --- /dev/null +++ b/7b/140cde62bee9820d1a55bd8f0120d63f3b381a @@ -0,0 +1,86 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id E7795431FAF + for ; Sun, 5 Aug 2012 04:12:54 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id O7mEmzNGOa47 for ; + Sun, 5 Aug 2012 04:12:54 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 43741431FAE + for ; Sun, 5 Aug 2012 04:12:54 -0700 (PDT) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id B59221002A4; Sun, 5 Aug 2012 14:13:04 +0300 (EEST) +From: Tomi Ollila +To: notmuch@notmuchmail.org +Subject: [PATCH 1/2] test: emacs: call accept-process-output in + notmuch-test-wait +Date: Sun, 5 Aug 2012 14:13:01 +0300 +Message-Id: <1344165182-29246-1-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 1.7.1 +Cc: Tomi Ollila +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 05 Aug 2012 11:12:55 -0000 + +notmuch-test-wait called sleep-for in a loop to wait unconditionally 0.1 +seconds while waiting for process to exit. +accept-process-output returns as soon as there is any data available +from process, so using it avoids unnecessary fixed delays. +Both of these functions run process sentinels. +--- + +This 2 patch series is an alternative to +id:"1344122222-14344-1-git-send-email-tomi.ollila@iki.fi" +which speeds up execution when Emacs version is not 23.1. +(so that users of newer emacs doesn't need to suffer the +workaround made for emacs 23.1 users in second patch in +this series) + +during testing of the feature I had ++ (accept-process-output nil 10))) +there -- it did not wait 10 seconds. + +I also tested the following function: + +(defun notmuch-test-wait () t) + +i.e. dropping wait altogether -- this makes tests fail in different ways... + + test/test-lib.el | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/test/test-lib.el b/test/test-lib.el +index 5dd6271..52d9936 100644 +--- a/test/test-lib.el ++++ b/test/test-lib.el +@@ -38,7 +38,7 @@ + (defun notmuch-test-wait () + "Wait for process completion." + (while (get-buffer-process (current-buffer)) +- (sleep-for 0.1))) ++ (accept-process-output nil 0.1))) + + (defun test-output (&optional filename) + "Save current buffer to file FILENAME. Default FILENAME is OUTPUT." +-- +1.7.1 +