aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2014-04-24 10:21:58 +0200
committerMichael Albinus2014-04-24 10:21:58 +0200
commitc0b9bc72cc3488a89d774afe94c3a5f630c6f563 (patch)
tree6af49970bf54badb20a22955b12c58a293b27a5f /test
parent00104e59232b9484c897ea441dd25276795a377d (diff)
downloademacs-c0b9bc72cc3488a89d774afe94c3a5f630c6f563.tar.gz
emacs-c0b9bc72cc3488a89d774afe94c3a5f630c6f563.zip
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 @@
12014-04-24 Michael Albinus <michael.albinus@gmx.de>
2
3 * automated/file-notify-tests.el
4 (file-notify-test-remote-temporary-file-directory):
5 * automated/tramp-tests.el (tramp-test-temporary-file-directory):
6 Use a mock-up method as default.
7 (tramp-test00-availability): Print the used directory name.
8 (tramp-test33-recursive-load): Fix typo.
9
12014-04-22 Michael Albinus <michael.albinus@gmx.de> 102014-04-22 Michael Albinus <michael.albinus@gmx.de>
2 11
3 * automated/tramp-tests.el (tramp--test-check-files): Remove traces. 12 * 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 @@
19 19
20;;; Commentary: 20;;; Commentary:
21 21
22;; Some of the tests require access to a remote host files. Set 22;; Some of the tests require access to a remote host files. Since
23;; $REMOTE_TEMPORARY_FILE_DIRECTORY to a suitable value in order 23;; this could be problematic, a mock-up connection method "mock" is
24;; to overwrite the default value. If you want to skip tests 24;; used. Emulating a remote connection, it simply calls "sh -i".
25;; accessing a remote host, set this environment variable to 25;; Tramp's file name handler still run, so this test is sufficient
26;; "/dev/null" or whatever is appropriate on your system. 26;; except for connection establishing.
27
28;; If you want to test a real Tramp connection, set
29;; $REMOTE_TEMPORARY_FILE_DIRECTORY to a suitable value in order to
30;; overwrite the default value. If you want to skip tests accessing a
31;; remote host, set this environment variable to "/dev/null" or
32;; whatever is appropriate on your system.
27 33
28;; When running the tests in batch mode, it must NOT require an 34;; When running the tests in batch mode, it must NOT require an
29;; interactive password prompt unless the environment variable 35;; interactive password prompt unless the environment variable
@@ -35,13 +41,22 @@
35 41
36(require 'ert) 42(require 'ert)
37(require 'filenotify) 43(require 'filenotify)
44(require 'tramp)
38 45
39;; There is no default value on w32 systems, which could work out of the box. 46;; There is no default value on w32 systems, which could work out of the box.
40(defconst file-notify-test-remote-temporary-file-directory 47(defconst file-notify-test-remote-temporary-file-directory
41 (cond 48 (cond
42 ((getenv "REMOTE_TEMPORARY_FILE_DIRECTORY")) 49 ((getenv "REMOTE_TEMPORARY_FILE_DIRECTORY"))
43 ((eq system-type 'windows-nt) null-device) 50 ((eq system-type 'windows-nt) null-device)
44 (t (format "/ssh::%s" temporary-file-directory))) 51 (t (add-to-list
52 'tramp-methods
53 '("mock"
54 (tramp-login-program "sh")
55 (tramp-login-args (("-i")))
56 (tramp-remote-shell "/bin/sh")
57 (tramp-remote-shell-args ("-c"))
58 (tramp-connection-timeout 10)))
59 (format "/mock::%s" temporary-file-directory)))
45 "Temporary directory for Tramp tests.") 60 "Temporary directory for Tramp tests.")
46 61
47(defvar file-notify--test-tmpfile nil) 62(defvar file-notify--test-tmpfile nil)
@@ -49,7 +64,6 @@
49(defvar file-notify--test-results nil) 64(defvar file-notify--test-results nil)
50(defvar file-notify--test-event nil) 65(defvar file-notify--test-event nil)
51 66
52(require 'tramp)
53(setq tramp-verbose 0 67(setq tramp-verbose 0
54 tramp-message-show-message nil) 68 tramp-message-show-message nil)
55 69
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 @@
21 21
22;; The tests require a recent ert.el from Emacs 24.4. 22;; The tests require a recent ert.el from Emacs 24.4.
23 23
24;; Some of the tests require access to a remote host files. Set 24;; Some of the tests require access to a remote host files. Since
25;; $REMOTE_TEMPORARY_FILE_DIRECTORY to a suitable value in order 25;; this could be problematic, a mock-up connection method "mock" is
26;; to overwrite the default value. If you want to skip tests 26;; used. Emulating a remote connection, it simply calls "sh -i".
27;; accessing a remote host, set this environment variable to 27;; Tramp's file name handler still run, so this test is sufficient
28;; "/dev/null" or whatever is appropriate on your system. 28;; except for connection establishing.
29
30;; If you want to test a real Tramp connection, set
31;; $REMOTE_TEMPORARY_FILE_DIRECTORY to a suitable value in order to
32;; overwrite the default value. If you want to skip tests accessing a
33;; remote host, set this environment variable to "/dev/null" or
34;; whatever is appropriate on your system.
29 35
30;; When running the tests in batch mode, it must NOT require an 36;; When running the tests in batch mode, it must NOT require an
31;; interactive password prompt unless the environment variable 37;; interactive password prompt unless the environment variable
@@ -51,7 +57,15 @@
51 (cond 57 (cond
52 ((getenv "REMOTE_TEMPORARY_FILE_DIRECTORY")) 58 ((getenv "REMOTE_TEMPORARY_FILE_DIRECTORY"))
53 ((eq system-type 'windows-nt) null-device) 59 ((eq system-type 'windows-nt) null-device)
54 (t (format "/ssh::%s" temporary-file-directory))) 60 (t (add-to-list
61 'tramp-methods
62 '("mock"
63 (tramp-login-program "sh")
64 (tramp-login-args (("-i")))
65 (tramp-remote-shell "/bin/sh")
66 (tramp-remote-shell-args ("-c"))
67 (tramp-connection-timeout 10)))
68 (format "/mock::%s" temporary-file-directory)))
55 "Temporary directory for Tramp tests.") 69 "Temporary directory for Tramp tests.")
56 70
57(setq password-cache-expiry nil 71(setq password-cache-expiry nil
@@ -127,6 +141,7 @@ eval properly in `should', `should-not' or `should-error'."
127(ert-deftest tramp-test00-availability () 141(ert-deftest tramp-test00-availability ()
128 "Test availability of Tramp functions." 142 "Test availability of Tramp functions."
129 :expected-result (if (tramp--test-enabled) :passed :failed) 143 :expected-result (if (tramp--test-enabled) :passed :failed)
144 (message "Remote directory: `%s'" tramp-test-temporary-file-directory)
130 (should (ignore-errors 145 (should (ignore-errors
131 (and 146 (and
132 (file-remote-p tramp-test-temporary-file-directory) 147 (file-remote-p tramp-test-temporary-file-directory)
@@ -1589,7 +1604,7 @@ process sentinels. They shall not disturb each other."
1589 (dolist (code 1604 (dolist (code
1590 (list 1605 (list
1591 (format 1606 (format
1592 "(expand-file-name %S))" 1607 "(expand-file-name %S)"
1593 tramp-test-temporary-file-directory) 1608 tramp-test-temporary-file-directory)
1594 (format 1609 (format
1595 "(let ((default-directory %S)) (expand-file-name %S))" 1610 "(let ((default-directory %S)) (expand-file-name %S))"