Code cleanup in tramp-tests.el

* test/lisp/net/tramp-tests.el (tramp-test29-start-file-process)
(tramp-test30-make-process): Extend tests.
(tramp--test-out-of-band-p): New defun.
(tramp--test-windows-nt-and-out-of-band-p)
(tramp-test42-utf8-with-stat, tramp-test42-utf8-with-perl)
(tramp-test42-utf8-with-ls): Use it.
(tramp--test-windows-nt-or-smb-p): Use `tramp--test-windows-nt-p'.
This commit is contained in:
Michael Albinus 2021-10-19 18:50:12 +02:00
parent 548a5db611
commit d7f595cc89

View file

@ -4588,6 +4588,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
;; Cleanup. ;; Cleanup.
(ignore-errors (delete-process proc))) (ignore-errors (delete-process proc)))
;; `telnet' does not cooperate with disabled filter.
(unless (tramp--test-telnet-p)
(unwind-protect (unwind-protect
(with-temp-buffer (with-temp-buffer
(setq proc (start-file-process "test3" (current-buffer) "cat")) (setq proc (start-file-process "test3" (current-buffer) "cat"))
@ -4604,7 +4606,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(should (= (point-min) (point-max)))) (should (= (point-min) (point-max))))
;; Cleanup. ;; Cleanup.
(ignore-errors (delete-process proc))) (ignore-errors (delete-process proc))))
;; Process connection type. ;; Process connection type.
(when (and (tramp--test-sh-p) (when (and (tramp--test-sh-p)
@ -4779,6 +4781,8 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
;; Cleanup. ;; Cleanup.
(ignore-errors (delete-process proc))) (ignore-errors (delete-process proc)))
;; `telnet' does not cooperate with disabled filter.
(unless (tramp--test-telnet-p)
(unwind-protect (unwind-protect
(with-temp-buffer (with-temp-buffer
(setq proc (setq proc
@ -4799,7 +4803,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
(should (= (point-min) (point-max)))) (should (= (point-min) (point-max))))
;; Cleanup. ;; Cleanup.
(ignore-errors (delete-process proc))) (ignore-errors (delete-process proc))))
;; Process sentinel. ;; Process sentinel.
(unwind-protect (unwind-protect
@ -6191,6 +6195,10 @@ This does not support external Emacs calls."
(string-equal (string-equal
"mock" (file-remote-p tramp-test-temporary-file-directory 'method))) "mock" (file-remote-p tramp-test-temporary-file-directory 'method)))
(defun tramp--test-out-of-band-p ()
"Check, whether an out-of-band method is used."
(tramp-method-out-of-band-p tramp-test-vec 1))
(defun tramp--test-rclone-p () (defun tramp--test-rclone-p ()
"Check, whether the remote host is offered by rclone. "Check, whether the remote host is offered by rclone.
This requires restrictions of file name syntax." This requires restrictions of file name syntax."
@ -6246,13 +6254,13 @@ This does not support special file names."
(defun tramp--test-windows-nt-and-out-of-band-p () (defun tramp--test-windows-nt-and-out-of-band-p ()
"Check, whether the locale host runs MS Windows and an out-of-band method. "Check, whether the locale host runs MS Windows and an out-of-band method.
This does not support utf8 based file transfer." This does not support utf8 based file transfer."
(and (eq system-type 'windows-nt) (and (tramp--test-windows-nt-p)
(tramp-method-out-of-band-p tramp-test-vec 1))) (tramp--test-out-of-band-p)))
(defun tramp--test-windows-nt-or-smb-p () (defun tramp--test-windows-nt-or-smb-p ()
"Check, whether the locale or remote host runs MS Windows. "Check, whether the locale or remote host runs MS Windows.
This requires restrictions of file name syntax." This requires restrictions of file name syntax."
(or (eq system-type 'windows-nt) (or (tramp--test-windows-nt-p)
(tramp--test-smb-p))) (tramp--test-smb-p)))
(defun tramp--test-smb-p () (defun tramp--test-smb-p ()
@ -6662,7 +6670,7 @@ Use the `stat' command."
(skip-unless (tramp--test-sh-p)) (skip-unless (tramp--test-sh-p))
(skip-unless (not (tramp--test-docker-p))) (skip-unless (not (tramp--test-docker-p)))
(skip-unless (not (tramp--test-rsync-p))) (skip-unless (not (tramp--test-rsync-p)))
(skip-unless (not (tramp--test-windows-nt-and-out-of-band-p))) (skip-unless (not (tramp--test-out-of-band-p))) ; SLOW
(skip-unless (not (tramp--test-ksh-p))) (skip-unless (not (tramp--test-ksh-p)))
(skip-unless (not (tramp--test-crypt-p))) (skip-unless (not (tramp--test-crypt-p)))
;; We cannot use `tramp-test-vec', because this fails during compilation. ;; We cannot use `tramp-test-vec', because this fails during compilation.
@ -6685,7 +6693,7 @@ Use the `perl' command."
(skip-unless (tramp--test-sh-p)) (skip-unless (tramp--test-sh-p))
(skip-unless (not (tramp--test-docker-p))) (skip-unless (not (tramp--test-docker-p)))
(skip-unless (not (tramp--test-rsync-p))) (skip-unless (not (tramp--test-rsync-p)))
(skip-unless (not (tramp--test-windows-nt-and-out-of-band-p))) (skip-unless (not (tramp--test-out-of-band-p))) ; SLOW
(skip-unless (not (tramp--test-ksh-p))) (skip-unless (not (tramp--test-ksh-p)))
(skip-unless (not (tramp--test-crypt-p))) (skip-unless (not (tramp--test-crypt-p)))
;; We cannot use `tramp-test-vec', because this fails during compilation. ;; We cannot use `tramp-test-vec', because this fails during compilation.
@ -6711,7 +6719,7 @@ Use the `ls' command."
(skip-unless (tramp--test-sh-p)) (skip-unless (tramp--test-sh-p))
(skip-unless (not (tramp--test-docker-p))) (skip-unless (not (tramp--test-docker-p)))
(skip-unless (not (tramp--test-rsync-p))) (skip-unless (not (tramp--test-rsync-p)))
(skip-unless (not (tramp--test-windows-nt-and-out-of-band-p))) (skip-unless (not (tramp--test-out-of-band-p))) ; SLOW
(skip-unless (not (tramp--test-ksh-p))) (skip-unless (not (tramp--test-ksh-p)))
(skip-unless (not (tramp--test-crypt-p))) (skip-unless (not (tramp--test-crypt-p)))