emacs-diffs
[Top][All Lists]
Advanced

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

master ef65d71: Tramp code cleanup


From: Michael Albinus
Subject: master ef65d71: Tramp code cleanup
Date: Sat, 11 Sep 2021 09:35:58 -0400 (EDT)

branch: master
commit ef65d717d0a1eeb6530176b59aa03cd09efb5fa9
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Tramp code cleanup
    
    * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-make-directory): Simplify.
    
    * lisp/net/tramp-sh.el (tramp-methods) <telnet, nc>: Don't use
    "%n" marker.
    
    * test/lisp/net/tramp-tests.el (tramp-test13-make-directory): Merge with
    `tramp-test-make-directory-helper' and
    `tramp-test13-make-directory-with-file-modes'.
    (tramp-test44-asynchronous-requests): Use always the same
    operation in timer.
---
 lisp/net/tramp-gvfs.el       |  8 ++++----
 lisp/net/tramp-sh.el         |  4 ++--
 test/lisp/net/tramp-tests.el | 45 +++++++++++++-------------------------------
 3 files changed, 19 insertions(+), 38 deletions(-)

diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index eb889bb..25deead 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1574,10 +1574,10 @@ If FILE-SYSTEM is non-nil, return file system 
attributes."
        (when (and parents (not (file-directory-p ldir)))
          (make-directory ldir parents))
        ;; Just do it.
-       (or (let ((mkdir-succeeded
-                  (tramp-gvfs-send-command
-                   v "gvfs-mkdir" (tramp-gvfs-url-file-name dir))))
-             (if mkdir-succeeded (set-file-modes dir (default-file-modes)))
+       (or (when-let ((mkdir-succeeded
+                       (tramp-gvfs-send-command
+                        v "gvfs-mkdir" (tramp-gvfs-url-file-name dir))))
+             (set-file-modes dir (default-file-modes))
              mkdir-succeeded)
            (and parents (file-directory-p dir))
            (tramp-error v 'file-error "Couldn't make directory %s" dir))))))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index e57145e..dc04978 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -244,14 +244,14 @@ The string is used in `tramp-methods'.")
  (add-to-list 'tramp-methods
               `("telnet"
                 (tramp-login-program        "telnet")
-                (tramp-login-args           (("%h") ("%p") ("%n")))
+                (tramp-login-args           (("%h") ("%p")))
                 (tramp-remote-shell         ,tramp-default-remote-shell)
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))))
  (add-to-list 'tramp-methods
               `("nc"
                 (tramp-login-program        "telnet")
-                (tramp-login-args           (("%h") ("%p") ("%n")))
+                (tramp-login-args           (("%h") ("%p")))
                 (tramp-remote-shell         ,tramp-default-remote-shell)
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 393302d..af4f45d 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2765,12 +2765,12 @@ This checks also `file-name-as-directory', 
`file-name-directory',
            (ignore-errors (delete-directory source 'recursive))
            (ignore-errors (delete-directory target 'recursive))))))))
 
-(defun tramp-test-make-directory-helper (test-default-file-modes-p)
-  "Helper test used by tramp-test13-make-directory* tests."
-  (dolist (quoted (if (and (tramp--test-expensive-test)
-                           (not test-default-file-modes-p))
-                      '(nil t)
-                    '(nil)))
+(ert-deftest tramp-test13-make-directory ()
+  "Check `make-directory'.
+This tests also `file-directory-p' and `file-accessible-directory-p'."
+  (skip-unless (tramp--test-enabled))
+
+  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
     (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
           (tmp-name2 (expand-file-name "foo/bar" tmp-name1))
           (unusual-file-mode-1 #o740)
@@ -2784,9 +2784,9 @@ This checks also `file-name-as-directory', 
`file-name-directory',
             :type 'file-already-exists)
            (should (file-directory-p tmp-name1))
            (should (file-accessible-directory-p tmp-name1))
-           (and test-default-file-modes-p
-                (should (equal (format "%#o" unusual-file-mode-1)
-                               (format "%#o" (file-modes tmp-name1)))))
+           (when (tramp--test-supports-file-modes-p)
+             (should (equal (format "%#o" unusual-file-mode-1)
+                            (format "%#o" (file-modes tmp-name1)))))
            (should-error
             (make-directory tmp-name2)
             :type 'file-error)
@@ -2794,9 +2794,9 @@ This checks also `file-name-as-directory', 
`file-name-directory',
              (make-directory tmp-name2 'parents))
            (should (file-directory-p tmp-name2))
            (should (file-accessible-directory-p tmp-name2))
-           (and test-default-file-modes-p
-                (should (equal (format "%#o" unusual-file-mode-2)
-                               (format "%#o" (file-modes tmp-name2)))))
+           (when (tramp--test-supports-file-modes-p)
+             (should (equal (format "%#o" unusual-file-mode-2)
+                            (format "%#o" (file-modes tmp-name2)))))
            ;; If PARENTS is non-nil, `make-directory' shall not
            ;; signal an error when DIR exists already.
            (make-directory tmp-name2 'parents))
@@ -2804,20 +2804,6 @@ This checks also `file-name-as-directory', 
`file-name-directory',
        ;; Cleanup.
        (ignore-errors (delete-directory tmp-name1 'recursive))))))
 
-(ert-deftest tramp-test13-make-directory ()
-  "Check `make-directory'.
-This tests also `file-directory-p' and `file-accessible-directory-p'."
-  (skip-unless (tramp--test-enabled))
-  (tramp-test-make-directory-helper nil))
-
-(ert-deftest tramp-test13-make-directory-with-file-modes ()
-  "Check that `make-directory' honors `default-file-modes'.
-This is a separate test from `tramp-test13-make-directory' so
-it can be skipped for backends that do not support file modes."
-  (skip-unless (tramp--test-enabled))
-  (skip-unless (tramp--test-supports-file-modes-p))
-  (tramp-test-make-directory-helper t))
-
 (ert-deftest tramp-test14-delete-directory ()
   "Check `delete-directory'."
   (skip-unless (tramp--test-enabled))
@@ -6763,11 +6749,6 @@ process sentinels.  They shall not disturb each other."
             (cond
              ((getenv "EMACS_HYDRA_CI") 10)
              (t 1)))
-           ;; We must distinguish due to performance reasons.
-           (timer-operation
-            (cond
-             ((tramp--test-mock-p) #'vc-registered)
-             (t #'file-attributes)))
           ;; This is when all timers start.  We check inside the
           ;; timer function, that we don't exceed timeout.
           (timer-start (current-time))
@@ -6803,7 +6784,7 @@ process sentinels.  They shall not disturb each other."
                           (cons 'remote-file-error debug-ignored-errors)))
                       (tramp--test-message
                        "Start timer %s %s" file (current-time-string))
-                     (funcall timer-operation file)
+                     (vc-registered file)
                       (tramp--test-message
                        "Stop timer %s %s" file (current-time-string))
                       ;; Adjust timer if it takes too much time.



reply via email to

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