emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 49197e6: Add Tramp test


From: Michael Albinus
Subject: [Emacs-diffs] master 49197e6: Add Tramp test
Date: Mon, 3 Apr 2017 08:04:13 -0400 (EDT)

branch: master
commit 49197e6e3d30a4da91d5f18041dd125ac327592a
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Add Tramp test
    
    * doc/misc/tramp.texi (Remote processes): Fix typo.
    
    * lisp/shell.el (shell): Fix typo.
    
    * lisp/net/tramp.el (tramp-set-connection-local-variables): Simplify.
    
    * test/lisp/net/tramp-tests.el (tramp-test30-explicit-shell-file-name):
    New test.
    (tramp--test-special-characters, tramp--test-utf8): Adapt docstring.
    (tramp-test31-vc-registered)
    (tramp-test32-make-auto-save-file-name)
    (tramp-test33-make-nearby-temp-file)
    (tramp-test34-special-characters)
    (tramp-test34-special-characters-with-stat)
    (tramp-test34-special-characters-with-perl)
    (tramp-test34-special-characters-with-ls, tramp-test35-utf8)
    (tramp-test35-utf8-with-stat, tramp-test35-utf8-with-perl)
    (tramp-test35-utf8-with-ls)
    (tramp-test36-asynchronous-requests)
    (tramp-test37-recursive-load, tramp-test38-unload): Rename.
---
 doc/misc/tramp.texi          |  4 +--
 lisp/net/tramp.el            | 12 +++----
 lisp/shell.el                |  2 +-
 test/lisp/net/tramp-tests.el | 82 ++++++++++++++++++++++++++++++++++----------
 4 files changed, 70 insertions(+), 30 deletions(-)

diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 8e04d69..b19836d 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -2523,13 +2523,13 @@ different remote hosts.
 
 @group
 (connection-local-set-profiles
-  '(:application 'tramp :protocol "ssh" :machine "localhost")
+  '(:application tramp :protocol "ssh" :machine "localhost")
   'remote-bash)
 @end group
 
 @group
 (connection-local-set-profiles
-  `(:application 'tramp :protocol "sudo"
+  `(:application tramp :protocol "sudo"
     :user "root" :machine ,(system-name))
   'remote-ksh)
 @end group
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 0ca5a6d..1786355 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1347,14 +1347,10 @@ version, the function does nothing."
     ;; `hack-connection-local-variables-apply' exists since Emacs 26.1.
     (tramp-compat-funcall
      'hack-connection-local-variables-apply
-     (append
-      '(tramp)
-      (when (tramp-file-name-method vec)
-        `(:protocol ,(tramp-file-name-method vec)))
-      (when (tramp-file-name-user vec)
-        `(:user ,(tramp-file-name-user vec)))
-      (when (tramp-file-name-host vec)
-        `(:machine ,(tramp-file-name-host vec)))))))
+     `(:application tramp
+       :protocol    ,(tramp-file-name-method vec)
+       :user        ,(tramp-file-name-user vec)
+       :machine     ,(tramp-file-name-host vec)))))
 
 (defun tramp-debug-buffer-name (vec)
   "A name for the debug buffer for VEC."
diff --git a/lisp/shell.el b/lisp/shell.el
index 55a0532..e03ccbb 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -715,7 +715,7 @@ Otherwise, one argument `-i' is passed to the shell.
     (when (file-remote-p default-directory)
       ;; Apply connection-local variables.
       (hack-connection-local-variables-apply
-       `(:application 'tramp
+       `(:application tramp
          :protocol ,(file-remote-p default-directory 'method)
          :user ,(file-remote-p default-directory 'user)
          :machine ,(file-remote-p default-directory 'host)))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 2a4ef74..ba00a96 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -1912,7 +1912,51 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
                (regexp-quote envvar)
                (funcall this-shell-command-to-string "set")))))))))
 
-(ert-deftest tramp-test30-vc-registered ()
+;; The functions were introduced in Emacs 26.1.
+(ert-deftest tramp-test30-explicit-shell-file-name ()
+  "Check that connection-local `explicit-shell-file-name' is set."
+  :tags '(:expensive-test)
+  (skip-unless (tramp--test-enabled))
+  (skip-unless (tramp--test-sh-p))
+  (skip-unless (and (fboundp 'connection-local-set-profile-variables)
+                   (fboundp 'connection-local-set-profiles)))
+
+  ;; `connection-local-set-profile-variables' and
+  ;; `connection-local-set-profiles' exists since Emacs 26.  We don't
+  ;; want to see compiler warnings for older Emacsen.
+  (let ((default-directory tramp-test-temporary-file-directory)
+       explicit-shell-file-name kill-buffer-query-functions)
+    (unwind-protect
+       (progn
+         ;; `shell-mode' would ruin our test, because it deletes all
+         ;; buffer local variables.
+         (put 'explicit-shell-file-name 'permanent-local t)
+         ;; Declare connection-local variable `explicit-shell-file-name'.
+         (with-no-warnings
+           (connection-local-set-profile-variables
+            'remote-sh
+            '((explicit-shell-file-name . "/bin/sh")
+              (explicit-sh-args . ("-i"))))
+           (connection-local-set-profiles
+            `(:application tramp
+              :protocol ,(file-remote-p default-directory 'method)
+              :user ,(file-remote-p default-directory 'user)
+              :machine ,(file-remote-p default-directory 'host))
+            'remote-sh))
+
+         ;; Run interactive shell.  Since the default directory is
+         ;; remote, `explicit-shell-file-name' shall be set in order
+         ;; to avoid a question.
+         (with-current-buffer (get-buffer-create "*shell*")
+           (ignore-errors (kill-process (current-buffer)))
+           (should-not explicit-shell-file-name)
+           (call-interactively 'shell)
+           (should explicit-shell-file-name)))
+
+      (put 'explicit-shell-file-name 'permanent-local nil)
+      (kill-buffer "*shell*"))))
+
+(ert-deftest tramp-test31-vc-registered ()
   "Check `vc-registered'."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
@@ -1983,7 +2027,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
        ;; Cleanup.
        (ignore-errors (delete-directory tmp-name1 'recursive))))))
 
-(ert-deftest tramp-test31-make-auto-save-file-name ()
+(ert-deftest tramp-test32-make-auto-save-file-name ()
   "Check `make-auto-save-file-name'."
   (skip-unless (tramp--test-enabled))
 
@@ -2078,7 +2122,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
        (ignore-errors (delete-directory tmp-name2 'recursive))))))
 
 ;; The functions were introduced in Emacs 26.1.
-(ert-deftest tramp-test32-make-nearby-temp-file ()
+(ert-deftest tramp-test33-make-nearby-temp-file ()
   "Check `make-nearby-temp-file' and `temporary-file-directory'."
   (skip-unless (tramp--test-enabled))
   (skip-unless
@@ -2086,7 +2130,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
 
   ;; `make-nearby-temp-file' and `temporary-file-directory' exists
   ;; since Emacs 26.  We don't want to see compiler warnings for older
-  ;; Emacsen."
+  ;; Emacsen.
   (let ((default-directory tramp-test-temporary-file-directory)
        tmp-file)
     ;; The remote host shall know a temporary file directory.
@@ -2343,7 +2387,7 @@ This requires restrictions of file name syntax."
        (ignore-errors (delete-directory tmp-name2 'recursive))))))
 
 (defun tramp--test-special-characters ()
-  "Perform the test in `tramp-test33-special-characters*'."
+  "Perform the test in `tramp-test34-special-characters*'."
   ;; Newlines, slashes and backslashes in file names are not
   ;; supported.  So we don't test.  And we don't test the tab
   ;; character on Windows or Cygwin, because the backslash is
@@ -2386,7 +2430,7 @@ This requires restrictions of file name syntax."
    "{foo}bar{baz}"))
 
 ;; These tests are inspired by Bug#17238.
-(ert-deftest tramp-test33-special-characters ()
+(ert-deftest tramp-test34-special-characters ()
   "Check special characters in file names."
   (skip-unless (tramp--test-enabled))
   (skip-unless (not (tramp--test-rsync-p)))
@@ -2394,7 +2438,7 @@ This requires restrictions of file name syntax."
 
   (tramp--test-special-characters))
 
-(ert-deftest tramp-test33-special-characters-with-stat ()
+(ert-deftest tramp-test34-special-characters-with-stat ()
   "Check special characters in file names.
 Use the `stat' command."
   :tags '(:expensive-test)
@@ -2412,7 +2456,7 @@ Use the `stat' command."
          tramp-connection-properties)))
     (tramp--test-special-characters)))
 
-(ert-deftest tramp-test33-special-characters-with-perl ()
+(ert-deftest tramp-test34-special-characters-with-perl ()
   "Check special characters in file names.
 Use the `perl' command."
   :tags '(:expensive-test)
@@ -2433,7 +2477,7 @@ Use the `perl' command."
          tramp-connection-properties)))
     (tramp--test-special-characters)))
 
-(ert-deftest tramp-test33-special-characters-with-ls ()
+(ert-deftest tramp-test34-special-characters-with-ls ()
   "Check special characters in file names.
 Use the `ls' command."
   :tags '(:expensive-test)
@@ -2456,7 +2500,7 @@ Use the `ls' command."
     (tramp--test-special-characters)))
 
 (defun tramp--test-utf8 ()
-  "Perform the test in `tramp-test34-utf8*'."
+  "Perform the test in `tramp-test35-utf8*'."
   (let* ((utf8 (if (and (eq system-type 'darwin)
                        (memq 'utf-8-hfs (coding-system-list)))
                   'utf-8-hfs 'utf-8))
@@ -2470,7 +2514,7 @@ Use the `ls' command."
      "银河系漫游指南系列"
      "Автостопом по гала́ктике")))
 
-(ert-deftest tramp-test34-utf8 ()
+(ert-deftest tramp-test35-utf8 ()
   "Check UTF8 encoding in file names and file contents."
   (skip-unless (tramp--test-enabled))
   (skip-unless (not (tramp--test-docker-p)))
@@ -2480,7 +2524,7 @@ Use the `ls' command."
 
   (tramp--test-utf8))
 
-(ert-deftest tramp-test34-utf8-with-stat ()
+(ert-deftest tramp-test35-utf8-with-stat ()
   "Check UTF8 encoding in file names and file contents.
 Use the `stat' command."
   :tags '(:expensive-test)
@@ -2500,7 +2544,7 @@ Use the `stat' command."
          tramp-connection-properties)))
     (tramp--test-utf8)))
 
-(ert-deftest tramp-test34-utf8-with-perl ()
+(ert-deftest tramp-test35-utf8-with-perl ()
   "Check UTF8 encoding in file names and file contents.
 Use the `perl' command."
   :tags '(:expensive-test)
@@ -2523,7 +2567,7 @@ Use the `perl' command."
          tramp-connection-properties)))
     (tramp--test-utf8)))
 
-(ert-deftest tramp-test34-utf8-with-ls ()
+(ert-deftest tramp-test35-utf8-with-ls ()
   "Check UTF8 encoding in file names and file contents.
 Use the `ls' command."
   :tags '(:expensive-test)
@@ -2547,7 +2591,7 @@ Use the `ls' command."
     (tramp--test-utf8)))
 
 ;; This test is inspired by Bug#16928.
-(ert-deftest tramp-test35-asynchronous-requests ()
+(ert-deftest tramp-test36-asynchronous-requests ()
   "Check parallel asynchronous requests.
 Such requests could arrive from timers, process filters and
 process sentinels.  They shall not disturb each other."
@@ -2636,7 +2680,7 @@ process sentinels.  They shall not disturb each other."
        (dolist (buf buffers)
          (ignore-errors (kill-buffer buf))))))))
 
-(ert-deftest tramp-test36-recursive-load ()
+(ert-deftest tramp-test37-recursive-load ()
   "Check that Tramp does not fail due to recursive load."
   (skip-unless (tramp--test-enabled))
 
@@ -2657,7 +2701,7 @@ process sentinels.  They shall not disturb each other."
        (mapconcat 'shell-quote-argument load-path " -L ")
        (shell-quote-argument code)))))))
 
-(ert-deftest tramp-test37-unload ()
+(ert-deftest tramp-test38-unload ()
   "Check that Tramp and its subpackages unload completely.
 Since it unloads Tramp, it shall be the last test to run."
   ;; Mark as failed until all symbols are unbound.
@@ -2704,8 +2748,8 @@ Since it unloads Tramp, it shall be the last test to run."
 ;; * Work on skipped tests.  Make a comment, when it is impossible.
 ;; * Fix `tramp-test06-directory-file-name' for `ftp'.
 ;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?).
-;; * Fix Bug#16928.  Set expected error of 
`tramp-test35-asynchronous-requests'.
-;; * Fix `tramp-test37-unload' (Not all symbols are unbound).  Set
+;; * Fix Bug#16928.  Set expected error of 
`tramp-test36-asynchronous-requests'.
+;; * Fix `tramp-test38-unload' (Not all symbols are unbound).  Set
 ;;   expected error.
 
 (defun tramp-test-all (&optional interactive)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]