X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2Ftest-lib.sh;h=49522da8706e6f6c7ee6dbc8dc48e41f9eb0faef;hb=eb4cf465;hp=7c8a86f6f282b680ea302e2a39f8923b9f153fe5;hpb=0cc5483a9cc496bbaa1a6aef03e99b4a7686f779;p=notmuch diff --git a/test/test-lib.sh b/test/test-lib.sh index 7c8a86f6..49522da8 100755 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -392,7 +392,7 @@ emacs_deliver_message () shift 2 # before we can send a message, we have to prepare the FCC maildir mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp} - ../smtp-dummy sent_message & + $TEST_DIRECTORY/smtp-dummy sent_message & smtp_dummy_pid=$! test_emacs \ "(let ((message-send-mail-function 'message-smtpmail-send-it) @@ -421,12 +421,12 @@ emacs_deliver_message () add_email_corpus () { rm -rf ${MAIL_DIR} - if [ -d ../corpus.mail ]; then - cp -a ../corpus.mail ${MAIL_DIR} + if [ -d $TEST_DIRECTORY/corpus.mail ]; then + cp -a $TEST_DIRECTORY/corpus.mail ${MAIL_DIR} else - cp -a ../corpus ${MAIL_DIR} + cp -a $TEST_DIRECTORY/corpus ${MAIL_DIR} notmuch new >/dev/null - cp -a ${MAIL_DIR} ../corpus.mail + cp -a ${MAIL_DIR} $TEST_DIRECTORY/corpus.mail fi } @@ -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 < run_emacs + cat <"$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 "$TEST_DIRECTORY/../emacs" --load notmuch.el \ + --directory "$TEST_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" "$@" } @@ -928,11 +931,11 @@ then test ! -d "$symlink_target" && test "#!" != "$(head -c 2 < "$symlink_target")" then - symlink_target=../valgrind.sh + symlink_target=$TEST_DIRECTORY/valgrind.sh fi case "$base" in *.sh|*.perl) - symlink_target=../unprocessed-script + symlink_target=$TEST_DIRECTORY/unprocessed-script esac # create the link, or replace it if it is out of date make_symlink "$symlink_target" "$GIT_VALGRIND/bin/$base" || exit @@ -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).