Re: [PATCH 1/2] test: auto load elisp tests file in test_emacs if available
[notmuch-archives.git] / 33 / 4821a6e133ca85e9d71df198e92bf9ce150ac4
1 Return-Path: <pieter@praet.org>\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 EB8AF431E62\r
6         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:41:56 -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: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 LTd40fZoiLhq for <notmuch@notmuchmail.org>;\r
16         Mon, 16 Jan 2012 02:41:56 -0800 (PST)\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
18         [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 212A7431FC0\r
21         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:41:56 -0800 (PST)\r
22 Received: by wibhr12 with SMTP id hr12so2267738wib.26\r
23         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:41:55 -0800 (PST)\r
24 Received: by 10.180.73.72 with SMTP id j8mr8034937wiv.2.1326710515004;\r
25         Mon, 16 Jan 2012 02:41:55 -0800 (PST)\r
26 Received: from localhost ([109.131.75.86])\r
27         by mx.google.com with ESMTPS id 28sm21753599wby.3.2012.01.16.02.41.53\r
28         (version=TLSv1/SSLv3 cipher=OTHER);\r
29         Mon, 16 Jan 2012 02:41:54 -0800 (PST)\r
30 From: Pieter Praet <pieter@praet.org>\r
31 To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
32 Subject: Re: [PATCH] test: don't bail out of `run_emacs' too early when\r
33         missing prereqs\r
34 In-Reply-To: <871ur1nk6i.fsf@gmail.com>\r
35 References: <87d3aolu61.fsf@praet.org>\r
36         <1326388619-17422-1-git-send-email-pieter@praet.org>\r
37         <87zkdsg6ze.fsf@gmail.com> <87mx9qps82.fsf@praet.org>\r
38         <871ur1nk6i.fsf@gmail.com>\r
39 User-Agent: Notmuch/0.11+78~g6c58370 (http://notmuchmail.org) Emacs/23.3.1\r
40         (x86_64-unknown-linux-gnu)\r
41 Date: Mon, 16 Jan 2012 11:40:05 +0100\r
42 Message-ID: <87y5t80w3e.fsf@praet.org>\r
43 MIME-Version: 1.0\r
44 Content-Type: text/plain; charset=us-ascii\r
45 Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Mon, 16 Jan 2012 10:41:57 -0000\r
59 \r
60 On Sun, 15 Jan 2012 17:56:37 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
61 > On Sat, 14 Jan 2012 10:07:41 +0100, Pieter Praet <pieter@praet.org> wrote:\r
62 > > On Thu, 12 Jan 2012 21:34:29 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
63 > > > On Thu, 12 Jan 2012 18:16:59 +0100, Pieter Praet <pieter@praet.org> wrote:\r
64 > > > > When running the Emacs tests in verbose mode, only the first missing\r
65 > > > > prereq is reported because the `run_emacs' function is short-circuited\r
66 > > > > early:\r
67 > > > > \r
68 > > > >   #+begin_example\r
69 > > > >     emacs: Testing emacs interface\r
70 > > > >      missing prerequisites: [0]  emacs(1)\r
71 > > > >      skipping test: [0]  Basic notmuch-hello view in emacs\r
72 > > > >      SKIP   [0]  Basic notmuch-hello view in emacs\r
73 > > > >   #+end_example\r
74 > > > > \r
75 > > > > This can lead to situations reminiscent of "dependency hell", so instead\r
76 > > > > of returning based on each individual `test_require_external_prereq's exit\r
77 > > > > status, we now do so by checking $test_subtest_missing_external_prereqs_:\r
78 > > > > \r
79 > > > >   #+begin_example\r
80 > > > >     emacs: Testing emacs interface\r
81 > > > >      missing prerequisites: [0]  dtach(1) emacs(1) emacsclient(1)\r
82 > > > >      skipping test: [0]  Basic notmuch-hello view in emacs\r
83 > > > >      SKIP   [0]  Basic notmuch-hello view in emacs\r
84 > > > >   #+end_example\r
85 > > > > \r
86 > > > > Also add missing prereq for dtach(1).\r
87 > > > > \r
88 > > > > ---\r
89 > > > >  test/test-lib.sh |    6 ++++--\r
90 > > > >  1 files changed, 4 insertions(+), 2 deletions(-)\r
91 > > > > \r
92 > > > > diff --git a/test/test-lib.sh b/test/test-lib.sh\r
93 > > > > index 82767c0..6ec3882 100644\r
94 > > > > --- a/test/test-lib.sh\r
95 > > > > +++ b/test/test-lib.sh\r
96 > > > > @@ -907,8 +907,10 @@ EOF\r
97 > > > >  \r
98 > > > >  test_emacs () {\r
99 > > > >         # test dependencies beforehand to avoid the waiting loop below\r
100 > > > > -       test_require_external_prereq emacs || return\r
101 > > > > -       test_require_external_prereq emacsclient || return\r
102 > > > > +       test_require_external_prereq dtach\r
103 > > > > +       test_require_external_prereq emacs\r
104 > > > > +       test_require_external_prereq emacsclient\r
105 > > > > +       test -z "$test_subtest_missing_external_prereqs_" || return\r
106 > > > \r
107 > > > There may be other missing dependencies before test_emacs() is called\r
108 > > > and $test_subtest_missing_external_prereqs_ would not be blank.  [...]\r
109 > > \r
110 > > True, hadn't though of that...\r
111 > > \r
112 > > > [...] Also, I\r
113 > > > would like to keep the number of functions that use\r
114 > > > $test_subtest_missing_external_prereqs_ minimal.  [...]\r
115 > > \r
116 > > Could you elaborate on that?\r
117 > > \r
118\r
119 > This variable is supposed to be internal.  I would like to be able to\r
120 > change it's meaning or replace it with something better with minimal\r
121 > changes in the other code.  So I prefer it to be used only by few\r
122 > "low-level" dependency functions.\r
123\r
124 \r
125 Ok, thanks!\r
126 \r
127 \r
128 > This is not some strict rule, in other situation I may agree that using\r
129 > $test_subtest_missing_external_prereqs_ directly is the best option.\r
130 > But in this case, introducing a local variable with clean and simple\r
131 > meaning is better IMO.\r
132\r
133 \r
134 Agreed.\r
135 \r
136 \r
137 > Regards,\r
138 >   Dmitry\r
139\r
140 > > > [...] How about:\r
141 > > > \r
142 > > >   missing_dependencies=\r
143 > > >   test_require_... dtach || missing_dependencies=1\r
144 > > >   test_require_... emacs || missing_dependencies=1\r
145 > > >   ...\r
146 > > >   test -z "$missing_dependencies" || return\r
147 > > > \r
148 > > \r
149 > > Agreed!  Patch follows.\r
150 > > \r
151 > > > Regards,\r
152 > > >   Dmitry\r
153 > > > \r
154 > > > >  \r
155 > > > >         if [ -z "$EMACS_SERVER" ]; then\r
156 > > > >                 server_name="notmuch-test-suite-$$"\r
157 > > > > -- \r
158 > > > > 1.7.8.1\r
159 > > > > \r
160 > > \r
161 > > \r
162 > > Peace\r
163 > > \r
164 > > -- \r
165 > > Pieter\r
166 \r
167 \r
168 Peace\r
169 \r
170 -- \r
171 Pieter\r