aboutsummaryrefslogtreecommitdiff
path: root/test/test-lib.sh
diff options
context:
space:
mode:
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>2011-06-28 08:45:10 +0400
committerCarl Worth <cworth@cworth.org>2011-06-28 15:06:47 -0700
commit273d896097830235eca5f1bc87ac03e381280f1c (patch)
tree16740c75e648137b9ceef3310e162146f56c7e66 /test/test-lib.sh
parent0cc5483a9cc496bbaa1a6aef03e99b4a7686f779 (diff)
test: generate run_emacs script once on test startup
Instead of generating auxiliary run_emacs script every time test_emacs is run, do it once in the beginning of the test. Also, use absolute paths in the script to make it more robust.
Diffstat (limited to 'test/test-lib.sh')
-rwxr-xr-xtest/test-lib.sh17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 7c8a86f..48bace2 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -839,11 +839,11 @@ test_done () {
fi
}
-test_emacs () {
+emacs_generate_script () {
# Construct a little test script here for the benefit of the user,
# (who can easily run "run_emacs" to get the same emacs environment
# for investigating any failures).
- cat <<EOF > run_emacs
+ cat <<EOF >"$TMP_DIRECTORY/run_emacs"
#!/bin/sh
export PATH=$PATH
export NOTMUCH_CONFIG=$NOTMUCH_CONFIG
@@ -867,12 +867,15 @@ fi
# --load Force loading of notmuch.el and test-lib.el
emacs \$BATCH --no-init-file --no-site-file \
- --directory ../../emacs --load notmuch.el \
- --directory .. --load test-lib.el \
+ --directory "$TMP_DIRECTORY/../../emacs" --load notmuch.el \
+ --directory "$TMP_DIRECTORY/.." --load test-lib.el \
--eval "(progn \$@)"
EOF
- chmod a+x ./run_emacs
- ./run_emacs "$@"
+ chmod a+x "$TMP_DIRECTORY/run_emacs"
+}
+
+test_emacs () {
+ "$TMP_DIRECTORY/run_emacs" "$@"
}
@@ -1000,6 +1003,8 @@ primary_email=test_suite@notmuchmail.org
other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org
EOF
+emacs_generate_script
+
# Use -P to resolve symlinks in our working directory so that the cwd
# in subprocesses like git equals our $PWD (for pathname comparisons).