]> code.delx.au - gnu-emacs/commitdiff
Use a mock-up connection method for remote files.
authorMichael Albinus <michael.albinus@gmx.de>
Thu, 24 Apr 2014 08:21:58 +0000 (10:21 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Thu, 24 Apr 2014 08:21:58 +0000 (10:21 +0200)
* 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.

test/ChangeLog
test/automated/file-notify-tests.el
test/automated/tramp-tests.el

index d21f24ff1e8c03ebd3551036855396d251dd7aa0..45844607d34adf95d27f6e40483c0549b63c63c0 100644 (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.
index f1d9aee974cf80c948e366544c5011cc77be165d..f3ad6dfbe26ac5706db861f32335c31b7d81f08f 100644 (file)
 
 ;;; 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
 
 (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)
 
index b6e757d3ae52d9d89f4337564f61767d1cdb68dd..59a7c152a1ae4b30388fc1643a5a388d86ea532b 100644 (file)
 
 ;; 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
   (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))"