aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2020-06-23 21:18:08 +0200
committerMichael Albinus2020-06-23 21:18:08 +0200
commit35e881c5303c6ddf23b901bd2805971dc4ecf20b (patch)
treec2f80545ac67ed12f0bdf8f2e8f8624c2b5a42ea
parent86a24971118958baf5a0a88a9c7c2cb053501b6d (diff)
downloademacs-35e881c5303c6ddf23b901bd2805971dc4ecf20b.tar.gz
emacs-35e881c5303c6ddf23b901bd2805971dc4ecf20b.zip
Fix problem in tramp-smb.el
* lisp/net/tramp-smb.el (tramp-smb-handle-directory-files): Use `directory-file-name'. * test/lisp/net/tramp-tests.el (trace): Require it. (tramp--test-instrument-test-case): Print also function traces. (tramp--test-smb-p): New defun. (tramp-test03-file-name-method-rules) (tramp-test05-expand-file-name-relative) (tramp-test21-file-links, tramp--test-windows-nt-or-smb-p) (tramp--test-check-files): Use it.
-rw-r--r--lisp/net/tramp-smb.el4
-rw-r--r--test/lisp/net/tramp-tests.el54
2 files changed, 39 insertions, 19 deletions
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 357e9a220ce..947e6a767c7 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -704,11 +704,11 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
704 (delete nil 704 (delete nil
705 (mapcar (lambda (x) (when (string-match-p match x) x)) 705 (mapcar (lambda (x) (when (string-match-p match x) x))
706 result)))) 706 result))))
707 ;; Append directory. 707 ;; Prepend directory.
708 (when full 708 (when full
709 (setq result 709 (setq result
710 (mapcar 710 (mapcar
711 (lambda (x) (format "%s/%s" directory x)) 711 (lambda (x) (format "%s/%s" (directory-file-name directory) x))
712 result))) 712 result)))
713 ;; Sort them if necessary. 713 ;; Sort them if necessary.
714 (unless nosort (setq result (sort result #'string-lessp))) 714 (unless nosort (setq result (sort result #'string-lessp)))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 43630c4debd..1f24ba2786f 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -43,6 +43,7 @@
43(require 'dired) 43(require 'dired)
44(require 'ert) 44(require 'ert)
45(require 'ert-x) 45(require 'ert-x)
46(require 'trace)
46(require 'tramp) 47(require 'tramp)
47(require 'vc) 48(require 'vc)
48(require 'vc-bzr) 49(require 'vc-bzr)
@@ -177,23 +178,36 @@ This shall used dynamically bound only.")
177(defmacro tramp--test-instrument-test-case (verbose &rest body) 178(defmacro tramp--test-instrument-test-case (verbose &rest body)
178 "Run BODY with `tramp-verbose' equal VERBOSE. 179 "Run BODY with `tramp-verbose' equal VERBOSE.
179Print the content of the Tramp connection and debug buffers, if 180Print the content of the Tramp connection and debug buffers, if
180`tramp-verbose' is greater than 3. `should-error' is not handled 181`tramp-verbose' is greater than 3. Print traces if `tramp-verbose'
181properly. BODY shall not contain a timeout." 182is greater than 10.
183`should-error' is not handled properly. BODY shall not contain a timeout."
182 (declare (indent 1) (debug (natnump body))) 184 (declare (indent 1) (debug (natnump body)))
183 `(let ((tramp-verbose (max (or ,verbose 0) (or tramp-verbose 0))) 185 `(let* ((tramp-verbose (max (or ,verbose 0) (or tramp-verbose 0)))
184 (debug-ignored-errors 186 (trace-buffer
185 (append 187 (when (> tramp-verbose 10) (generate-new-buffer " *temp*")))
186 '("^make-symbolic-link not supported$" 188 (debug-ignored-errors
187 "^error with add-name-to-file") 189 (append
188 debug-ignored-errors)) 190 '("^make-symbolic-link not supported$"
189 inhibit-message) 191 "^error with add-name-to-file")
192 debug-ignored-errors))
193 inhibit-message)
194 (when trace-buffer
195 (dolist (elt (all-completions "tramp-" obarray 'functionp))
196 (trace-function-background (intern elt))))
190 (unwind-protect 197 (unwind-protect
191 (let ((tramp--test-instrument-test-case-p t)) ,@body) 198 (let ((tramp--test-instrument-test-case-p t)) ,@body)
192 ;; Unwind forms. 199 ;; Unwind forms.
200 (when trace-buffer
201 (untrace-all))
193 (when (and (null tramp--test-instrument-test-case-p) (> tramp-verbose 3)) 202 (when (and (null tramp--test-instrument-test-case-p) (> tramp-verbose 3))
194 (dolist (buf (tramp-list-tramp-buffers)) 203 (dolist
204 (buf (if trace-buffer
205 (cons (get-buffer trace-buffer) (tramp-list-tramp-buffers))
206 (tramp-list-tramp-buffers)))
195 (with-current-buffer buf 207 (with-current-buffer buf
196 (message ";; %s\n%s" buf (buffer-string)))))))) 208 (message ";; %s\n%s" buf (buffer-string)))))
209 (when trace-buffer
210 (kill-buffer trace-buffer)))))
197 211
198(defsubst tramp--test-message (fmt-string &rest arguments) 212(defsubst tramp--test-message (fmt-string &rest arguments)
199 "Emit a message into ERT *Messages*." 213 "Emit a message into ERT *Messages*."
@@ -1996,7 +2010,7 @@ properly. BODY shall not contain a timeout."
1996 2010
1997 ;; Samba does not support file names with periods followed by 2011 ;; Samba does not support file names with periods followed by
1998 ;; spaces, and trailing periods or spaces. 2012 ;; spaces, and trailing periods or spaces.
1999 (when (tramp-smb-file-name-p tramp-test-temporary-file-directory) 2013 (when (tramp--test-smb-p)
2000 (dolist (file '("foo." "foo. bar" "foo ")) 2014 (dolist (file '("foo." "foo. bar" "foo "))
2001 (should-error 2015 (should-error
2002 (tramp-smb-get-localname 2016 (tramp-smb-get-localname
@@ -2150,7 +2164,7 @@ properly. BODY shall not contain a timeout."
2150 ;; These are the methods the test doesn't fail. 2164 ;; These are the methods the test doesn't fail.
2151 (when (or (tramp--test-adb-p) (tramp--test-ange-ftp-p) (tramp--test-gvfs-p) 2165 (when (or (tramp--test-adb-p) (tramp--test-ange-ftp-p) (tramp--test-gvfs-p)
2152 (tramp--test-rclone-p) 2166 (tramp--test-rclone-p)
2153 (tramp-smb-file-name-p tramp-test-temporary-file-directory)) 2167 (tramp--test-smb-p))
2154 (setf (ert-test-expected-result-type 2168 (setf (ert-test-expected-result-type
2155 (ert-get-test 'tramp-test05-expand-file-name-relative)) 2169 (ert-get-test 'tramp-test05-expand-file-name-relative))
2156 :passed)) 2170 :passed))
@@ -3716,7 +3730,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3716 (tramp--test-ignore-make-symbolic-link-error 3730 (tramp--test-ignore-make-symbolic-link-error
3717 (make-symbolic-link tmp-name2 tmp-name1) 3731 (make-symbolic-link tmp-name2 tmp-name1)
3718 (should (file-symlink-p tmp-name1)) 3732 (should (file-symlink-p tmp-name1))
3719 (if (tramp-smb-file-name-p tramp-test-temporary-file-directory) 3733 (if (tramp--test-smb-p)
3720 ;; The symlink command of `smbclient' detects the 3734 ;; The symlink command of `smbclient' detects the
3721 ;; cycle already. 3735 ;; cycle already.
3722 (should-error 3736 (should-error
@@ -5697,7 +5711,12 @@ This does not support utf8 based file transfer."
5697 "Check, whether the locale or remote host runs MS Windows. 5711 "Check, whether the locale or remote host runs MS Windows.
5698This requires restrictions of file name syntax." 5712This requires restrictions of file name syntax."
5699 (or (eq system-type 'windows-nt) 5713 (or (eq system-type 'windows-nt)
5700 (tramp-smb-file-name-p tramp-test-temporary-file-directory))) 5714 (tramp--test-smb-p)))
5715
5716(defun tramp--test-smb-p ()
5717 "Check, whether the locale or remote host runs MS Windows.
5718This requires restrictions of file name syntax."
5719 (tramp-smb-file-name-p tramp-test-temporary-file-directory))
5701 5720
5702(defun tramp--test-check-files (&rest files) 5721(defun tramp--test-check-files (&rest files)
5703 "Run a simple but comprehensive test over every file in FILES." 5722 "Run a simple but comprehensive test over every file in FILES."
@@ -5821,8 +5840,7 @@ This requires restrictions of file name syntax."
5821 ;; It does not work in the "smb" case, only relative 5840 ;; It does not work in the "smb" case, only relative
5822 ;; symlinks to existing files are shown there. 5841 ;; symlinks to existing files are shown there.
5823 (tramp--test-ignore-make-symbolic-link-error 5842 (tramp--test-ignore-make-symbolic-link-error
5824 (unless 5843 (unless (tramp--test-smb-p)
5825 (tramp-smb-file-name-p tramp-test-temporary-file-directory)
5826 (make-symbolic-link file2 file3) 5844 (make-symbolic-link file2 file3)
5827 (should (file-symlink-p file3)) 5845 (should (file-symlink-p file3))
5828 (should 5846 (should
@@ -6554,6 +6572,8 @@ If INTERACTIVE is non-nil, the tests are run interactively."
6554;; * file-equal-p (partly done in `tramp-test21-file-links') 6572;; * file-equal-p (partly done in `tramp-test21-file-links')
6555;; * file-in-directory-p 6573;; * file-in-directory-p
6556;; * file-name-case-insensitive-p 6574;; * file-name-case-insensitive-p
6575;; * tramp-get-remote-gid
6576;; * tramp-get-remote-uid
6557;; * tramp-set-file-uid-gid 6577;; * tramp-set-file-uid-gid
6558 6578
6559;; * Work on skipped tests. Make a comment, when it is impossible. 6579;; * Work on skipped tests. Make a comment, when it is impossible.