[PATCH v2 02/10] test: set EMACS_SERVER variable only after dtach(1) was successfully started
Dmitry Kurochkin
dmitry.kurochkin at gmail.com
Thu Nov 17 05:05:55 PST 2011
Otherwise, we can set the EMACS_SERVER and return with an error. And
subsequent calls to test_emacs would assume that emacs server is running.
---
test/test-lib.sh | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 222b5e4..ff85848 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -823,50 +823,51 @@ export NOTMUCH_CONFIG=$NOTMUCH_CONFIG
# Here's what we are using here:
#
# --no-init-file Don't load users ~/.emacs
#
# --no-site-file Don't load the site-wide startup stuff
#
# --directory Ensure that the local elisp sources are found
#
# --load Force loading of notmuch.el and test-lib.el
exec emacs --no-init-file --no-site-file \
--directory "$TEST_DIRECTORY/../emacs" --load notmuch.el \
--directory "$TEST_DIRECTORY" --load test-lib.el \
"\$@"
EOF
chmod a+x "$TMP_DIRECTORY/run_emacs"
}
test_emacs () {
if [ -z "$EMACS_SERVER" ]; then
- EMACS_SERVER="notmuch-test-suite-$$"
+ server_name="notmuch-test-suite-$$"
# start a detached session with an emacs server
# user's TERM is given to dtach which assumes a minimally
# VT100-compatible terminal -- and emacs inherits that
TERM=$ORIGINAL_TERM dtach -n "$TMP_DIRECTORY/emacs-dtach-socket.$$" \
sh -c "stty rows 24 cols 80; exec '$TMP_DIRECTORY/run_emacs' \
--no-window-system \
- --eval '(setq server-name \"$EMACS_SERVER\")' \
+ --eval '(setq server-name \"$server_name\")' \
--eval '(server-start)' \
--eval '(orphan-watchdog $$)'" || return
+ EMACS_SERVER="$server_name"
# wait until the emacs server is up
until test_emacs '()' 2>/dev/null; do
sleep 1
done
fi
emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"
}
test_reset_state_ () {
test_subtest_known_broken_=
}
find_notmuch_path ()
{
dir="$1"
while [ -n "$dir" ]; do
bin="$dir/notmuch"
--
1.7.7.2
More information about the notmuch
mailing list