Re: [PATCH] emacs: call notmuch-show instead notmuch-search in buttonised id: links
[notmuch-archives.git] / f1 / 2300abdf11e25fb59692faf508a7dc16bdc910
1 Return-Path: <tomi.ollila@nixu.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 91FEF429E21\r
6         for <notmuch@notmuchmail.org>; Mon, 28 Nov 2011 13:16:31 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 gV+OLF6OmFhf for <notmuch@notmuchmail.org>;\r
16         Mon, 28 Nov 2011 13:16:31 -0800 (PST)\r
17 Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])\r
18         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 97EAA431FB6\r
21         for <notmuch@notmuchmail.org>; Mon, 28 Nov 2011 13:16:30 -0800 (PST)\r
22 Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])\r
23         by taco2.nixu.fi (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id\r
24         pASLGREc024485; Mon, 28 Nov 2011 23:16:27 +0200\r
25 From: Tomi Ollila <tomi.ollila@iki.fi>\r
26 To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>, notmuch@notmuchmail.org\r
27 Subject: Re: [PATCH 4/9] test: add support for external executable\r
28  dependencies\r
29 In-Reply-To: <1321494986-18998-5-git-send-email-dmitry.kurochkin@gmail.com>\r
30 References: <1321494986-18998-1-git-send-email-dmitry.kurochkin@gmail.com>\r
31         <1321494986-18998-5-git-send-email-dmitry.kurochkin@gmail.com>\r
32 User-Agent: Notmuch/0.10+15~gb5803e9 (http://notmuchmail.org) Emacs/23.3.1\r
33         (i686-pc-linux-gnu)\r
34 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
35         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
36         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
37 Date: Mon, 28 Nov 2011 23:16:27 +0200\r
38 Message-ID: <yf662i4j6c4.fsf@taco2.nixu.fi>\r
39 MIME-Version: 1.0\r
40 Content-Type: text/plain; charset=us-ascii\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Mon, 28 Nov 2011 21:16:31 -0000\r
54 \r
55 On Thu, 17 Nov 2011 05:56:21 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
56 > There is existing support for general prerequisites in the test suite.\r
57 > But it is not very convenient to use: every test case has to keep\r
58 > track for it's dependencies and they have to be explicitly listed.\r
59\r
60 > The patch aims to add better support for a particular type of external\r
61 > dependencies: external executables.  The main idea is to replace\r
62 > missing external binaries with shell functions that have the same\r
63 > name.  These functions always fail and keep track of missing\r
64 > dependencies for a subtest.  The result reporting functions later can\r
65 > check that an external binaries are missing and correctly report SKIP\r
66 > result instead of FAIL.  The primary benefit is that the test cases do\r
67 > not need to declare their dependencies or be changed in any way.\r
68 > ---\r
69 >  test/test-lib.sh |   49 +++++++++++++++++++++++++++++++++++++++++--------\r
70 >  1 files changed, 41 insertions(+), 8 deletions(-)\r
71\r
72 > diff --git a/test/test-lib.sh b/test/test-lib.sh\r
73 > index f21e45e..ab8c6fd 100755\r
74 > --- a/test/test-lib.sh\r
75 > +++ b/test/test-lib.sh\r
76 > @@ -526,40 +526,53 @@ notmuch_json_show_sanitize ()\r
77 >  # - Implicitly by specifying the prerequisite tag in the calls to\r
78 >  #   test_expect_{success,failure,code}.\r
79 >  #\r
80 >  # The single parameter is the prerequisite tag (a simple word, in all\r
81 >  # capital letters by convention).\r
82 >  \r
83 >  test_set_prereq () {\r
84 >       satisfied="$satisfied$1 "\r
85 >  }\r
86 >  satisfied=" "\r
87 >  \r
88 >  test_have_prereq () {\r
89 >       case $satisfied in\r
90 >       *" $1 "*)\r
91 >               : yes, have it ;;\r
92 >       *)\r
93 >               ! : nope ;;\r
94 >       esac\r
95 >  }\r
96 >  \r
97 > +# declare prerequisite for the given external binary\r
98 > +test_declare_external_prereq () {\r
99 > +     binary="$1"\r
100 > +     test "$#" = 2 && name=$2 || name="$binary(1)"\r
101 > +\r
102 > +        hash $binary 2>/dev/null || eval "\r
103 > +$1 () {\r
104 > +     echo -n \"\$test_subtest_missing_external_prereqs_\" | grep -e \" $name \" ||\r
105 > +     test_subtest_missing_external_prereqs_=\"$test_subtest_missing_external_prereqs_ $name\"\r
106 > +     false\r
107 > +}"\r
108 > +}\r
109 > +\r
110 \r
111 Does this work right ? ... the grep -e \" $name \"   -- part requires\r
112 spaces on both side of, but next line does not write trailing space...\r
113 ... and is there leading space (and also the latest\r
114 $test_subtest_missing_external_prereqs_ (just before 'false') is evaluated) ?\r
115 \r
116 This could perhaps be written like the above test_set_prereq &\r
117 test_save_prereq:\r
118 ...\r
119         hash $binary 2>/dev/null || eval "\r
120 $binary () {\r
121         test_missing_external_prereq_${binary}_=t\r
122         case \$test_subtest_missing_external_prereqs_ in\r
123                 *' $name '*) ;;\r
124                 *) test_subtest_missing_external_prereqs_=\"\$test_subtest_missing_external_prereqs_$name \"\r
125         esac\r
126         false\r
127 }\r
128 \r
129 and  test_subtest_missing_external_prereqs_=' '  done in test_reset_state_\r
130 \r
131 (I took some code from current git head.... also perhaps instead of \r
132 setting test_missing_external_prereq_${binary}_=t, (bash) associative\r
133 arrays could be taken into use -- the eval to read that information\r
134 is a bit hairy -- well, at least that part works for sure :D )\r
135 \r
136 Hmm... how about this:\r
137 \r
138         hash $binary 2>/dev/null || eval "\r
139 $binary () {\r
140         if [ -z \"\${test_missing_external_prereq_[$binary]}\" ]\r
141         then\r
142                 test_missing_external_prereq_[$binary]=t\r
143                 test_subtest_missing_external_prereqs_=\"\$test_subtest_missing_external_prereqs_ $name\"\r
144         fi\r
145         false\r
146 }\r
147 \r
148 and test_subtest_missing_external_prereqs_ cleared in test_reset_state_ like now.\r
149 \r
150 Tomi\r