summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2014-04-24 10:21:58 +0200
committerMichael Albinus <michael.albinus@gmx.de>2014-04-24 10:21:58 +0200
commitc0b9bc72cc3488a89d774afe94c3a5f630c6f563 (patch)
tree6af49970bf54badb20a22955b12c58a293b27a5f /test
parent00104e59232b9484c897ea441dd25276795a377d (diff)
downloademacs-c0b9bc72cc3488a89d774afe94c3a5f630c6f563.tar.gz
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.
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog9
-rw-r--r--test/automated/file-notify-tests.el28
-rw-r--r--test/automated/tramp-tests.el29
3 files changed, 52 insertions, 14 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index d21f24ff1e8..45844607d34 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -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.
diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el
index f1d9aee974c..f3ad6dfbe26 100644
--- a/test/automated/file-notify-tests.el
+++ b/test/automated/file-notify-tests.el
@@ -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)
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el
index b6e757d3ae5..59a7c152a1a 100644
--- a/test/automated/tramp-tests.el
+++ b/test/automated/tramp-tests.el
@@ -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))"