diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el index 200fb4c58c..e1a260c336 100644 --- a/test/lisp/shadowfile-tests.el +++ b/test/lisp/shadowfile-tests.el @@ -19,6 +19,18 @@ ;;; Commentary: +;; Some of the tests require access to a remote host files. Since +;; this could be problematic, a mock-up connection method "mock" is +;; used. Emulating a remote connection, it simply calls "sh -i". +;; Tramp's file name handlers still run, so this test is sufficient +;; except for connection establishing. + +;; If you want to test a real Tramp connection, set +;; $REMOTE_TEMPORARY_FILE_DIRECTORY to a suitable value in order to +;; overwrite the default value. If you want to skip tests accessing a +;; remote host, set this environment variable to "/dev/null" or +;; whatever is appropriate on your system. + ;; A whole test run can be performed calling the command `shadowfile-test-all'. ;;; Code: @@ -27,28 +39,28 @@ (require 'shadowfile) (require 'tramp) -;; There is no default value on w32 systems, which could work out of the box. (defconst shadow-test-remote-temporary-file-directory (cond ((getenv "REMOTE_TEMPORARY_FILE_DIRECTORY")) - ((eq system-type 'windows-nt) null-device) - (t (add-to-list - 'tramp-methods - '("mock" - (tramp-login-program "sh") - (tramp-login-args (("-i"))) - (tramp-remote-shell "/bin/sh") - (tramp-remote-shell-args ("-c")) - (tramp-connection-timeout 10))) - (add-to-list - 'tramp-default-host-alist - `("\\`mock\\'" nil ,(system-name))) - ;; Emacs' Makefile sets $HOME to a nonexistent value. Needed in - ;; batch mode only, therefore. It cannot be - ;; `temporary-directory', because the tests with "~" would fail. - (unless (and (null noninteractive) (file-directory-p "~/")) - (setenv "HOME" invocation-directory)) - (format "/mock::%s" temporary-file-directory))) + ((executable-find "sh") + (add-to-list + 'tramp-methods + `("mock" + (tramp-login-program ,(executable-find "sh")) + (tramp-login-args (("-i"))) + (tramp-remote-shell ,(executable-find "sh")) + (tramp-remote-shell-args ("-c")) + (tramp-connection-timeout 10))) + (add-to-list + 'tramp-default-host-alist + `("\\`mock\\'" nil ,(system-name))) + ;; Emacs' Makefile sets $HOME to a nonexistent value. Needed in + ;; batch mode only, therefore. It cannot be + ;; `temporary-directory', because the tests with "~" would fail. + (unless (and (null noninteractive) (file-directory-p "~/")) + (setenv "HOME" invocation-directory)) + (format "/mock::%s" temporary-file-directory)) + (t null-device)) "Temporary directory for Tramp tests.") (defconst shadow-test-info-file