aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2019-06-24 17:36:00 +0200
committerMichael Albinus2019-06-24 17:36:00 +0200
commit18a7e5414c534db38eedb06b16ef68f2c17b98fd (patch)
tree355be82e621742ec6768dcf859d6edabc3c643ce /test
parentb72cd0c74682cf87799f324eb3dace5f1962baf0 (diff)
downloademacs-18a7e5414c534db38eedb06b16ef68f2c17b98fd.tar.gz
emacs-18a7e5414c534db38eedb06b16ef68f2c17b98fd.zip
Improve error handling in Tramp
* lisp/net/tramp-compat.el (ls-lisp): Require. * lisp/net/tramp.el (ls-lisp-use-insert-directory-program): Don't declare. (tramp-current-connection): Adapt docstring. (tramp-debug-message): Adapt function names. (tramp-error, tramp-run-real-handler): Let-bind `signal-hook-function'. (tramp-signal-hook-function): New defun. (tramp-debug-on-error, tramp-condition-case-unless-debug): Remove. (tramp-file-name-handler): Handle `tramp-current-connection'. Let-bind `signal-hook-function'. Use `unwind-protect' instead of `tramp-condition-case-unless-debug'. (tramp-handle-insert-directory): Don't require ls-lisp. (tramp-process-actions): Check, that `tramp-password-save-function' is non-nil. (tramp-equal-remote): Handle the case both files are local. * test/lisp/net/tramp-tests.el (tramp--test-instrument-test-case): Do not bind `tramp-debug-on-error'. (tramp--test-ignore-make-symbolic-link-error): Make error handler more explicit about the error.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/tramp-tests.el15
1 files changed, 6 insertions, 9 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index c9ae4d8b139..525f62a3c0b 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -169,7 +169,6 @@ properly. BODY shall not contain a timeout."
169 (declare (indent 1) (debug (natnump body))) 169 (declare (indent 1) (debug (natnump body)))
170 `(let ((tramp-verbose (max (or ,verbose 0) (or tramp-verbose 0))) 170 `(let ((tramp-verbose (max (or ,verbose 0) (or tramp-verbose 0)))
171 (tramp-message-show-message t) 171 (tramp-message-show-message t)
172 (tramp-debug-on-error t)
173 (debug-ignored-errors 172 (debug-ignored-errors
174 (cons "^make-symbolic-link not supported$" debug-ignored-errors)) 173 (cons "^make-symbolic-link not supported$" debug-ignored-errors))
175 inhibit-message) 174 inhibit-message)
@@ -178,9 +177,8 @@ properly. BODY shall not contain a timeout."
178 ;; Unwind forms. 177 ;; Unwind forms.
179 (when (and (null tramp--test-instrument-test-case-p) (> tramp-verbose 3)) 178 (when (and (null tramp--test-instrument-test-case-p) (> tramp-verbose 3))
180 (dolist (buf (tramp-list-tramp-buffers)) 179 (dolist (buf (tramp-list-tramp-buffers))
181 (message ";; %s" buf)
182 (with-current-buffer buf 180 (with-current-buffer buf
183 (message "%s" (buffer-string)))))))) 181 (message ";; %s\n%s" buf (buffer-string))))))))
184 182
185(defsubst tramp--test-message (fmt-string &rest arguments) 183(defsubst tramp--test-message (fmt-string &rest arguments)
186 "Emit a message into ERT *Messages*." 184 "Emit a message into ERT *Messages*."
@@ -2960,17 +2958,16 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
2960 (ignore-errors (delete-directory tmp-name2 'recursive)))))) 2958 (ignore-errors (delete-directory tmp-name2 'recursive))))))
2961 2959
2962;; Method "smb" supports `make-symbolic-link' only if the remote host 2960;; Method "smb" supports `make-symbolic-link' only if the remote host
2963;; has CIFS capabilities. tramp-adb.el and tramp-gvfs.el do not 2961;; has CIFS capabilities. tramp-adb.el, tramp-gvfs.el and
2964;; support symbolic links at all. 2962;; tramp-rclone.el do not support symbolic links at all.
2965(defmacro tramp--test-ignore-make-symbolic-link-error (&rest body) 2963(defmacro tramp--test-ignore-make-symbolic-link-error (&rest body)
2966 "Run BODY, ignoring \"make-symbolic-link not supported\" file error." 2964 "Run BODY, ignoring \"make-symbolic-link not supported\" file error."
2967 (declare (indent defun) (debug (body))) 2965 (declare (indent defun) (debug (body)))
2968 `(condition-case err 2966 `(condition-case err
2969 (progn ,@body) 2967 (progn ,@body)
2970 ((error quit debug) 2968 (file-error
2971 (unless (and (eq (car err) 'file-error) 2969 (unless (string-equal (error-message-string err)
2972 (string-equal (error-message-string err) 2970 "make-symbolic-link not supported")
2973 "make-symbolic-link not supported"))
2974 (signal (car err) (cdr err)))))) 2971 (signal (car err) (cdr err))))))
2975 2972
2976(ert-deftest tramp-test18-file-attributes () 2973(ert-deftest tramp-test18-file-attributes ()