1 Return-Path: <bremner@tethera.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id D4890431FBD
\r
6 for <notmuch@notmuchmail.org>; Fri, 10 Jan 2014 18:36:40 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 8jqfP7L9y+iq for <notmuch@notmuchmail.org>;
\r
16 Fri, 10 Jan 2014 18:36:34 -0800 (PST)
\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])
\r
18 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id AF7C8431FBC
\r
21 for <notmuch@notmuchmail.org>; Fri, 10 Jan 2014 18:36:34 -0800 (PST)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <bremner@tethera.net>)
\r
24 id 1W1oR3-0001Pp-6w; Fri, 10 Jan 2014 22:36:29 -0400
\r
25 Received: (nullmailer pid 18457 invoked by uid 1000); Sat, 11 Jan 2014
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [PATCH] test/emacs: replace the use of process-attributes with
\r
31 Date: Fri, 10 Jan 2014 22:36:18 -0400
\r
32 Message-Id: <1389407778-15724-1-git-send-email-david@tethera.net>
\r
33 X-Mailer: git-send-email 1.8.5.2
\r
34 In-Reply-To: <87a9ffofsc.fsf@zancas.localnet>
\r
35 References: <87a9ffofsc.fsf@zancas.localnet>
\r
36 X-BeenThere: notmuch@notmuchmail.org
\r
37 X-Mailman-Version: 2.1.13
\r
39 List-Id: "Use and development of the notmuch mail system."
\r
40 <notmuch.notmuchmail.org>
\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
42 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
44 List-Post: <mailto:notmuch@notmuchmail.org>
\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
48 X-List-Received-Date: Sat, 11 Jan 2014 02:36:41 -0000
\r
50 In some environments (at least Hurd), process-attributes is
\r
51 unimplimented and always returns nil. This ends up causing test
\r
52 failures (see e.g. id:87a9ffofsc.fsf@zancas.localnet).
\r
54 According to POSIX 1003.1-2001, a signal of 0 can be used to check the
\r
55 validity of a pid. This seems less heinous than parsing the output of ps(1).
\r
58 I'm not sure if it would be worthwhile, but a point release could
\r
59 finally get notmuch compiling on Hurd again. At least the test in the parent message does pass on Hurd with this patch
\r
61 test/test-lib.el | 15 +++++++++------
\r
62 1 file changed, 9 insertions(+), 6 deletions(-)
\r
64 diff --git a/test/test-lib.el b/test/test-lib.el
\r
65 index d26b49f..93f5f72 100644
\r
66 --- a/test/test-lib.el
\r
67 +++ b/test/test-lib.el
\r
68 @@ -77,19 +77,22 @@ invisible text."
\r
69 (setq start next-pos)))
\r
72 +;; process-attributes is not defined everywhere, so define an
\r
73 +;; alternate way to test if a process still exists.
\r
75 +(defun test-process-running (pid)
\r
77 + (call-process "kill" nil nil nil "-0" (int-to-string pid))))
\r
79 (defun orphan-watchdog-check (pid)
\r
80 "Periodically check that the process with id PID is still
\r
81 running, quit if it terminated."
\r
82 - (if (not (process-attributes pid))
\r
83 + (if (not (test-process-running pid))
\r
86 (defun orphan-watchdog (pid)
\r
87 "Initiate orphan watchdog check."
\r
88 - ; If process-attributes returns nil right away, that probably means
\r
89 - ; it is unimplimented. So we delay two minutes before killing emacs.
\r
90 - (if (process-attributes pid)
\r
91 - (run-at-time 60 60 'orphan-watchdog-check pid)
\r
92 - (run-at-time 120 60 'orphan-watchdog-check pid)))
\r
93 + (run-at-time 60 60 'orphan-watchdog-check pid))
\r
95 (defun hook-counter (hook)
\r
96 "Count how many times a hook is called. Increments
\r