Re: [PATCH 8/9] test: check if emacs is available in the beginning of test_emacs
[notmuch-archives.git] / 2a / eb024315fe130d625989fd23b51b31dfd61336
1 Return-Path: <dmitry.kurochkin@gmail.com>\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 DD519429E28\r
6         for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:08:30 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 1.7\r
10 X-Spam-Level: *\r
11 X-Spam-Status: No, score=1.7 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, FREEMAIL_REPLY=2.499, RCVD_IN_DNSWL_LOW=-0.7]\r
14         autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id geGmkExSfXZR for <notmuch@notmuchmail.org>;\r
18         Thu, 17 Nov 2011 05:08:30 -0800 (PST)\r
19 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
20         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id 1A652429E27\r
23         for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:08:29 -0800 (PST)\r
24 Received: by bkaq10 with SMTP id q10so2111154bka.26\r
25         for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:08:28 -0800 (PST)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
27         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
28         :mime-version:content-type;\r
29         bh=wPeLnYXZa03krad0xZ8+t4I7R7kpE5CpjQNlW99kq8c=;\r
30         b=B3odIqkuiJCccIuyH4HL+hUSgKlIfJeMXv/eMA4QJJU4CJn7SJ9Amfwyq/QYvW8OCG\r
31         N1I6znUAqPBq1S2UnHsVq+YfvU3y7vIuiqb/nhIs2Sz7gEvttyVunM7I3ICwAzbrnbIS\r
32         1w5tp2N3JQQEWB8xMeiznGAx2//58zJilAWjs=\r
33 Received: by 10.204.154.201 with SMTP id p9mr21354450bkw.33.1321535308764;\r
34         Thu, 17 Nov 2011 05:08:28 -0800 (PST)\r
35 Received: from localhost ([91.144.186.21])\r
36         by mx.google.com with ESMTPS id e8sm41222670bkd.7.2011.11.17.05.08.27\r
37         (version=TLSv1/SSLv3 cipher=OTHER);\r
38         Thu, 17 Nov 2011 05:08:28 -0800 (PST)\r
39 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
40 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\r
41 Subject: Re: [PATCH 8/9] test: check if emacs is available in the beginning of\r
42         test_emacs\r
43 In-Reply-To: <87k46zngrf.fsf@gmail.com>\r
44 References: <1321494986-18998-1-git-send-email-dmitry.kurochkin@gmail.com>\r
45         <1321494986-18998-9-git-send-email-dmitry.kurochkin@gmail.com>\r
46         <yf67h2zgk3b.fsf@taco2.nixu.fi> <87k46zngrf.fsf@gmail.com>\r
47 User-Agent: Notmuch/0.10_rc1+9~g8270095 (http://notmuchmail.org) Emacs/23.3.1\r
48         (x86_64-pc-linux-gnu)\r
49 Date: Thu, 17 Nov 2011 17:08:12 +0400\r
50 Message-ID: <8762iioq0z.fsf@gmail.com>\r
51 MIME-Version: 1.0\r
52 Content-Type: text/plain; charset=us-ascii\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.13\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57         <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Thu, 17 Nov 2011 13:08:31 -0000\r
66 \r
67 On Thu, 17 Nov 2011 15:13:40 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
68 > On Thu, 17 Nov 2011 11:43:36 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
69 > > On Thu, 17 Nov 2011 05:56:25 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
70 > > > Unfortunately, this is needed to avoid the emacs waiting loop.\r
71 > > > ---\r
72 > > \r
73 > > >  test/test-lib.sh |    4 ++++\r
74 > > >  1 files changed, 4 insertions(+), 0 deletions(-)\r
75 > > \r
76 > > [ context reduced ]\r
77 > > \r
78 > > > diff --git a/test/test-lib.sh b/test/test-lib.sh\r
79 > > > index 840c86c..5bd5bd6 100755\r
80 > > > --- a/test/test-lib.sh\r
81 > > > +++ b/test/test-lib.sh\r
82 > > \r
83 > > I have to patch the full set to my clone of the repo and do \r
84 > > fuller review, but until that...\r
85 > > \r
86 > > >  test_emacs () {\r
87 > > > + # test dependencies beforehand to avoid the waiting loop below\r
88 > > > + which emacs >/dev/null || emacs || return\r
89 > > > + which emacsclient >/dev/null || emacsclient || return\r
90 > > > +\r
91 > > \r
92 > > If emacs not found using which (what happened to hash), then try\r
93 > > to execute emacs (??) and if that fails return.\r
94 > > \r
95 > > Same thing with emacsclient.\r
96 > > \r
97 > > In case of emacs: DISPLAY set, TERM=dumb -- emacs starts interactively\r
98 > > on my desktop; grep DISPLAY test/* yields nothing. (maybe we should unset\r
99 > > DISPLAY for tests ?). And, if DISPLAY unset, emacs exits with nonzero\r
100 > > value, making || return happen anyway.\r
101 > > \r
102 > > ... and this is tested every time test_emacs() is executed...\r
103 > > \r
104\r
105 > Either you did not apply other patches, or I made some stupid mistake.\r
106\r
107 > I am not very happy with the above lines.  They feel hackish.  Perhaps\r
108 > others would suggest something better.\r
109\r
110 > Here is a more detailed explanation of what they do (or should do):\r
111\r
112 >   which emacs || # check that emacs binary exists  (hash would succeed\r
113 >                  # for functions)\r
114 >   emacs || # if the binary does not exist, run the "replacement"\r
115 >            # function which would register the missing dependency\r
116 >   return # and return with an error\r
117\r
118 \r
119 I have sent a new version of this patch series [1] which moves the above\r
120 tricks into a dedicated function.\r
121 \r
122 Regards,\r
123   Dmitry\r
124 \r
125 [1] id:"1321535163-4895-1-git-send-email-dmitry.kurochkin@gmail.com"\r
126 \r
127 > Regards,\r
128 >   Dmitry\r
129\r
130 > > >   if [ -z "$EMACS_SERVER" ]; then\r
131 > > >           server_name="notmuch-test-suite-$$"\r
132 > > > -- \r
133 > > > 1.7.7.2\r
134 > > \r
135 > > Tomi\r