diff options
| author | Michael Albinus | 2017-07-27 12:51:45 +0200 |
|---|---|---|
| committer | Michael Albinus | 2017-07-27 12:51:45 +0200 |
| commit | 82583d4dde465c0d923eec306d0f9c5d671955bc (patch) | |
| tree | fb9c06459e33a0fedf7874f3ec34809fcf4087ff | |
| parent | 28faa94f1c423091bb34c2776eabe9ae83e5b4fc (diff) | |
| download | emacs-82583d4dde465c0d923eec306d0f9c5d671955bc.tar.gz emacs-82583d4dde465c0d923eec306d0f9c5d671955bc.zip | |
Add watchdog process to tramp-test36-asynchronous-requests
* test/lisp/net/tramp-tests.el (tramp--test-timeout-handler):
New defun.
(tramp-test36-asynchronous-requests): Use a watchdog process,
listening for SIGUSR1.
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 58639e1bfa6..4ae7b880245 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -3681,6 +3681,10 @@ Use the `ls' command." | |||
| 3681 | tramp-connection-properties))) | 3681 | tramp-connection-properties))) |
| 3682 | (tramp--test-utf8))) | 3682 | (tramp--test-utf8))) |
| 3683 | 3683 | ||
| 3684 | (defun tramp--test-timeout-handler () | ||
| 3685 | (interactive) | ||
| 3686 | (ert-fail (format "`%s' timed out" (ert-test-name (ert-running-test))))) | ||
| 3687 | |||
| 3684 | ;; This test is inspired by Bug#16928. | 3688 | ;; This test is inspired by Bug#16928. |
| 3685 | (ert-deftest tramp-test36-asynchronous-requests () | 3689 | (ert-deftest tramp-test36-asynchronous-requests () |
| 3686 | "Check parallel asynchronous requests. | 3690 | "Check parallel asynchronous requests. |
| @@ -3690,10 +3694,15 @@ process sentinels. They shall not disturb each other." | |||
| 3690 | (skip-unless (tramp--test-enabled)) | 3694 | (skip-unless (tramp--test-enabled)) |
| 3691 | (skip-unless (tramp--test-sh-p)) | 3695 | (skip-unless (tramp--test-sh-p)) |
| 3692 | 3696 | ||
| 3693 | ;; This test could be blocked on hydra. | 3697 | ;; This test could be blocked on hydra. So we set a timeout of 300 |
| 3694 | (with-timeout | 3698 | ;; seconds, and we send a SIGUSR1 signal after 300 seconds. |
| 3695 | (300 (ert-fail "`tramp-test36-asynchronous-requests' timed out")) | 3699 | (with-timeout (300 (tramp--test-timeout-handler)) |
| 3696 | (let* ((tmp-name (tramp--test-make-temp-name)) | 3700 | (define-key special-event-map [sigusr1] 'tramp--test-timeout-handler) |
| 3701 | (let* ((watchdog | ||
| 3702 | (start-process | ||
| 3703 | "*watchdog*" nil shell-file-name shell-command-switch | ||
| 3704 | (format "sleep 300; kill -USR1 %d" (emacs-pid)))) | ||
| 3705 | (tmp-name (tramp--test-make-temp-name)) | ||
| 3697 | (default-directory tmp-name) | 3706 | (default-directory tmp-name) |
| 3698 | ;; Do not cache Tramp properties. | 3707 | ;; Do not cache Tramp properties. |
| 3699 | (remote-file-name-inhibit-cache t) | 3708 | (remote-file-name-inhibit-cache t) |
| @@ -3806,6 +3815,8 @@ process sentinels. They shall not disturb each other." | |||
| 3806 | ;; Regular operation. | 3815 | ;; Regular operation. |
| 3807 | (tramp--test-message | 3816 | (tramp--test-message |
| 3808 | "Trace 3 action %d %s %s" count buf (current-time-string)) | 3817 | "Trace 3 action %d %s %s" count buf (current-time-string)) |
| 3818 | ;; Give the watchdog a chance. | ||
| 3819 | (read-event nil nil 0.01) | ||
| 3809 | (if (= count 2) | 3820 | (if (= count 2) |
| 3810 | (if (= (length buffers) 1) | 3821 | (if (= (length buffers) 1) |
| 3811 | (tramp--test-instrument-test-case 10 | 3822 | (tramp--test-instrument-test-case 10 |
| @@ -3821,8 +3832,7 @@ process sentinels. They shall not disturb each other." | |||
| 3821 | ;; Checks. All process output shall exists in the | 3832 | ;; Checks. All process output shall exists in the |
| 3822 | ;; respective buffers. All created files shall be | 3833 | ;; respective buffers. All created files shall be |
| 3823 | ;; deleted. | 3834 | ;; deleted. |
| 3824 | (tramp--test-message | 3835 | (tramp--test-message "Check %s" (current-time-string)) |
| 3825 | "Check %s" (current-time-string)) | ||
| 3826 | (dolist (buf buffers) | 3836 | (dolist (buf buffers) |
| 3827 | (with-current-buffer buf | 3837 | (with-current-buffer buf |
| 3828 | (should (string-equal (format "%s\n" buf) (buffer-string))))) | 3838 | (should (string-equal (format "%s\n" buf) (buffer-string))))) |
| @@ -3831,6 +3841,8 @@ process sentinels. They shall not disturb each other." | |||
| 3831 | tmp-name nil directory-files-no-dot-files-regexp))) | 3841 | tmp-name nil directory-files-no-dot-files-regexp))) |
| 3832 | 3842 | ||
| 3833 | ;; Cleanup. | 3843 | ;; Cleanup. |
| 3844 | (define-key special-event-map [sigusr1] 'ignore) | ||
| 3845 | (ignore-errors (quit-process watchdog)) | ||
| 3834 | (dolist (buf buffers) | 3846 | (dolist (buf buffers) |
| 3835 | (ignore-errors (delete-process (get-buffer-process buf))) | 3847 | (ignore-errors (delete-process (get-buffer-process buf))) |
| 3836 | (ignore-errors (kill-buffer buf))) | 3848 | (ignore-errors (kill-buffer buf))) |