; Tramp test fixes

* test/lisp/net/tramp-tests.el
(tramp-test26-interactive-file-name-completion): Simplify.
(tramp--test-putty-p): Fix docstring.
(tramp--test-scp-p): New defun.
(tramp-test42-utf8): Use it.
This commit is contained in:
Michael Albinus 2025-05-15 15:15:22 +02:00
parent f0ac271da3
commit 16bfbc6fe3

View file

@ -5096,9 +5096,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(dolist (dolist
(test-and-result (test-and-result
;; These are triples of strings (TEST-STRING ;; These are triples of strings (TEST-STRING
;; RESULT-CHECK COMPLETION-CHECK). RESULT-CHECK ;; RESULT-CHECK COMPLETION-CHECK).
;; could be not unique, in this case it is a list
;; (RESULT1 RESULT2 ...).
(append (append
;; Complete method name. ;; Complete method name.
(unless (string-empty-p tramp-method-regexp) (unless (string-empty-p tramp-method-regexp)
@ -5124,11 +5122,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
ipv6-prefix ipv6-prefix
(substring-no-properties (substring-no-properties
host 0 (min 2 (length host)))) host 0 (min 2 (length host))))
(,(concat ,(concat
tramp-prefix-format hop method-string host-string) tramp-prefix-format hop method-string
,(concat default-user-string host-string)
tramp-prefix-format hop method-string
default-user-string host-string))
,host-string))) ,host-string)))
;; Complete user and host name. ;; Complete user and host name.
(unless (or (tramp-string-empty-or-nil-p user) (unless (or (tramp-string-empty-or-nil-p user)
@ -5169,14 +5165,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
;; (tramp--test-message ;; (tramp--test-message
;; "syntax: %s style: %s test: %s result: %s" ;; "syntax: %s style: %s test: %s result: %s"
;; syntax style test result) ;; syntax style test result)
(if (stringp (cadr test-and-result)) (should (string-prefix-p (cadr test-and-result) result)))
(should
(string-prefix-p (cadr test-and-result) result))
(should
(let (res)
(dolist (elem (cadr test-and-result) res)
(setq
res (or res (string-prefix-p elem result))))))))
(with-current-buffer "*Completions*" (with-current-buffer "*Completions*"
;; We must remove leading `default-directory'. ;; We must remove leading `default-directory'.
@ -7379,7 +7368,7 @@ This does not support external Emacs calls."
(tramp-method-out-of-band-p tramp-test-vec 1)) (tramp-method-out-of-band-p tramp-test-vec 1))
(defun tramp--test-putty-p () (defun tramp--test-putty-p ()
"Check, whether the method method usaes PuTTY. "Check, whether the method uses PuTTY.
This does not support connection share for more than two connections." This does not support connection share for more than two connections."
(member (member
(file-remote-p ert-remote-temporary-file-directory 'method) (file-remote-p ert-remote-temporary-file-directory 'method)
@ -7396,6 +7385,15 @@ This does not support special file names."
(string-equal (string-equal
"rsync" (file-remote-p ert-remote-temporary-file-directory 'method))) "rsync" (file-remote-p ert-remote-temporary-file-directory 'method)))
(defun tramp--test-scp-p ()
"Check, whether an scp method is used.
This does not support quoted special characters in recent sshd
implementations."
;; Detected with OpenSSH_9.9p1.
(member
(file-remote-p ert-remote-temporary-file-directory 'method)
'("pscp" "scp" "scpx")))
(defun tramp--test-sh-p () (defun tramp--test-sh-p ()
"Check, whether the remote host runs a based method from tramp-sh.el." "Check, whether the remote host runs a based method from tramp-sh.el."
(tramp-sh-file-name-handler-p tramp-test-vec)) (tramp-sh-file-name-handler-p tramp-test-vec))
@ -7768,6 +7766,7 @@ This requires restrictions of file name syntax."
(skip-unless (not (getenv "EMACS_HYDRA_CI"))) ; SLOW ~ 620s (skip-unless (not (getenv "EMACS_HYDRA_CI"))) ; SLOW ~ 620s
(skip-unless (not (tramp--test-container-p))) (skip-unless (not (tramp--test-container-p)))
(skip-unless (not (tramp--test-rsync-p))) (skip-unless (not (tramp--test-rsync-p)))
(skip-unless (not (tramp--test-scp-p)))
(skip-unless (not (tramp--test-windows-nt-and-out-of-band-p))) (skip-unless (not (tramp--test-windows-nt-and-out-of-band-p)))
(skip-unless (not (tramp--test-ksh-p))) (skip-unless (not (tramp--test-ksh-p)))
(skip-unless (not (tramp--test-gdrive-p))) (skip-unless (not (tramp--test-gdrive-p)))