summaryrefslogtreecommitdiff
path: root/test/lisp/net
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@raeburn.org>2017-07-31 01:13:53 -0400
committerKen Raeburn <raeburn@raeburn.org>2017-07-31 01:13:53 -0400
commit13f3370400031e2ac1c9be0932f411370fc6984e (patch)
tree06f349b2b0f1cda9e36f7c4390d9d2d9bf49303c /test/lisp/net
parentcd0966b33c1fe975520e85e0e7af82c09e4754dc (diff)
parentdcfcaf40d577808d640016c886d4fae7280a7fd5 (diff)
downloademacs-scratch/raeburn-startup.tar.gz
; Merge from branch 'master'scratch/raeburn-startup
Diffstat (limited to 'test/lisp/net')
-rw-r--r--test/lisp/net/tramp-tests.el137
1 files changed, 130 insertions, 7 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 94e91b79300..979f674f0f1 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -149,6 +149,7 @@ handled properly. BODY shall not contain a timeout."
(debug-ignored-errors
(cons "^make-symbolic-link not supported$" debug-ignored-errors))
inhibit-message)
+ (message "tramp--test-instrument-test-case %s" tramp-verbose)
(unwind-protect
(let ((tramp--test-instrument-test-case-p t)) ,@body)
;; Unwind forms.
@@ -2201,6 +2202,108 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
;; Cleanup.
(ignore-errors (delete-directory tmp-name1 'recursive))))))
+(ert-deftest tramp-test17-dired-with-wildcards ()
+ "Check `dired' with wildcards."
+ (skip-unless (tramp--test-enabled))
+ (skip-unless (fboundp 'insert-directory-wildcard-in-dir-p))
+
+ (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil)))
+ (let* ((tmp-name1
+ (expand-file-name (tramp--test-make-temp-name nil quoted)))
+ (tmp-name2
+ (expand-file-name (tramp--test-make-temp-name nil quoted)))
+ (tmp-name3 (expand-file-name "foo" tmp-name1))
+ (tmp-name4 (expand-file-name "bar" tmp-name2))
+ (tramp-test-temporary-file-directory
+ (funcall
+ (if quoted 'tramp-compat-file-name-quote 'identity)
+ tramp-test-temporary-file-directory))
+ buffer)
+ (unwind-protect
+ (progn
+ (make-directory tmp-name1)
+ (write-region "foo" nil tmp-name3)
+ (should (file-directory-p tmp-name1))
+ (should (file-exists-p tmp-name3))
+ (make-directory tmp-name2)
+ (write-region "foo" nil tmp-name4)
+ (should (file-directory-p tmp-name2))
+ (should (file-exists-p tmp-name4))
+
+ ;; Check for expanded directory names.
+ (with-current-buffer
+ (setq buffer
+ (dired-noselect
+ (expand-file-name
+ "tramp-test*" tramp-test-temporary-file-directory)))
+ (goto-char (point-min))
+ (should
+ (re-search-forward
+ (regexp-quote
+ (file-relative-name
+ tmp-name1 tramp-test-temporary-file-directory))))
+ (goto-char (point-min))
+ (should
+ (re-search-forward
+ (regexp-quote
+ (file-relative-name
+ tmp-name2 tramp-test-temporary-file-directory)))))
+ (kill-buffer buffer)
+
+ ;; Check for expanded directory and file names.
+ (with-current-buffer
+ (setq buffer
+ (dired-noselect
+ (expand-file-name
+ "tramp-test*/*" tramp-test-temporary-file-directory)))
+ (goto-char (point-min))
+ (should
+ (re-search-forward
+ (regexp-quote
+ (file-relative-name
+ tmp-name3 tramp-test-temporary-file-directory))))
+ (goto-char (point-min))
+ (should
+ (re-search-forward
+ (regexp-quote
+ (file-relative-name
+ tmp-name4
+ tramp-test-temporary-file-directory)))))
+ (kill-buffer buffer)
+
+ ;; Check for special characters.
+ (setq tmp-name3 (expand-file-name "*?" tmp-name1))
+ (setq tmp-name4 (expand-file-name "[a-z0-9]" tmp-name2))
+ (write-region "foo" nil tmp-name3)
+ (should (file-exists-p tmp-name3))
+ (write-region "foo" nil tmp-name4)
+ (should (file-exists-p tmp-name4))
+
+ (with-current-buffer
+ (setq buffer
+ (dired-noselect
+ (expand-file-name
+ "tramp-test*/*" tramp-test-temporary-file-directory)))
+ (goto-char (point-min))
+ (should
+ (re-search-forward
+ (regexp-quote
+ (file-relative-name
+ tmp-name3 tramp-test-temporary-file-directory))))
+ (goto-char (point-min))
+ (should
+ (re-search-forward
+ (regexp-quote
+ (file-relative-name
+ tmp-name4
+ tramp-test-temporary-file-directory)))))
+ (kill-buffer buffer))
+
+ ;; Cleanup.
+ (ignore-errors (kill-buffer buffer))
+ (ignore-errors (delete-directory tmp-name1 'recursive))
+ (ignore-errors (delete-directory tmp-name2 'recursive))))))
+
(ert-deftest tramp-test18-file-attributes ()
"Check `file-attributes'.
This tests also `file-readable-p', `file-regular-p' and
@@ -3680,6 +3783,10 @@ Use the `ls' command."
tramp-connection-properties)))
(tramp--test-utf8)))
+(defun tramp--test-timeout-handler ()
+ (interactive)
+ (ert-fail (format "`%s' timed out" (ert-test-name (ert-running-test)))))
+
;; This test is inspired by Bug#16928.
(ert-deftest tramp-test36-asynchronous-requests ()
"Check parallel asynchronous requests.
@@ -3689,10 +3796,15 @@ process sentinels. They shall not disturb each other."
(skip-unless (tramp--test-enabled))
(skip-unless (tramp--test-sh-p))
- ;; This test could be blocked on hydra.
- (with-timeout
- (300 (ert-fail "`tramp-test36-asynchronous-requests' timed out"))
- (let* ((tmp-name (tramp--test-make-temp-name))
+ ;; This test could be blocked on hydra. So we set a timeout of 300
+ ;; seconds, and we send a SIGUSR1 signal after 300 seconds.
+ (with-timeout (300 (tramp--test-timeout-handler))
+ (define-key special-event-map [sigusr1] 'tramp--test-timeout-handler)
+ (let* ((watchdog
+ (start-process
+ "*watchdog*" nil shell-file-name shell-command-switch
+ (format "sleep 300; kill -USR1 %d" (emacs-pid))))
+ (tmp-name (tramp--test-make-temp-name))
(default-directory tmp-name)
;; Do not cache Tramp properties.
(remote-file-name-inhibit-cache t)
@@ -3802,9 +3914,11 @@ process sentinels. They shall not disturb each other."
(tramp--test-message
"Trace 2 action %d %s %s" count buf (current-time-string))
(accept-process-output proc 0.1 nil 0)
- ;; Regular operation.
(tramp--test-message
"Trace 3 action %d %s %s" count buf (current-time-string))
+ ;; Give the watchdog a chance.
+ (read-event nil nil 0.01)
+ ;; Regular operation.
(if (= count 2)
(if (= (length buffers) 1)
(tramp--test-instrument-test-case 10
@@ -3820,8 +3934,7 @@ process sentinels. They shall not disturb each other."
;; Checks. All process output shall exists in the
;; respective buffers. All created files shall be
;; deleted.
- (tramp--test-message
- "Check %s" (current-time-string))
+ (tramp--test-message "Check %s" (current-time-string))
(dolist (buf buffers)
(with-current-buffer buf
(should (string-equal (format "%s\n" buf) (buffer-string)))))
@@ -3830,6 +3943,8 @@ process sentinels. They shall not disturb each other."
tmp-name nil directory-files-no-dot-files-regexp)))
;; Cleanup.
+ (define-key special-event-map [sigusr1] 'ignore)
+ (ignore-errors (quit-process watchdog))
(dolist (buf buffers)
(ignore-errors (delete-process (get-buffer-process buf)))
(ignore-errors (kill-buffer buf)))
@@ -3906,6 +4021,14 @@ Since it unloads Tramp, it shall be the last test to run."
(not (string-match "^tramp--?test" (symbol-name x)))
(not (string-match "unload-hook$" (symbol-name x)))
(ert-fail (format "`%s' still bound" x)))))
+ ;; The defstruct `tramp-file-name' and all its internal functions
+ ;; shall be purged.
+ (should-not (cl--find-class 'tramp-file-name))
+ (mapatoms
+ (lambda (x)
+ (and (functionp x)
+ (string-match "tramp-file-name" (symbol-name x))
+ (ert-fail (format "Structure function `%s' still exists" x)))))
;; There shouldn't be left a hook function containing a Tramp
;; function. We do not regard the Tramp unload hooks.
(mapatoms