emacs-diffs
[Top][All Lists]
Advanced

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

emacs-28 0010315 2/2: Some Tramp changes, mainly in tramp-tests.el


From: Michael Albinus
Subject: emacs-28 0010315 2/2: Some Tramp changes, mainly in tramp-tests.el
Date: Fri, 29 Oct 2021 08:06:58 -0400 (EDT)

branch: emacs-28
commit 00103154e080966d52e1a277f8523815b6ea60d7
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Some Tramp changes, mainly in tramp-tests.el
    
    * doc/misc/tramp.texi (External packages): Don't use Tramp internals.
    
    * lisp/net/tramp-gvfs.el (tramp-gvfs-handler-mounted-unmounted):
    Protect `tramp-make-tramp-file-name' call.
    
    * lisp/net/tramp.el (tramp-make-tramp-file-name): Set advertised
    calling conventions.
    
    * test/lisp/net/tramp-tests.el (tramp-test18-file-attributes):
    Adapt test.
    (tramp--test-supports-processes-p): New defun.
    (tramp-test28-process-file, tramp-test29-start-file-process)
    (tramp-test30-make-process, tramp-test32-shell-command)
    (tramp-test32-shell-command-dont-erase-buffer)
    (tramp-test34-explicit-shell-file-name, tramp-test35-exec-path)
    (tramp-test44-asynchronous-requests): Use it.
---
 doc/misc/tramp.texi          |  6 +++++
 lisp/net/tramp-gvfs.el       |  6 ++++-
 lisp/net/tramp.el            |  3 +++
 test/lisp/net/tramp-tests.el | 56 +++++++++++++++++++++++---------------------
 4 files changed, 43 insertions(+), 28 deletions(-)

diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 4e95b12..a17a8d6 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -5329,6 +5329,12 @@ handlers.
 
 @node External packages
 @section Integrating with external Lisp packages
+
+In general, it is not recommended to use @value{tramp} functions and
+variables not described in this manual.  They might change their
+signature and/or semantics without any announcement.
+
+
 @subsection File name completion
 
 @vindex non-essential
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index ebe57a8..7e22639 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1866,7 +1866,11 @@ Their full names are 
\"org.gtk.vfs.MountTracker.mounted\" and
                    port (tramp-file-name-port v)))))
        (when (member method tramp-gvfs-methods)
          (with-parsed-tramp-file-name
-             (tramp-make-tramp-file-name method user domain host port "") nil
+             ;; This must be changed when we throw the old signature
+             ;; away in Emacs 27.1 and higher.
+             (with-no-warnings
+               (tramp-make-tramp-file-name method user domain host port ""))
+             nil
            (tramp-message
             v 6 "%s %s"
             signal-name (tramp-gvfs-stringify-dbus-message mount-info))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 372e0a2..b152584 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1758,6 +1758,9 @@ the form (METHOD USER DOMAIN HOST PORT LOCALNAME 
&optional HOP)."
            tramp-postfix-host-format
            localname)))
 
+(set-advertised-calling-convention
+ #'tramp-make-tramp-file-name '(vec &optional localname hop) "27.1")
+
 (defun tramp-make-tramp-hop-name (vec)
   "Construct a Tramp hop name from VEC."
   (replace-regexp-in-string
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index d50111d..47ef46f 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -3385,17 +3385,16 @@ This tests also `access-file', `file-readable-p',
                       (tramp-get-remote-gid tramp-test-vec 'integer)))
              (delete-file tmp-name1))
 
-           (when (and (tramp--test-supports-set-file-modes-p)
-                      ;; A file is always accessible for user "root".
-                      (not (zerop (tramp-compat-file-attribute-user-id
-                                   (file-attributes
-                                    tramp-test-temporary-file-directory)))))
+           (when (tramp--test-supports-set-file-modes-p)
              (write-region "foo" nil tmp-name1)
-             (set-file-modes tmp-name1 0)
-             (should-error
-              (access-file tmp-name1 "error")
-              :type 'file-error)
-             (set-file-modes tmp-name1 #o777)
+             ;; A file is always accessible for user "root".
+             (when (not (zerop (tramp-compat-file-attribute-user-id
+                                (file-attributes tmp-name1))))
+               (set-file-modes tmp-name1 0)
+               (should-error
+                (access-file tmp-name1 "error")
+                :type 'file-error)
+               (set-file-modes tmp-name1 #o777))
              (delete-file tmp-name1))
            (should-error
             (access-file tmp-name1 "error")
@@ -4443,8 +4442,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
   "Check `process-file'."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
-  (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p) 
(tramp--test-sshfs-p)))
-  (skip-unless (not (tramp--test-crypt-p)))
+  (skip-unless (tramp--test-supports-processes-p))
 
   (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
     (let* ((tmp-name (tramp--test-make-temp-name nil quoted))
@@ -4524,8 +4522,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
   "Check `start-file-process'."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
-  (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p) 
(tramp--test-sshfs-p)))
-  (skip-unless (not (tramp--test-crypt-p)))
+  (skip-unless (tramp--test-supports-processes-p))
 
   (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
     (let ((default-directory tramp-test-temporary-file-directory)
@@ -4704,8 +4701,7 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
   "Check `make-process'."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
-  (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p) 
(tramp--test-sshfs-p)))
-  (skip-unless (not (tramp--test-crypt-p)))
+  (skip-unless (tramp--test-supports-processes-p))
   ;; `make-process' supports file name handlers since Emacs 27.
   (skip-unless (tramp--test-emacs27-p))
 
@@ -5008,11 +5004,11 @@ INPUT, if non-nil, is a string sent to the process."
   "Check `shell-command'."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
+  (skip-unless (tramp--test-supports-processes-p))
   ;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for
   ;; remote processes in Emacs.  That doesn't work for tramp-adb.el.
-  (skip-unless (or (and (tramp--test-adb-p) (tramp--test-emacs27-p))
-                  (tramp--test-sh-p) (tramp--test-sshfs-p)))
-  (skip-unless (not (tramp--test-crypt-p)))
+  (when (tramp--test-adb-p)
+    (skip-unless (tramp--test-emacs27-p)))
 
   (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
     (let ((tmp-name (tramp--test-make-temp-name nil quoted))
@@ -5110,8 +5106,7 @@ INPUT, if non-nil, is a string sent to the process."
   :tags '(:expensive-test :unstable)
   (skip-unless (tramp--test-enabled))
   (skip-unless nil)
-  (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p) 
(tramp--test-sshfs-p)))
-  (skip-unless (not (tramp--test-crypt-p)))
+  (skip-unless (tramp--test-supports-processes-p))
   ;; Prior Emacs 27, `shell-command-dont-erase-buffer' wasn't working properly.
   (skip-unless (tramp--test-emacs27-p))
 
@@ -5432,11 +5427,11 @@ Use direct async.")
   "Check that connection-local `explicit-shell-file-name' is set."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
+  (skip-unless (tramp--test-supports-processes-p))
   ;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for
   ;; remote processes in Emacs.  That doesn't work for tramp-adb.el.
-  (skip-unless (or (and (tramp--test-adb-p) (tramp--test-emacs27-p))
-                  (tramp--test-sh-p) (tramp--test-sshfs-p)))
-  (skip-unless (not (tramp--test-crypt-p)))
+  (when (tramp--test-adb-p)
+    (skip-unless (tramp--test-emacs27-p)))
   ;; Since Emacs 26.1.
   (skip-unless (and (fboundp 'connection-local-set-profile-variables)
                    (fboundp 'connection-local-set-profiles)))
@@ -5491,6 +5486,7 @@ Use direct async.")
 (ert-deftest tramp-test35-exec-path ()
   "Check `exec-path' and `executable-find'."
   (skip-unless (tramp--test-enabled))
+  (skip-unless (tramp--test-supports-processes-p))
   (skip-unless (tramp--test-supports-set-file-modes-p))
   ;; Since Emacs 27.1.
   (skip-unless (fboundp 'exec-path))
@@ -6270,6 +6266,11 @@ This requires restrictions of file name syntax."
 This requires restrictions of file name syntax."
   (tramp-smb-file-name-p tramp-test-temporary-file-directory))
 
+(defun tramp--test-supports-processes-p ()
+  "Return whether the method under test supports external processes."
+  (and (or (tramp--test-adb-p) (tramp--test-sh-p) (tramp--test-sshfs-p))
+       (not (tramp--test-crypt-p))))
+
 (defun tramp--test-supports-set-file-modes-p ()
   "Return whether the method under test supports setting file modes."
   ;; "smb" does not unless the SMB server supports "posix" extensions.
@@ -6801,13 +6802,14 @@ process sentinels.  They shall not disturb each other."
   :tags (if (getenv "EMACS_EMBA_CI")
            '(:expensive-test :unstable) '(:expensive-test))
   (skip-unless (tramp--test-enabled))
+  (skip-unless (tramp--test-supports-processes-p))
   ;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for
   ;; remote processes in Emacs.  That doesn't work for tramp-adb.el.
-  (skip-unless (or (and (tramp--test-adb-p) (tramp--test-emacs27-p))
-                  (tramp--test-sh-p)))
-  (skip-unless (not (tramp--test-crypt-p)))
+  (when (tramp--test-adb-p)
+    (skip-unless (tramp--test-emacs27-p)))
   (skip-unless (not (tramp--test-docker-p)))
   (skip-unless (not (tramp--test-telnet-p)))
+  (skip-unless (not (tramp--test-sshfs-p)))
   (skip-unless (not (tramp--test-windows-nt-p)))
 
   (with-timeout



reply via email to

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