How does notmuch track mails?
[notmuch-archives.git] / 91 / 6b2d6ad4272bbc513543dd42bdb6b5bc754f7e
1 Return-Path: <amdragon@mit.edu>\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 DDDEB431FAF\r
6         for <notmuch@notmuchmail.org>; Tue, 27 Nov 2012 19:25:08 -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 HRDJVlyT4alS for <notmuch@notmuchmail.org>;\r
16         Tue, 27 Nov 2012 19:25:07 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
18         [18.7.68.34])\r
19         by olra.theworths.org (Postfix) with ESMTP id 19F6F431FAE\r
20         for <notmuch@notmuchmail.org>; Tue, 27 Nov 2012 19:25:07 -0800 (PST)\r
21 X-AuditID: 12074422-b7f196d00000398d-d5-50b58411e2d9\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 21.44.14733.11485B05; Tue, 27 Nov 2012 22:25:05 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id qAS3P2m0015106; \r
27         Tue, 27 Nov 2012 22:25:02 -0500\r
28 Received: from drake.dyndns.org\r
29         (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [209.6.116.242]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qAS3P08F001546\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Tue, 27 Nov 2012 22:25:02 -0500 (EST)\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
36         (envelope-from <amdragon@mit.edu>)\r
37         id 1TdYGi-0003ny-OY; Tue, 27 Nov 2012 22:25:00 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH] test: Make the emacsclient binary user-configurable\r
41 Date: Tue, 27 Nov 2012 22:24:59 -0500\r
42 Message-Id: <1354073099-14582-1-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.10.4\r
44 X-Brightmail-Tracker:\r
45  H4sIAAAAAAAAA+NgFlrOIsWRmVeSWpSXmKPExsUixG6noivYsjXA4P1nC4vrN2cyOzB6PFt1\r
46         izmAMYrLJiU1J7MstUjfLoEr4/nd54wFHxQq/v/+y9jAuEi6i5GTQ0LARKLrwmFWCFtM4sK9\r
47         9WxdjFwcQgL7GCX2XF/CDOFsYJSY0t7JCuE8YpLY+e8ZO4Qzl1Hi6IwPzCD9bAIaEtv2L2cE\r
48         sUUEpCV23p0N1MHBwSygJvGnSwUkLCzgIjH14h0mEJtFQFXixOU+MJtXwEHizsVNTBBnKEp0\r
49         P5vANoGRdwEjwypG2ZTcKt3cxMyc4tRk3eLkxLy81CJdU73czBK91JTSTYzgMHBR2sH486DS\r
50         IUYBDkYlHl4Lq60BQqyJZcWVuYcYJTmYlER5X9QDhfiS8lMqMxKLM+KLSnNSiw8xSnAwK4nw\r
51         pkUC5XhTEiurUovyYVLSHCxK4rzXUm76CwmkJ5akZqemFqQWwWRlODiUJHjtmoEaBYtS01Mr\r
52         0jJzShDSTBycIMN5gIbfawIZXlyQmFucmQ6RP8Woy9H7r+sJoxBLXn5eqpQ4ryDIIAGQoozS\r
53         PLg5sPh9xSgO9JYw70OQUTzA2Ieb9ApoCRPQkuTrG0GWlCQipKQaGOdcYHmQ9Vva7sKlXre2\r
54         GUEha8WjFzp++PfrqfTxJBE9jzU/vqnsP9GZE7F3p/nSKAHf7OniM3ytN27WeNi8Wsw97NzG\r
55         hf+bZAw3M33xD7wRnfx90bz7EoHGPte5t8ty1lnGxW/rbtYumfTj562PFtxWrvFliquktO/z\r
56         Zr2eb30uetOTgusiN5VYijMSDbWYi4oTAah+6NG6AgAA\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Wed, 28 Nov 2012 03:25:09 -0000\r
70 \r
71 And require that if TEST_EMACS is specified, so is TEST_EMACSCLIENT.\r
72 \r
73 Previously, the test framework always used "emacsclient", even if the\r
74 Emacs in use was overridden by TEST_EMACS.  This causes problems if\r
75 both Emacs 23 and Emacs 24 are installed, the Emacs 23 emacsclient is\r
76 the system default, but TEST_EMACS is set to emacs24.  Specifically,\r
77 with an Emacs 24 server and an Emacs 23 client, emacs tests that run\r
78 very quickly may produce no output from emacsclient, causing the test\r
79 to fail.\r
80 \r
81 The Emacs server uses a very simple line-oriented protocol in which\r
82 the client sends a request to evaluate an expression and the server\r
83 sends a request to print the result of evaluation.  Prior to Emacs bzr\r
84 commit 107565 on March 11th, 2012 (released in Emacs 24.1), if\r
85 multiple commands were sent to the emacsclient between when it sent\r
86 the evaluation command and when it entered its receive loop, it would\r
87 only process the first response command, ignoring the rest of the\r
88 received buffer.  This wasn't a problem with the Emacs 23 server\r
89 because it sent only the command to print the evaluation result.\r
90 However, the Emacs 24 server first sends an unprompted command\r
91 specifying the PID of the Emacs server, then processes the evaluation\r
92 request, then sends the command to print the result.  If the\r
93 evaluation is fast enough, it can send both of these commands before\r
94 emacsclient enters the receive loop.  Hence, if an Emacs 24 server is\r
95 used with an Emacs 23 emacsclient, it may miss the response printing\r
96 command, ultimately causing intermittent notmuch test failures.\r
97 ---\r
98  test/README      |   10 +++++-----\r
99  test/test-lib.sh |   12 +++++++++---\r
100  2 files changed, 14 insertions(+), 8 deletions(-)\r
101 \r
102 diff --git a/test/README b/test/README\r
103 index 6dc3034..81c232d 100644\r
104 --- a/test/README\r
105 +++ b/test/README\r
106 @@ -69,12 +69,12 @@ can be specified as follows:\r
107  \r
108         make test OPTIONS="--verbose"\r
109  \r
110 -You can choose an emacs binary to run the tests in one of the\r
111 -following ways.\r
112 +You can choose an emacs binary (and corresponding emacsclient) to run\r
113 +the tests in one of the following ways.\r
114  \r
115 -       TEST_EMACS=my-special-emacs make test\r
116 -       TEST_EMACS=my-special-emacs ./emacs\r
117 -       make test TEST_EMACS=my-special-emacs\r
118 +       TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient make test\r
119 +       TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient ./emacs\r
120 +       make test TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient\r
121  \r
122  Skipping Tests\r
123  --------------\r
124 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
125 index 467b83c..e092231 100644\r
126 --- a/test/test-lib.sh\r
127 +++ b/test/test-lib.sh\r
128 @@ -49,7 +49,13 @@ TZ=UTC\r
129  TERM=dumb\r
130  export LANG LC_ALL PAGER TERM TZ\r
131  GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}\r
132 +if [[ ( -n "$TEST_EMACS" && -z "$TEST_EMACSCLIENT" ) || \\r
133 +      ( -z "$TEST_EMACS" && -n "$TEST_EMACSCLIENT" ) ]]; then\r
134 +    echo "error: must specify both or neither of TEST_EMACS and TEST_EMACSCLIENT" >&2\r
135 +    exit 1\r
136 +fi\r
137  TEST_EMACS=${TEST_EMACS:-${EMACS:-emacs}}\r
138 +TEST_EMACSCLIENT=${TEST_EMACSCLIENT:-emacsclient}\r
139  \r
140  # Protect ourselves from common misconfiguration to export\r
141  # CDPATH into the environment\r
142 @@ -969,7 +975,7 @@ test_emacs () {\r
143         missing_dependencies=\r
144         test_require_external_prereq dtach || missing_dependencies=1\r
145         test_require_external_prereq emacs || missing_dependencies=1\r
146 -       test_require_external_prereq emacsclient || missing_dependencies=1\r
147 +       test_require_external_prereq ${TEST_EMACSCLIENT} || missing_dependencies=1\r
148         test -z "$missing_dependencies" || return\r
149  \r
150         if [ -z "$EMACS_SERVER" ]; then\r
151 @@ -1005,7 +1011,7 @@ test_emacs () {\r
152         rm -f OUTPUT\r
153         touch OUTPUT\r
154  \r
155 -       emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"\r
156 +       ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(progn $@)"\r
157  }\r
158  \r
159  test_python() {\r
160 @@ -1158,7 +1164,7 @@ rm -f y\r
161  # declare prerequisites for external binaries used in tests\r
162  test_declare_external_prereq dtach\r
163  test_declare_external_prereq emacs\r
164 -test_declare_external_prereq emacsclient\r
165 +test_declare_external_prereq ${TEST_EMACSCLIENT}\r
166  test_declare_external_prereq gdb\r
167  test_declare_external_prereq gpg\r
168  test_declare_external_prereq python\r
169 -- \r
170 1.7.10.4\r
171 \r