aboutsummaryrefslogtreecommitdiff
path: root/test/test-lib.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/test-lib.sh')
-rwxr-xr-xtest/test-lib.sh24
1 files changed, 13 insertions, 11 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 7d39d27..079d7db 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -831,6 +831,8 @@ test_done () {
echo
+ [ -n "$EMACS_SERVER" ] && test_emacs '(kill-emacs)'
+
if [ "$test_failure" = "0" ]; then
if [ "$test_broken" = "0" ]; then
rm -rf "$remove_tmp"
@@ -850,16 +852,8 @@ emacs_generate_script () {
export PATH=$PATH
export NOTMUCH_CONFIG=$NOTMUCH_CONFIG
-# We assume that the user will give a command-line argument only if
-# wanting to run in batch mode.
-if [ \$# -gt 0 ]; then
- BATCH=--batch
-fi
-
# Here's what we are using here:
#
-# --batch: Quit after given commands and print all (messages)
-#
# --no-init-file Don't load users ~/.emacs
#
# --no-site-file Don't load the site-wide startup stuff
@@ -868,16 +862,24 @@ fi
#
# --load Force loading of notmuch.el and test-lib.el
-emacs \$BATCH --no-init-file --no-site-file \
+emacs --no-init-file --no-site-file \
--directory "$TEST_DIRECTORY/../emacs" --load notmuch.el \
--directory "$TEST_DIRECTORY" --load test-lib.el \
- --eval "(progn \$@)"
+ "\$@"
EOF
chmod a+x "$TMP_DIRECTORY/run_emacs"
}
test_emacs () {
- "$TMP_DIRECTORY/run_emacs" "$@"
+ if [ -z "$EMACS_SERVER" ]; then
+ EMACS_SERVER="notmuch-test-suite-$$"
+ "$TMP_DIRECTORY/run_emacs" \
+ --daemon \
+ --eval "(setq server-name \"$EMACS_SERVER\")" \
+ --eval "(orphan-watchdog $$)" || return
+ fi
+
+ emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"
}