aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2025-08-16 12:26:19 +0200
committerMichael Albinus2025-08-16 12:26:19 +0200
commit4a3b6daf76c385fc58759d57aeb4d34e8acc31e5 (patch)
treeac5376da74a115bbb0923cacbed979d9775694d1 /test
parentf8a206937c9f548bd810153bf29f4f4a32d84c95 (diff)
downloademacs-4a3b6daf76c385fc58759d57aeb4d34e8acc31e5.tar.gz
emacs-4a3b6daf76c385fc58759d57aeb4d34e8acc31e5.zip
Sync with Tramp 2.7.4-pre
* doc/misc/trampver.texi: * lisp/net/trampver.el (tramp-version): Adapt Tramp versions. * lisp/net/tramp-cmds.el (tramp-cleanup-connection): Use read syntax #' for `tramp-timeout-session', * lisp/net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection): * lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection): Set "connected" property in time. * lisp/net/tramp-sh.el (tramp-timeout-session): Add ;;;###tramp-autoload cookie. * lisp/net/tramp.el (tramp-barf-if-file-missing): Do not raise an error when not connected. (Bug#78572) (tramp-file-name-handler): Do not force the backtrace. (tramp-connectable-p): Check also, whether initial handshake is finished. (tramp-skeleton-directory-files) (tramp-skeleton-directory-files-and-attributes) (tramp-skeleton-set-file-modes-times-uid-gid): Rearrange sending `file-missing' error. (tramp-handle-access-file, tramp-handle-unlock-file): Use `tramp-connectable-p'. (tramp-skeleton-file-name-all-completions): Filter out "" hits. (Bug#79173) * test/lisp/net/tramp-tests.el (project-mode-line-format) (project-mode-line): Declare. (tramp-test48-session-timeout): New test. (tramp-test49-auto-load, tramp-test49-delay-load) (tramp-test49-recursive-load, tramp-test49-remote-load-path) (tramp-test50-without-remote-files, tramp-test51-unload): Rename.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/tramp-tests.el59
1 files changed, 53 insertions, 6 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 4fe3fca0df8..3013a63e041 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -54,6 +54,7 @@
54(require 'vc-git) 54(require 'vc-git)
55(require 'vc-hg) 55(require 'vc-hg)
56 56
57(declare-function project-mode-line-format "project")
57(declare-function tramp-check-remote-uname "tramp-sh") 58(declare-function tramp-check-remote-uname "tramp-sh")
58(declare-function tramp-find-executable "tramp-sh") 59(declare-function tramp-find-executable "tramp-sh")
59(declare-function tramp-get-remote-chmod-h "tramp-sh") 60(declare-function tramp-get-remote-chmod-h "tramp-sh")
@@ -82,6 +83,7 @@
82(defvar dired-copy-dereference) 83(defvar dired-copy-dereference)
83 84
84;; Declared in Emacs 30. 85;; Declared in Emacs 30.
86(defvar project-mode-line)
85(defvar remote-file-name-access-timeout) 87(defvar remote-file-name-access-timeout)
86(defvar remote-file-name-inhibit-delete-by-moving-to-trash) 88(defvar remote-file-name-inhibit-delete-by-moving-to-trash)
87 89
@@ -8349,8 +8351,53 @@ process sentinels. They shall not disturb each other."
8349 tramp-use-fingerprint) 8351 tramp-use-fingerprint)
8350 (should (file-exists-p ert-remote-temporary-file-directory))))) 8352 (should (file-exists-p ert-remote-temporary-file-directory)))))
8351 8353
8354;; This test is inspired by Bug#78572.
8355(ert-deftest tramp-test48-session-timeout ()
8356 "Check that Tramp handles a session timeout properly."
8357 (skip-unless (tramp--test-enabled))
8358 (skip-unless
8359 (tramp-get-method-parameter tramp-test-vec 'tramp-session-timeout))
8360
8361 ;; We want to see the timeout message.
8362 (tramp--test-instrument-test-case 3
8363 (let ((remote-file-name-inhibit-cache t)
8364 (tmp-name (tramp--test-make-temp-name)))
8365 (unwind-protect
8366 (progn
8367 (should-not (file-exists-p tmp-name))
8368 (write-region "foo" nil tmp-name)
8369 (should (file-exists-p tmp-name))
8370
8371 (tramp-timeout-session tramp-test-vec)
8372 (should (file-exists-p tmp-name))
8373 (should (directory-files (file-name-directory tmp-name)))
8374
8375 ;; `project-mode-line' was introduced in Emacs 30.1.
8376 (when (boundp 'project-mode-line)
8377 (require 'project)
8378 (ert-with-message-capture captured-messages
8379 (let ((project-mode-line t))
8380 (with-temp-buffer
8381 (set-visited-file-name tmp-name)
8382 (insert "foo")
8383 (should (buffer-modified-p))
8384 (tramp-timeout-session tramp-test-vec)
8385 ;; This calls `file-directory-p' and
8386 ;; `directory-files'. Shouldn't raise an error when
8387 ;; not connected.
8388 (project-mode-line-format)
8389 ;; Steal the file lock.
8390 (cl-letf (((symbol-function #'ask-user-about-lock)
8391 #'tramp-compat-always))
8392 (save-buffer)))
8393 (should-not
8394 (string-match-p "File is missing:" captured-messages))))))
8395
8396 ;; Cleanup.
8397 (ignore-errors (delete-file tmp-name))))))
8398
8352;; This test is inspired by Bug#29163. 8399;; This test is inspired by Bug#29163.
8353(ert-deftest tramp-test48-auto-load () 8400(ert-deftest tramp-test49-auto-load ()
8354 "Check that Tramp autoloads properly." 8401 "Check that Tramp autoloads properly."
8355 ;; If we use another syntax but `default', Tramp is already loaded 8402 ;; If we use another syntax but `default', Tramp is already loaded
8356 ;; due to the `tramp-change-syntax' call. 8403 ;; due to the `tramp-change-syntax' call.
@@ -8375,7 +8422,7 @@ process sentinels. They shall not disturb each other."
8375 (mapconcat #'shell-quote-argument load-path " -L ") 8422 (mapconcat #'shell-quote-argument load-path " -L ")
8376 (shell-quote-argument code))))))) 8423 (shell-quote-argument code)))))))
8377 8424
8378(ert-deftest tramp-test48-delay-load () 8425(ert-deftest tramp-test49-delay-load ()
8379 "Check that Tramp is loaded lazily, only when needed." 8426 "Check that Tramp is loaded lazily, only when needed."
8380 ;; Tramp is neither loaded at Emacs startup, nor when completing a 8427 ;; Tramp is neither loaded at Emacs startup, nor when completing a
8381 ;; non-Tramp file name like "/foo". Completing a Tramp-alike file 8428 ;; non-Tramp file name like "/foo". Completing a Tramp-alike file
@@ -8405,7 +8452,7 @@ process sentinels. They shall not disturb each other."
8405 (mapconcat #'shell-quote-argument load-path " -L ") 8452 (mapconcat #'shell-quote-argument load-path " -L ")
8406 (shell-quote-argument (format code tm))))))))) 8453 (shell-quote-argument (format code tm)))))))))
8407 8454
8408(ert-deftest tramp-test48-recursive-load () 8455(ert-deftest tramp-test49-recursive-load ()
8409 "Check that Tramp does not fail due to recursive load." 8456 "Check that Tramp does not fail due to recursive load."
8410 (skip-unless (tramp--test-enabled)) 8457 (skip-unless (tramp--test-enabled))
8411 8458
@@ -8429,7 +8476,7 @@ process sentinels. They shall not disturb each other."
8429 (mapconcat #'shell-quote-argument load-path " -L ") 8476 (mapconcat #'shell-quote-argument load-path " -L ")
8430 (shell-quote-argument code)))))))) 8477 (shell-quote-argument code))))))))
8431 8478
8432(ert-deftest tramp-test48-remote-load-path () 8479(ert-deftest tramp-test49-remote-load-path ()
8433 "Check that Tramp autoloads its packages with remote `load-path'." 8480 "Check that Tramp autoloads its packages with remote `load-path'."
8434 ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el. 8481 ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el.
8435 ;; It shall still work, when a remote file name is in the 8482 ;; It shall still work, when a remote file name is in the
@@ -8454,7 +8501,7 @@ process sentinels. They shall not disturb each other."
8454 (mapconcat #'shell-quote-argument load-path " -L ") 8501 (mapconcat #'shell-quote-argument load-path " -L ")
8455 (shell-quote-argument code))))))) 8502 (shell-quote-argument code)))))))
8456 8503
8457(ert-deftest tramp-test49-without-remote-files () 8504(ert-deftest tramp-test50-without-remote-files ()
8458 "Check that Tramp can be suppressed." 8505 "Check that Tramp can be suppressed."
8459 (skip-unless (tramp--test-enabled)) 8506 (skip-unless (tramp--test-enabled))
8460 8507
@@ -8469,7 +8516,7 @@ process sentinels. They shall not disturb each other."
8469 (setq tramp-mode t) 8516 (setq tramp-mode t)
8470 (should (file-remote-p ert-remote-temporary-file-directory))) 8517 (should (file-remote-p ert-remote-temporary-file-directory)))
8471 8518
8472(ert-deftest tramp-test50-unload () 8519(ert-deftest tramp-test51-unload ()
8473 "Check that Tramp and its subpackages unload completely. 8520 "Check that Tramp and its subpackages unload completely.
8474Since it unloads Tramp, it shall be the last test to run." 8521Since it unloads Tramp, it shall be the last test to run."
8475 :tags '(:expensive-test) 8522 :tags '(:expensive-test)