The test_emacs() function is run by the emacs tests even if the EMACS prereq is
not available. This causes an issue when running the test suite on a system
where dtach is not installed: the emacs server will not start, but since the
$EMACS_SERVER variable is set on the first call to test_emacs, subsequent calls
may result in attempts to run emacsclient, which will then report "can't find
socket".

This patch fixes this issue by making sure that dtach and emacs are available
before doing anything else in test_emacs().
---
 test/test-lib.sh |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 382934f..ca1f412 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -852,6 +852,10 @@ EOF
 }

 test_emacs () {
+       # First check that emacs and dtach are available
+       hash emacs &>/dev/null || return
+       hash dtach &>/dev/null || return
+
        if [ -z "$EMACS_SERVER" ]; then
                EMACS_SERVER="notmuch-test-suite-$$"
                # start a detached session with an emacs server
-- 
1.7.7.3

Reply via email to