aboutsummaryrefslogtreecommitdiff
path: root/test/test-lib.sh
diff options
context:
space:
mode:
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>2011-07-01 08:55:16 +0400
committerDavid Bremner <bremner@debian.org>2011-11-05 20:49:27 -0300
commita1ea4e914f5392a07ede2e6fc5f4350368e267b1 (patch)
treeb96022b1127ddc4c975e08f846c3f9f3ea57d66b /test/test-lib.sh
parent749abb74f2c838552a4f26e26be2edaa353d7fe4 (diff)
test: run emacs inside screen
Before the change, emacs run in daemon mode without any visible buffers. Turns out that this affects emacs behavior in some cases. In particular, `window-end' function returns `point-max' instead of the last visible position. That makes it hard or impossible to implement some tests. The patch runs emacs in a detached screen(1) session. So that it works exactly as if it has a visible window. Note: screen terminates when emacs exits. So the patch does not introduce new "running processes left behind" issues.
Diffstat (limited to 'test/test-lib.sh')
-rwxr-xr-xtest/test-lib.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh
index f524ebf..ff5183f 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -841,10 +841,16 @@ EOF
test_emacs () {
if [ -z "$EMACS_SERVER" ]; then
EMACS_SERVER="notmuch-test-suite-$$"
- "$TMP_DIRECTORY/run_emacs" \
- --daemon \
+ # start a detached screen session with an emacs server
+ screen -S "$EMACS_SERVER" -d -m "$TMP_DIRECTORY/run_emacs" \
+ --no-window-system \
--eval "(setq server-name \"$EMACS_SERVER\")" \
+ --eval '(server-start)' \
--eval "(orphan-watchdog $$)" || return
+ # 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 $@)"