Use a mock-up connection method for remote files.

* automated/file-notify-tests.el
(file-notify-test-remote-temporary-file-directory):
* automated/tramp-tests.el (tramp-test-temporary-file-directory):
Use a mock-up method as default.
(tramp-test00-availability): Print the used directory name.
(tramp-test33-recursive-load): Fix typo.
This commit is contained in:
Michael Albinus 2014-04-24 10:21:58 +02:00
parent 00104e5923
commit c0b9bc72cc
3 changed files with 52 additions and 14 deletions

View file

@ -1,3 +1,12 @@
2014-04-24 Michael Albinus <michael.albinus@gmx.de>
* automated/file-notify-tests.el
(file-notify-test-remote-temporary-file-directory):
* automated/tramp-tests.el (tramp-test-temporary-file-directory):
Use a mock-up method as default.
(tramp-test00-availability): Print the used directory name.
(tramp-test33-recursive-load): Fix typo.
2014-04-22 Michael Albinus <michael.albinus@gmx.de>
* automated/tramp-tests.el (tramp--test-check-files): Remove traces.

View file

@ -19,11 +19,17 @@
;;; Commentary:
;; Some of the tests require access to a remote host files. 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.
;; 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 handler 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.
;; When running the tests in batch mode, it must NOT require an
;; interactive password prompt unless the environment variable
@ -35,13 +41,22 @@
(require 'ert)
(require 'filenotify)
(require 'tramp)
;; There is no default value on w32 systems, which could work out of the box.
(defconst file-notify-test-remote-temporary-file-directory
(cond
((getenv "REMOTE_TEMPORARY_FILE_DIRECTORY"))
((eq system-type 'windows-nt) null-device)
(t (format "/ssh::%s" temporary-file-directory)))
(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)))
(format "/mock::%s" temporary-file-directory)))
"Temporary directory for Tramp tests.")
(defvar file-notify--test-tmpfile nil)
@ -49,7 +64,6 @@
(defvar file-notify--test-results nil)
(defvar file-notify--test-event nil)
(require 'tramp)
(setq tramp-verbose 0
tramp-message-show-message nil)

View file

@ -21,11 +21,17 @@
;; The tests require a recent ert.el from Emacs 24.4.
;; Some of the tests require access to a remote host files. 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.
;; 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 handler 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.
;; When running the tests in batch mode, it must NOT require an
;; interactive password prompt unless the environment variable
@ -51,7 +57,15 @@
(cond
((getenv "REMOTE_TEMPORARY_FILE_DIRECTORY"))
((eq system-type 'windows-nt) null-device)
(t (format "/ssh::%s" temporary-file-directory)))
(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)))
(format "/mock::%s" temporary-file-directory)))
"Temporary directory for Tramp tests.")
(setq password-cache-expiry nil
@ -127,6 +141,7 @@ eval properly in `should', `should-not' or `should-error'."
(ert-deftest tramp-test00-availability ()
"Test availability of Tramp functions."
:expected-result (if (tramp--test-enabled) :passed :failed)
(message "Remote directory: `%s'" tramp-test-temporary-file-directory)
(should (ignore-errors
(and
(file-remote-p tramp-test-temporary-file-directory)
@ -1589,7 +1604,7 @@ process sentinels. They shall not disturb each other."
(dolist (code
(list
(format
"(expand-file-name %S))"
"(expand-file-name %S)"
tramp-test-temporary-file-directory)
(format
"(let ((default-directory %S)) (expand-file-name %S))"