diff options
| author | Michael Albinus | 2017-07-03 13:21:39 +0200 |
|---|---|---|
| committer | Michael Albinus | 2017-07-03 13:21:39 +0200 |
| commit | 62504a9f5de3adb0569e69af116a2852e08d7d6f (patch) | |
| tree | 945a387f0261c2a04a5f79fdba59df06b53a0dd6 | |
| parent | 71169d5185a2465714cc3fb669c9e10338602340 (diff) | |
| download | emacs-62504a9f5de3adb0569e69af116a2852e08d7d6f.tar.gz emacs-62504a9f5de3adb0569e69af116a2852e08d7d6f.zip | |
Fix tramp-tests.el for hydra
* test/Makefile.in: Remove instrumentation for tramp-tests.
* test/lisp/net/tramp-tests.el (tramp-test36-asynchronous-requests):
Remove instrumentation. Wrap with a timeout. Give hydra
another timer value. Set `default-directory' in timer.
| -rw-r--r-- | test/Makefile.in | 3 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 232 |
2 files changed, 112 insertions, 123 deletions
diff --git a/test/Makefile.in b/test/Makefile.in index 11373db8ca9..414eca90564 100644 --- a/test/Makefile.in +++ b/test/Makefile.in | |||
| @@ -147,8 +147,7 @@ endif | |||
| 147 | %.log: %.elc | 147 | %.log: %.elc |
| 148 | $(AM_V_at)${MKDIR_P} $(dir $@) | 148 | $(AM_V_at)${MKDIR_P} $(dir $@) |
| 149 | $(AM_V_GEN)HOME=/nonexistent $(emacs) -l ert -l $(testloadfile) \ | 149 | $(AM_V_GEN)HOME=/nonexistent $(emacs) -l ert -l $(testloadfile) \ |
| 150 | --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" \ | 150 | --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG} |
| 151 | $(if $(and ${NIX_STORE}, $(findstring tramp, $(testloadfile))), , ${WRITE_LOG}) | ||
| 152 | 151 | ||
| 153 | ifeq (@HAVE_MODULES@, yes) | 152 | ifeq (@HAVE_MODULES@, yes) |
| 154 | maybe_exclude_module_tests := | 153 | maybe_exclude_module_tests := |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 03730ef7a84..31cf7f9ba1c 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -3689,130 +3689,120 @@ process sentinels. They shall not disturb each other." | |||
| 3689 | (skip-unless (tramp--test-enabled)) | 3689 | (skip-unless (tramp--test-enabled)) |
| 3690 | (skip-unless (tramp--test-sh-p)) | 3690 | (skip-unless (tramp--test-sh-p)) |
| 3691 | 3691 | ||
| 3692 | ;; This test times out on hydra. | 3692 | ;; This test could be blocked on hydra. |
| 3693 | (with-timeout | 3693 | (with-timeout |
| 3694 | (300 (ert-fail "`tramp-test36-asynchronous-requests' timed out")) | 3694 | (300 (ert-fail "`tramp-test36-asynchronous-requests' timed out")) |
| 3695 | (let* ((tmp-name (tramp--test-make-temp-name)) | 3695 | (let* ((tmp-name (tramp--test-make-temp-name)) |
| 3696 | (default-directory tmp-name) | 3696 | (default-directory tmp-name) |
| 3697 | ;; Do not cache Tramp properties. | 3697 | ;; Do not cache Tramp properties. |
| 3698 | (remote-file-name-inhibit-cache t) | 3698 | (remote-file-name-inhibit-cache t) |
| 3699 | (process-file-side-effects t) | 3699 | (process-file-side-effects t) |
| 3700 | ;; Suppress nasty messages. | 3700 | ;; Suppress nasty messages. |
| 3701 | (inhibit-message t) | 3701 | (inhibit-message t) |
| 3702 | (number-proc 10) | 3702 | (number-proc 10) |
| 3703 | ;; On hydra, timings are bad. | 3703 | ;; On hydra, timings are bad. |
| 3704 | (timer-repeat | 3704 | (timer-repeat |
| 3705 | (cond | 3705 | (cond |
| 3706 | ((getenv "NIX_STORE") 10) | 3706 | ((getenv "NIX_STORE") 10) |
| 3707 | (t 1))) | 3707 | (t 1))) |
| 3708 | ;; We must distinguish due to performance reasons. | 3708 | ;; We must distinguish due to performance reasons. |
| 3709 | (timer-operation | 3709 | (timer-operation |
| 3710 | (cond | 3710 | (cond |
| 3711 | ((string-equal "mock" (file-remote-p tmp-name 'method)) | 3711 | ((string-equal "mock" (file-remote-p tmp-name 'method)) |
| 3712 | 'vc-registered) | 3712 | 'vc-registered) |
| 3713 | (t 'file-attributes))) | 3713 | (t 'file-attributes))) |
| 3714 | timer buffers kill-buffer-query-functions) | 3714 | timer buffers kill-buffer-query-functions) |
| 3715 | 3715 | ||
| 3716 | (unwind-protect | 3716 | (unwind-protect |
| 3717 | (progn | 3717 | (progn |
| 3718 | (make-directory tmp-name) | 3718 | (make-directory tmp-name) |
| 3719 | 3719 | ||
| 3720 | ;; Setup a timer in order to raise an ordinary command again | 3720 | ;; Setup a timer in order to raise an ordinary command |
| 3721 | ;; and again. `vc-registered' is well suited, because there | 3721 | ;; again and again. `vc-registered' is well suited, |
| 3722 | ;; are many checks. | 3722 | ;; because there are many checks. |
| 3723 | (setq | 3723 | (setq |
| 3724 | timer | 3724 | timer |
| 3725 | (run-at-time | 3725 | (run-at-time |
| 3726 | 0 timer-repeat | 3726 | 0 timer-repeat |
| 3727 | (lambda () | 3727 | (lambda () |
| 3728 | (when buffers | 3728 | (when buffers |
| 3729 | (let ((default-directory tmp-name) | 3729 | (let ((default-directory tmp-name) |
| 3730 | (file | 3730 | (file |
| 3731 | (buffer-name (nth (random (length buffers)) buffers)))) | 3731 | (buffer-name (nth (random (length buffers)) buffers)))) |
| 3732 | (tramp--test-message | 3732 | (funcall timer-operation file)))))) |
| 3733 | "Start timer %s %s %s" | 3733 | |
| 3734 | timer-operation file (current-time-string)) | 3734 | ;; Create temporary buffers. The number of buffers |
| 3735 | (funcall timer-operation file) | 3735 | ;; corresponds to the number of processes; it could be |
| 3736 | (tramp--test-message | 3736 | ;; increased in order to make pressure on Tramp. |
| 3737 | "Stop timer %s %s %s" | 3737 | (dotimes (_i number-proc) |
| 3738 | timer-operation file (current-time-string))))))) | 3738 | (add-to-list 'buffers (generate-new-buffer "foo"))) |
| 3739 | 3739 | ||
| 3740 | ;; Create temporary buffers. The number of buffers | 3740 | ;; Open asynchronous processes. Set process filter and sentinel. |
| 3741 | ;; corresponds to the number of processes; it could be | 3741 | (dolist (buf buffers) |
| 3742 | ;; increased in order to make pressure on Tramp. | 3742 | (let ((proc |
| 3743 | (dotimes (_i number-proc) | 3743 | (start-file-process-shell-command |
| 3744 | (add-to-list 'buffers (generate-new-buffer "foo"))) | 3744 | (buffer-name buf) buf |
| 3745 | 3745 | (concat | |
| 3746 | ;; Open asynchronous processes. Set process sentinel. | 3746 | "(read line && echo $line >$line);" |
| 3747 | (dolist (buf buffers) | 3747 | "(read line && cat $line);" |
| 3748 | (tramp--test-message "Start process %s" buf) | 3748 | "(read line && rm $line)"))) |
| 3749 | (let ((proc | 3749 | (file (expand-file-name (buffer-name buf)))) |
| 3750 | (start-file-process-shell-command | 3750 | ;; Remember the file name. Add counter. |
| 3751 | (buffer-name buf) buf | 3751 | (process-put proc 'foo file) |
| 3752 | (concat | 3752 | (process-put proc 'bar 0) |
| 3753 | "(read line && echo $line >$line);" | 3753 | ;; Add process filter. |
| 3754 | "(read line && cat $line);" | 3754 | (set-process-filter |
| 3755 | "(read line && rm $line)"))) | 3755 | proc |
| 3756 | (file (expand-file-name (buffer-name buf)))) | 3756 | (lambda (proc string) |
| 3757 | ;; Remember the file name. Add counter. | 3757 | (with-current-buffer (process-buffer proc) |
| 3758 | (process-put proc 'foo file) | 3758 | (insert string)) |
| 3759 | (process-put proc 'bar 0) | 3759 | (unless (zerop (length string)) |
| 3760 | ;; Add process filter. | 3760 | (should (file-attributes (process-get proc 'foo)))))) |
| 3761 | (set-process-filter | 3761 | ;; Add process sentinel. |
| 3762 | proc | 3762 | (set-process-sentinel |
| 3763 | (lambda (proc string) | 3763 | proc |
| 3764 | (tramp--test-message "Process filter %s" proc) | 3764 | (lambda (proc _state) |
| 3765 | (with-current-buffer (process-buffer proc) | 3765 | (should-not (file-attributes (process-get proc 'foo))))))) |
| 3766 | (insert string)) | 3766 | |
| 3767 | (unless (zerop (length string)) | 3767 | ;; Send a string. Use a random order of the buffers. Mix |
| 3768 | (should (file-attributes (process-get proc 'foo)))))) | 3768 | ;; with regular operation. |
| 3769 | ;; Add process sentinel. | 3769 | (let ((buffers (copy-sequence buffers))) |
| 3770 | (set-process-sentinel | 3770 | (while buffers |
| 3771 | proc | 3771 | (let* ((buf (nth (random (length buffers)) buffers)) |
| 3772 | (lambda (proc _state) | 3772 | (proc (get-buffer-process buf)) |
| 3773 | (tramp--test-message "Process sentinel %s" proc) | 3773 | (file (process-get proc 'foo)) |
| 3774 | (should-not (file-attributes (process-get proc 'foo))))))) | 3774 | (count (process-get proc 'bar))) |
| 3775 | 3775 | ;; Regular operation. | |
| 3776 | ;; Send a string. Use a random order of the buffers. Mix | 3776 | (if (= count 0) |
| 3777 | ;; with regular operation. | 3777 | (should-not (file-attributes file)) |
| 3778 | (let ((buffers (copy-sequence buffers))) | 3778 | (should (file-attributes file))) |
| 3779 | (while buffers | 3779 | ;; Send string to process. |
| 3780 | (let* ((buf (nth (random (length buffers)) buffers)) | 3780 | (process-send-string proc (format "%s\n" (buffer-name buf))) |
| 3781 | (proc (get-buffer-process buf)) | 3781 | (accept-process-output proc 0.1 nil 0) |
| 3782 | (file (process-get proc 'foo)) | 3782 | ;; Regular operation. |
| 3783 | (count (process-get proc 'bar))) | 3783 | (if (= count 2) |
| 3784 | ;; Regular operation. | 3784 | (should-not (file-attributes file)) |
| 3785 | (if (= count 0) | 3785 | (should (file-attributes file))) |
| 3786 | (should-not (file-attributes file)) | 3786 | (process-put proc 'bar (1+ count)) |
| 3787 | (should (file-attributes file))) | 3787 | (unless (process-live-p proc) |
| 3788 | ;; Send string to process. | 3788 | (setq buffers (delq buf buffers)))))) |
| 3789 | (tramp--test-message "Send string %s" proc) | 3789 | |
| 3790 | (process-send-string proc (format "%s\n" (buffer-name buf))) | 3790 | ;; Checks. All process output shall exists in the |
| 3791 | (accept-process-output proc 0.1 nil 0) | 3791 | ;; respective buffers. All created files shall be |
| 3792 | ;; Regular operation. | 3792 | ;; deleted. |
| 3793 | (if (= count 2) | 3793 | (dolist (buf buffers) |
| 3794 | (should-not (file-attributes file)) | 3794 | (with-current-buffer buf |
| 3795 | (should (file-attributes file))) | 3795 | (should (string-equal (format "%s\n" buf) (buffer-string))))) |
| 3796 | (process-put proc 'bar (1+ count)) | 3796 | (should-not |
| 3797 | (unless (process-live-p proc) | 3797 | (directory-files |
| 3798 | (tramp--test-message "Buffer delete %s" buf) | 3798 | tmp-name nil directory-files-no-dot-files-regexp))) |
| 3799 | (setq buffers (delq buf buffers)))))) | 3799 | |
| 3800 | 3800 | ;; Cleanup. | |
| 3801 | ;; Checks. All process output shall exists in the | 3801 | (dolist (buf buffers) |
| 3802 | ;; respective buffers. All created files shall be deleted. | 3802 | (ignore-errors (delete-process (get-buffer-process buf))) |
| 3803 | (tramp--test-message "Checks %s" buffers) | 3803 | (ignore-errors (kill-buffer buf))) |
| 3804 | (dolist (buf buffers) | 3804 | (ignore-errors (cancel-timer timer)) |
| 3805 | (with-current-buffer buf | 3805 | (ignore-errors (delete-directory tmp-name 'recursive)))))) |
| 3806 | (should (string-equal (format "%s\n" buf) (buffer-string))))) | ||
| 3807 | (should-not | ||
| 3808 | (directory-files tmp-name nil directory-files-no-dot-files-regexp))) | ||
| 3809 | |||
| 3810 | ;; Cleanup. | ||
| 3811 | (dolist (buf buffers) | ||
| 3812 | (ignore-errors (delete-process (get-buffer-process buf))) | ||
| 3813 | (ignore-errors (kill-buffer buf))) | ||
| 3814 | (ignore-errors (cancel-timer timer)) | ||
| 3815 | (ignore-errors (delete-directory tmp-name 'recursive)))))) | ||
| 3816 | 3806 | ||
| 3817 | (ert-deftest tramp-test37-recursive-load () | 3807 | (ert-deftest tramp-test37-recursive-load () |
| 3818 | "Check that Tramp does not fail due to recursive load." | 3808 | "Check that Tramp does not fail due to recursive load." |