test: auto load elisp tests file in test_emacs if available
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Sun, 29 Jan 2012 03:36:02 +0000 (07:36 +0400)
committerDavid Bremner <bremner@debian.org>
Sun, 12 Feb 2012 16:58:20 +0000 (11:58 -0500)
This allows us to simplify shell part of tests written in elisp.

test/test-lib.sh

index 815832843cd3a3a400bca439965e9a68856975a2..0174e93f7e7591edfaae1206eb125de41a72676b 100644 (file)
@@ -943,6 +943,12 @@ test_emacs () {
        test -z "$missing_dependencies" || return
 
        if [ -z "$EMACS_SERVER" ]; then
+               emacs_tests="$(basename $0).el"
+               if [ -f "$TEST_DIRECTORY/$emacs_tests" ]; then
+                       load_emacs_tests="--eval '(load \"$emacs_tests\")'"
+               else
+                       load_emacs_tests=
+               fi
                server_name="notmuch-test-suite-$$"
                # start a detached session with an emacs server
                # user's TERM is given to dtach which assumes a minimally
@@ -950,6 +956,7 @@ test_emacs () {
                TERM=$ORIGINAL_TERM dtach -n "$TEST_TMPDIR/emacs-dtach-socket.$$" \
                        sh -c "stty rows 24 cols 80; exec '$TMP_DIRECTORY/run_emacs' \
                                --no-window-system \
+                               $load_emacs_tests \
                                --eval '(setq server-name \"$server_name\")' \
                                --eval '(server-start)' \
                                --eval '(orphan-watchdog $$)'" || return