Re: [PATCH v4 01/16] add util/search-path.{c, h} to test for executables in $PATH
[notmuch-archives.git] / dc / e2ce50aa6805a3583ebeee84136b818005ae92
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 174F7429E28\r
6         for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:23:01 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 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, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id AxR0puQ31Alj for <notmuch@notmuchmail.org>;\r
17         Thu, 17 Nov 2011 05:23:00 -0800 (PST)\r
18 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 42BCF429E27\r
22         for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:23:00 -0800 (PST)\r
23 Received: by bkaq10 with SMTP id q10so2131907bka.26\r
24         for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:22:59 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
27         :mime-version:content-type;\r
28         bh=AGeJ/BdZFM5VjNJ5Ur3WmLeY9xeEZWq9XMmkWv5SNaE=;\r
29         b=oPphR0gaTUEIzoeBsvyrzh3vZyth8Y1eja/6cQ6ctIBHkTB+MIDn7JgP+CXAow0Jj9\r
30         btMM9V9btEPSThoZwJVcgmfM/4bM+BYrXm1CjPxF0Ld3EcDh/57fghW7kcX1GQoLH5HY\r
31         r2FuF1Jcii9EcXto+kn6PlB8ksHLWO3FjRTj0=\r
32 Received: by 10.205.120.145 with SMTP id fy17mr22955868bkc.124.1321536178717; \r
33         Thu, 17 Nov 2011 05:22:58 -0800 (PST)\r
34 Received: from localhost ([91.144.186.21])\r
35         by mx.google.com with ESMTPS id j16sm3850622bkv.14.2011.11.17.05.22.56\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Thu, 17 Nov 2011 05:22:57 -0800 (PST)\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
39 To: Tomi Ollila <tomi.ollila@iki.fi>,\r
40         Jameson Graef Rollins <jrollins@finestructure.net>, notmuch@notmuchmail.org\r
41 Subject: Re: [PATCH 0/9] test: (hopefully) better test prerequisites\r
42 In-Reply-To: <yf64ny3gcu4.fsf@taco2.nixu.fi>\r
43 References: <1321494986-18998-1-git-send-email-dmitry.kurochkin@gmail.com>\r
44         <874ny36rhc.fsf@servo.finestructure.net>\r
45         <yf64ny3gcu4.fsf@taco2.nixu.fi>\r
46 User-Agent: Notmuch/0.10_rc1+9~g8270095 (http://notmuchmail.org) Emacs/23.3.1\r
47         (x86_64-pc-linux-gnu)\r
48 Date: Thu, 17 Nov 2011 17:22:41 +0400\r
49 Message-ID: <8739dmopcu.fsf@gmail.com>\r
50 MIME-Version: 1.0\r
51 Content-Type: text/plain; charset=us-ascii\r
52 X-BeenThere: notmuch@notmuchmail.org\r
53 X-Mailman-Version: 2.1.13\r
54 Precedence: list\r
55 List-Id: "Use and development of the notmuch mail system."\r
56         <notmuch.notmuchmail.org>\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
60 List-Post: <mailto:notmuch@notmuchmail.org>\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
64 X-List-Received-Date: Thu, 17 Nov 2011 13:23:01 -0000\r
65 \r
66 Hi Tomi.\r
67 \r
68 On Thu, 17 Nov 2011 14:20:19 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
69 > On Thu, 17 Nov 2011 01:14:07 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:\r
70 > > \r
71 > > However, when I tried to test the tests with the patch applied I ran\r
72 > > into one problem.  If I try to run the test suite with dtach\r
73 > > uninstalled, it looks like I'm experiencing a hang on\r
74 > > emacs_deliver_message call.  I wonder if either emacs_deliver_message or\r
75 > > test_emacs is not doing the right thing in the case of no dtach.  I\r
76 > > think emacs_deliver_message should somehow not require dtach, since it's\r
77 > > not actually testing any display stuff, but because it's currently using\r
78 > > test_emacs, it is somehow implicitly depending on it.  Any thoughts on\r
79 > > how to fix that?\r
80\r
81 > Quick thought\r
82\r
83 > mk_skip_test_emacs () \r
84 > { test_emacs () \r
85 >   { \r
86 >       echo SKIPPED\r
87 >         false\r
88 >   }\r
89 >   test_emacs\r
90 > }\r
91\r
92 > mk_run_test_emacs () \r
93 > { test_emacs () \r
94 >   {\r
95 >       emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"\r
96 >   }\r
97 >   test_emacs\r
98 > }\r
99\r
100 > test_emacs ()\r
101 > {\r
102 >         which dtach >/dev/null 2>&1 || { mk_skip_test_emacs; return; }\r
103 >         which emacs >/dev/null 2>&1 || { mk_skip_test_emacs; return; }\r
104 >         which emacsclient >/dev/null 2>&1 || { mk_skip_test_emacs; return; }\r
105\r
106 >         EMACS_SERVER="notmuch-test-suite-$$"\r
107 >       # start a detached session with an emacs server\r
108 >       # user's TERM is given to dtach which assumes a minimally\r
109 >       # VT100-compatible terminal -- and emacs inherits that\r
110 >       TERM=$ORIGINAL_TERM dtach -n "$TMP_DIRECTORY/emacs-dtach-socket.$$" \\r
111 >               sh -c "stty rows 24 cols 80; exec '$TMP_DIRECTORY/run_emacs' \\r
112 >                       --no-window-system \\r
113 >                       --eval '(setq server-name \"$EMACS_SERVER\")' \\r
114 >                       --eval '(server-start)' \\r
115 >                       --eval '(orphan-watchdog $$)'" ||\r
116 >                         { mk_skip_test_emacs; return; }\r
117 >       # wait until the emacs server is up\r
118 >         for _ in 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 20 1 2 3 4 5 6 7 8 9 30\r
119 >         do \r
120 >               if test_emacs '()' 2>/dev/null\r
121 >                 then\r
122 >                         mk_run_test_emacs\r
123 >                         return\r
124 >                 fi\r
125 >         done\r
126 >         mk_skip_test_emacs\r
127 > }\r
128\r
129 > I.e. dynamically, at run-time, re-create test_emacs function...\r
130\r
131 \r
132 Could you please add some human-friendly description on what benefits\r
133 the code above has? :)\r
134 \r
135 The only change I see (besides code refactoring) is 30sec timeout (BTW\r
136 you can replace the list of numbers with "seq 30") instead of infinite\r
137 wait loop.  Which may be a good, but unrelated change.\r
138 \r
139 As for re-creating functions dynamically, I find the above code more\r
140 complex than the existing one.  I think the current code is more\r
141 shell-style and easier to understand.  Just IMHO.\r
142 \r
143 Regards,\r
144   Dmitry\r
145 \r
146 > > \r
147 > > jamie.\r
148\r
149 > Tomi\r