]> git.notmuchmail.org Git - notmuch/commitdiff
test: run emacs inside screen
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Fri, 1 Jul 2011 04:55:16 +0000 (08:55 +0400)
committerDavid Bremner <bremner@debian.org>
Sat, 5 Nov 2011 23:49:27 +0000 (20:49 -0300)
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.

test/test-lib.sh

index f524ebf6701f0e261c3afaf14b0752a1861b4b4b..ff5183fff662afbc3cffab68ac7ffeef06d66a53 100755 (executable)
@@ -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 $@)"