summaryrefslogtreecommitdiff
path: root/test/lisp/net
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2023-05-20 12:13:09 +0200
committerMichael Albinus <michael.albinus@gmx.de>2023-05-20 12:13:09 +0200
commit870a078c06102e763d57366c123980545e245d9e (patch)
tree907a8e0959b7c9f9d3eeb9476c2951b0fba9b53d /test/lisp/net
parent0de472e04fb29581e8302b60fafc707b18d7cbf3 (diff)
downloademacs-870a078c06102e763d57366c123980545e245d9e.tar.gz
emacs-870a078c06102e763d57366c123980545e245d9e.tar.bz2
emacs-870a078c06102e763d57366c123980545e245d9e.zip
Improve handling of ANSI control sequences in Tramp
* lisp/net/tramp-compat.el (ansi-color): Require. * lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp) (tramp-device-escape-sequence-regexp): Delete. (tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt) (tramp-wait-for-output): Use `ansi-color-control-seq-regexp'. * lisp/net/tramp.el (tramp-shell-prompt-pattern): Remove escape characters. (tramp-process-one-action, tramp-convert-file-attributes): Use `ansi-color-control-seq-regexp'. (Bug#63539) * test/lisp/net/tramp-tests.el (tramp-display-escape-sequence-regexp): Dont't declare. (tramp-test28-process-file, tramp-test32-shell-command): Use `ansi-color-control-seq-regexp'. (tramp-test45-asynchronous-requests): Adapt test.
Diffstat (limited to 'test/lisp/net')
-rw-r--r--test/lisp/net/tramp-tests.el67
1 files changed, 33 insertions, 34 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 6c773908e26..eec4a66a329 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -66,7 +66,6 @@
(defvar ange-ftp-make-backup-files)
(defvar tramp-connection-properties)
(defvar tramp-copy-size-limit)
-(defvar tramp-display-escape-sequence-regexp)
(defvar tramp-fuse-remove-hidden-files)
(defvar tramp-fuse-unmount-on-cleanup)
(defvar tramp-inline-compress-start-size)
@@ -4941,8 +4940,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(if (bufferp destination) destination (current-buffer))
;; "ls" could produce colorized output.
(goto-char (point-min))
- (while (re-search-forward
- tramp-display-escape-sequence-regexp nil t)
+ (while (re-search-forward ansi-color-control-seq-regexp nil t)
(replace-match "" nil nil))
(should
(string-equal (if destination (format "%s\n" fnnd) "")
@@ -4956,8 +4954,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(if (bufferp destination) destination (current-buffer))
;; "ls" could produce colorized output.
(goto-char (point-min))
- (while (re-search-forward
- tramp-display-escape-sequence-regexp nil t)
+ (while (re-search-forward ansi-color-control-seq-regexp nil t)
(replace-match "" nil nil))
(should
(string-equal
@@ -5671,8 +5668,7 @@ INPUT, if non-nil, is a string sent to the process."
(current-buffer))
;; "ls" could produce colorized output.
(goto-char (point-min))
- (while
- (re-search-forward tramp-display-escape-sequence-regexp nil t)
+ (while (re-search-forward ansi-color-control-seq-regexp nil t)
(replace-match "" nil nil))
(should
(string-equal
@@ -7589,34 +7585,37 @@ process sentinels. They shall not disturb each other."
;; Send a string to the processes. Use a random order of
;; the buffers. Mix with regular operation.
- (let ((buffers (copy-sequence buffers)))
+ (let ((buffers (copy-sequence buffers))
+ buf)
(while buffers
- (let* ((buf (seq-random-elt buffers))
- (proc (get-buffer-process buf))
- (file (process-get proc 'foo))
- (count (process-get proc 'bar)))
- (tramp--test-message
- "Start action %d %s %s" count buf (current-time-string))
- ;; Regular operation prior process action.
- (dired-uncache file)
- (if (= count 0)
- (should-not (file-attributes file))
- (should (file-attributes file)))
- ;; Send string to process.
- (process-send-string proc (format "%s\n" (buffer-name buf)))
- (while (accept-process-output nil 0))
- (tramp--test-message
- "Continue action %d %s %s" count buf (current-time-string))
- ;; Regular operation post process action.
- (dired-uncache file)
- (if (= count 2)
- (should-not (file-attributes file))
- (should (file-attributes file)))
- (tramp--test-message
- "Stop action %d %s %s" count buf (current-time-string))
- (process-put proc 'bar (1+ count))
- (unless (process-live-p proc)
- (setq buffers (delq buf buffers))))))
+ (setq buf (seq-random-elt buffers))
+ (if-let ((proc (get-buffer-process buf))
+ (file (process-get proc 'foo))
+ (count (process-get proc 'bar)))
+ (progn
+ (tramp--test-message
+ "Start action %d %s %s" count buf (current-time-string))
+ ;; Regular operation prior process action.
+ (dired-uncache file)
+ (if (= count 0)
+ (should-not (file-attributes file))
+ (should (file-attributes file)))
+ ;; Send string to process.
+ (process-send-string proc (format "%s\n" (buffer-name buf)))
+ (while (accept-process-output nil 0))
+ (tramp--test-message
+ "Continue action %d %s %s" count buf (current-time-string))
+ ;; Regular operation post process action.
+ (dired-uncache file)
+ (if (= count 2)
+ (should-not (file-attributes file))
+ (should (file-attributes file)))
+ (tramp--test-message
+ "Stop action %d %s %s" count buf (current-time-string))
+ (process-put proc 'bar (1+ count))
+ (unless (process-live-p proc)
+ (setq buffers (delq buf buffers))))
+ (setq buffers (delq buf buffers)))))
;; Checks. All process output shall exist in the
;; respective buffers. All created files shall be