Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id DDDEB431FAF for ; Tue, 27 Nov 2012 19:25:08 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HRDJVlyT4alS for ; Tue, 27 Nov 2012 19:25:07 -0800 (PST) Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU [18.7.68.34]) by olra.theworths.org (Postfix) with ESMTP id 19F6F431FAE for ; Tue, 27 Nov 2012 19:25:07 -0800 (PST) X-AuditID: 12074422-b7f196d00000398d-d5-50b58411e2d9 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP id 21.44.14733.11485B05; Tue, 27 Nov 2012 22:25:05 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id qAS3P2m0015106; Tue, 27 Nov 2012 22:25:02 -0500 Received: from drake.dyndns.org (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [209.6.116.242]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qAS3P08F001546 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Tue, 27 Nov 2012 22:25:02 -0500 (EST) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1TdYGi-0003ny-OY; Tue, 27 Nov 2012 22:25:00 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH] test: Make the emacsclient binary user-configurable Date: Tue, 27 Nov 2012 22:24:59 -0500 Message-Id: <1354073099-14582-1-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRmVeSWpSXmKPExsUixG6noivYsjXA4P1nC4vrN2cyOzB6PFt1 izmAMYrLJiU1J7MstUjfLoEr4/nd54wFHxQq/v/+y9jAuEi6i5GTQ0LARKLrwmFWCFtM4sK9 9WxdjFwcQgL7GCX2XF/CDOFsYJSY0t7JCuE8YpLY+e8ZO4Qzl1Hi6IwPzCD9bAIaEtv2L2cE sUUEpCV23p0N1MHBwSygJvGnSwUkLCzgIjH14h0mEJtFQFXixOU+MJtXwEHizsVNTBBnKEp0 P5vANoGRdwEjwypG2ZTcKt3cxMyc4tRk3eLkxLy81CJdU73czBK91JTSTYzgMHBR2sH486DS IUYBDkYlHl4Lq60BQqyJZcWVuYcYJTmYlER5X9QDhfiS8lMqMxKLM+KLSnNSiw8xSnAwK4nw pkUC5XhTEiurUovyYVLSHCxK4rzXUm76CwmkJ5akZqemFqQWwWRlODiUJHjtmoEaBYtS01Mr 0jJzShDSTBycIMN5gIbfawIZXlyQmFucmQ6RP8Woy9H7r+sJoxBLXn5eqpQ4ryDIIAGQoozS PLg5sPh9xSgO9JYw70OQUTzA2Ieb9ApoCRPQkuTrG0GWlCQipKQaGOdcYHmQ9Vva7sKlXre2 GUEha8WjFzp++PfrqfTxJBE9jzU/vqnsP9GZE7F3p/nSKAHf7OniM3ytN27WeNi8Wsw97NzG hf+bZAw3M33xD7wRnfx90bz7EoHGPte5t8ty1lnGxW/rbtYumfTj562PFtxWrvFliquktO/z Zr2eb30uetOTgusiN5VYijMSDbWYi4oTAah+6NG6AgAA X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 03:25:09 -0000 And require that if TEST_EMACS is specified, so is TEST_EMACSCLIENT. Previously, the test framework always used "emacsclient", even if the Emacs in use was overridden by TEST_EMACS. This causes problems if both Emacs 23 and Emacs 24 are installed, the Emacs 23 emacsclient is the system default, but TEST_EMACS is set to emacs24. Specifically, with an Emacs 24 server and an Emacs 23 client, emacs tests that run very quickly may produce no output from emacsclient, causing the test to fail. The Emacs server uses a very simple line-oriented protocol in which the client sends a request to evaluate an expression and the server sends a request to print the result of evaluation. Prior to Emacs bzr commit 107565 on March 11th, 2012 (released in Emacs 24.1), if multiple commands were sent to the emacsclient between when it sent the evaluation command and when it entered its receive loop, it would only process the first response command, ignoring the rest of the received buffer. This wasn't a problem with the Emacs 23 server because it sent only the command to print the evaluation result. However, the Emacs 24 server first sends an unprompted command specifying the PID of the Emacs server, then processes the evaluation request, then sends the command to print the result. If the evaluation is fast enough, it can send both of these commands before emacsclient enters the receive loop. Hence, if an Emacs 24 server is used with an Emacs 23 emacsclient, it may miss the response printing command, ultimately causing intermittent notmuch test failures. --- test/README | 10 +++++----- test/test-lib.sh | 12 +++++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/test/README b/test/README index 6dc3034..81c232d 100644 --- a/test/README +++ b/test/README @@ -69,12 +69,12 @@ can be specified as follows: make test OPTIONS="--verbose" -You can choose an emacs binary to run the tests in one of the -following ways. +You can choose an emacs binary (and corresponding emacsclient) to run +the tests in one of the following ways. - TEST_EMACS=my-special-emacs make test - TEST_EMACS=my-special-emacs ./emacs - make test TEST_EMACS=my-special-emacs + TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient make test + TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient ./emacs + make test TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient Skipping Tests -------------- diff --git a/test/test-lib.sh b/test/test-lib.sh index 467b83c..e092231 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -49,7 +49,13 @@ TZ=UTC TERM=dumb export LANG LC_ALL PAGER TERM TZ GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u} +if [[ ( -n "$TEST_EMACS" && -z "$TEST_EMACSCLIENT" ) || \ + ( -z "$TEST_EMACS" && -n "$TEST_EMACSCLIENT" ) ]]; then + echo "error: must specify both or neither of TEST_EMACS and TEST_EMACSCLIENT" >&2 + exit 1 +fi TEST_EMACS=${TEST_EMACS:-${EMACS:-emacs}} +TEST_EMACSCLIENT=${TEST_EMACSCLIENT:-emacsclient} # Protect ourselves from common misconfiguration to export # CDPATH into the environment @@ -969,7 +975,7 @@ test_emacs () { missing_dependencies= test_require_external_prereq dtach || missing_dependencies=1 test_require_external_prereq emacs || missing_dependencies=1 - test_require_external_prereq emacsclient || missing_dependencies=1 + test_require_external_prereq ${TEST_EMACSCLIENT} || missing_dependencies=1 test -z "$missing_dependencies" || return if [ -z "$EMACS_SERVER" ]; then @@ -1005,7 +1011,7 @@ test_emacs () { rm -f OUTPUT touch OUTPUT - emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)" + ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(progn $@)" } test_python() { @@ -1158,7 +1164,7 @@ rm -f y # declare prerequisites for external binaries used in tests test_declare_external_prereq dtach test_declare_external_prereq emacs -test_declare_external_prereq emacsclient +test_declare_external_prereq ${TEST_EMACSCLIENT} test_declare_external_prereq gdb test_declare_external_prereq gpg test_declare_external_prereq python -- 1.7.10.4