summaryrefslogtreecommitdiff
path: root/test/lisp/net
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2021-09-16 16:50:24 +0200
committerMichael Albinus <michael.albinus@gmx.de>2021-09-16 16:50:24 +0200
commit36474a1e490a5eae266805a0e04615741d56692c (patch)
tree8ad8f0d09436f5537d1e264935ab96669bc84c80 /test/lisp/net
parent85c7993631ce49d2082971df8743b2e1ba2fa81d (diff)
downloademacs-36474a1e490a5eae266805a0e04615741d56692c.tar.gz
emacs-36474a1e490a5eae266805a0e04615741d56692c.tar.bz2
emacs-36474a1e490a5eae266805a0e04615741d56692c.zip
Tramp code cleanup
* lisp/net/tramp-sh.el (tramp-methods) <telnet, nc>: Reintroduce "%n" marker. (tramp-maybe-open-connection): Handle it. * lisp/net/tramp.el (tramp-prefix-regexp): * lisp/net/tramp-smb.el (tramp-smb-options): Fix docstring. * lisp/net/tramp*.el: Fix typos. Remove trailing space from `yes-or-no-p' and `y-or-n-p' prompts. * test/lisp/net/tramp-tests.el (tramp--test-telnet-p): New defun. (tramp-test29-start-file-process, tramp-test30-make-process) (tramp-test35-remote-path, tramp-test44-asynchronous-requests): Adapt tests.
Diffstat (limited to 'test/lisp/net')
-rw-r--r--test/lisp/net/tramp-tests.el34
1 files changed, 23 insertions, 11 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index af4f45d6913..9f0264abc1b 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2083,7 +2083,7 @@ Also see `ignore'."
"/method:host:/:/path//foo"))
;; Forwhatever reasons, the following tests let Emacs crash for
- ;; Emacs 25, occasionally. No idea what's up.
+ ;; Emacs 25, occasionally. No idea what's up.
(when (tramp--test-emacs26-p)
(should
(string-equal
@@ -4464,7 +4464,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(should (string-equal (format "%s\n" fnnd) (buffer-string)))
(should-not (get-buffer-window (current-buffer) t))
- ;; Second run. The output must be appended.
+ ;; Second run. The output must be appended.
(goto-char (point-max))
(should (zerop (process-file "ls" nil t t fnnd)))
;; `ls' could produce colorized output.
@@ -4588,8 +4588,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(should
(string-match-p
(if (memq process-connection-type '(nil pipe))
- "66\n6F\n6F\n0D\n0A\n"
- "66\n6F\n6F\n0A\n0A\n")
+ ;; `telnet' converts \r to <CR><NUL> if `crlf'
+ ;; flag is FALSE. See telnet(1) man page.
+ "66\n6F\n6F\n0D\\(\n00\\)?\n0A\n"
+ "66\n6F\n6F\n0A\\(\n00\\)?\n0A\n")
(buffer-string))))
;; Cleanup.
@@ -4754,8 +4756,9 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
;; Cleanup.
(ignore-errors (delete-process proc)))
- ;; Process with stderr buffer.
- (unless (tramp-direct-async-process-p)
+ ;; Process with stderr buffer. `telnet' does not cooperate with
+ ;; three processes.
+ (unless (or (tramp--test-telnet-p) (tramp-direct-async-process-p))
(let ((stderr (generate-new-buffer "*stderr*")))
(unwind-protect
(with-temp-buffer
@@ -4851,8 +4854,10 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
(string-match-p
(if (memq (or connection-type process-connection-type)
'(nil pipe))
- "66\n6F\n6F\n0D\n0A\n"
- "66\n6F\n6F\n0A\n0A\n")
+ ;; `telnet' converts \r to <CR><NUL> if `crlf'
+ ;; flag is FALSE. See telnet(1) man page.
+ "66\n6F\n6F\n0D\\(\n00\\)?\n0A\n"
+ "66\n6F\n6F\n0A\\(\n00\\)?\n0A\n")
(buffer-string))))
;; Cleanup.
@@ -5498,9 +5503,9 @@ Use direct async.")
;; Ignore trailing newline.
(setq path (substring (shell-command-to-string "echo $PATH") nil -1))
;; The shell doesn't handle such long strings.
- (unless (<= (length path)
- (tramp-get-connection-property
- tramp-test-vec "pipe-buf" 4096))
+ (when (<= (length path)
+ (tramp-get-connection-property
+ tramp-test-vec "pipe-buf" 4096))
;; The last element of `exec-path' is `exec-directory'.
(should
(string-equal
@@ -6154,6 +6159,12 @@ This requires restrictions of file name syntax."
"Check, whether the sudoedit method is used."
(tramp-sudoedit-file-name-p tramp-test-temporary-file-directory))
+(defun tramp--test-telnet-p ()
+ "Check, whether the telnet method is used.
+This does not support special file names."
+ (string-equal
+ "telnet" (file-remote-p tramp-test-temporary-file-directory 'method)))
+
(defun tramp--test-windows-nt-p ()
"Check, whether the locale host runs MS Windows."
(eq system-type 'windows-nt))
@@ -6712,6 +6723,7 @@ process sentinels. They shall not disturb each other."
(tramp--test-sh-p)))
(skip-unless (not (tramp--test-crypt-p)))
(skip-unless (not (tramp--test-docker-p)))
+ (skip-unless (not (tramp--test-telnet-p)))
(skip-unless (not (tramp--test-windows-nt-p)))
(with-timeout