diff options
| author | Michael Albinus | 2019-01-29 17:26:14 +0100 |
|---|---|---|
| committer | Michael Albinus | 2019-01-29 17:26:14 +0100 |
| commit | b092a9afe613b3ff31071f9f01be743611501f64 (patch) | |
| tree | 786f59581b02565133f77e944a61cf1c7a1d6953 | |
| parent | 492b31d977c63a90ac703aebf7120a96026f93ef (diff) | |
| download | emacs-b092a9afe613b3ff31071f9f01be743611501f64.tar.gz emacs-b092a9afe613b3ff31071f9f01be743611501f64.zip | |
Adapt `accept-process-output' arguments in tramp-tests
* test/lisp/net/tramp-tests.el (tramp-test29-start-file-process)
(tramp-test30-make-process, tramp-test31-interrupt-process)
(tramp-test32-shell-command)
(tramp--test-shell-command-to-string-asynchronously)
(tramp-test43-asynchronous-requests):
Adapt `accept-process-output' arguments.
| -rw-r--r-- | test/lisp/net/tramp-archive-tests.el | 2 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 40 |
2 files changed, 18 insertions, 24 deletions
diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el index 0d0062e196a..1d9de39ae96 100644 --- a/test/lisp/net/tramp-archive-tests.el +++ b/test/lisp/net/tramp-archive-tests.el | |||
| @@ -515,7 +515,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 515 | (skip-unless tramp-archive-enabled) | 515 | (skip-unless tramp-archive-enabled) |
| 516 | 516 | ||
| 517 | (let ((tmp-name tramp-archive-test-archive) | 517 | (let ((tmp-name tramp-archive-test-archive) |
| 518 | (files '("." ".." "bar" "baz.tar" "foo.hrd" "foo.lnk" "foo.txt"))) | 518 | (files '("." ".." "bar" "baz.tar" "foo.hrd" "foo.lnk" "foo.txt"))) |
| 519 | (unwind-protect | 519 | (unwind-protect |
| 520 | (progn | 520 | (progn |
| 521 | (should (file-directory-p tmp-name)) | 521 | (should (file-directory-p tmp-name)) |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 7fa25f1baf3..c52f0092f60 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -3818,7 +3818,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3818 | ;; Read output. | 3818 | ;; Read output. |
| 3819 | (with-timeout (10 (ert-fail "`start-file-process' timed out")) | 3819 | (with-timeout (10 (ert-fail "`start-file-process' timed out")) |
| 3820 | (while (< (- (point-max) (point-min)) (length "foo")) | 3820 | (while (< (- (point-max) (point-min)) (length "foo")) |
| 3821 | (accept-process-output proc 0.1))) | 3821 | (while (accept-process-output proc 0 nil t)))) |
| 3822 | (should (string-equal (buffer-string) "foo"))) | 3822 | (should (string-equal (buffer-string) "foo"))) |
| 3823 | 3823 | ||
| 3824 | ;; Cleanup. | 3824 | ;; Cleanup. |
| @@ -3836,7 +3836,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3836 | ;; Read output. | 3836 | ;; Read output. |
| 3837 | (with-timeout (10 (ert-fail "`start-file-process' timed out")) | 3837 | (with-timeout (10 (ert-fail "`start-file-process' timed out")) |
| 3838 | (while (< (- (point-max) (point-min)) (length "foo")) | 3838 | (while (< (- (point-max) (point-min)) (length "foo")) |
| 3839 | (accept-process-output proc 0.1))) | 3839 | (while (accept-process-output proc 0 nil t)))) |
| 3840 | (should (string-equal (buffer-string) "foo"))) | 3840 | (should (string-equal (buffer-string) "foo"))) |
| 3841 | 3841 | ||
| 3842 | ;; Cleanup. | 3842 | ;; Cleanup. |
| @@ -3857,7 +3857,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3857 | ;; Read output. | 3857 | ;; Read output. |
| 3858 | (with-timeout (10 (ert-fail "`start-file-process' timed out")) | 3858 | (with-timeout (10 (ert-fail "`start-file-process' timed out")) |
| 3859 | (while (< (- (point-max) (point-min)) (length "foo")) | 3859 | (while (< (- (point-max) (point-min)) (length "foo")) |
| 3860 | (accept-process-output proc 0.1))) | 3860 | (while (accept-process-output proc 0 nil t)))) |
| 3861 | (should (string-equal (buffer-string) "foo"))) | 3861 | (should (string-equal (buffer-string) "foo"))) |
| 3862 | 3862 | ||
| 3863 | ;; Cleanup. | 3863 | ;; Cleanup. |
| @@ -3890,7 +3890,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3890 | ;; Read output. | 3890 | ;; Read output. |
| 3891 | (with-timeout (10 (ert-fail "`make-process' timed out")) | 3891 | (with-timeout (10 (ert-fail "`make-process' timed out")) |
| 3892 | (while (< (- (point-max) (point-min)) (length "foo")) | 3892 | (while (< (- (point-max) (point-min)) (length "foo")) |
| 3893 | (accept-process-output proc 0.1))) | 3893 | (while (accept-process-output proc 0 nil t)))) |
| 3894 | (should (string-equal (buffer-string) "foo"))) | 3894 | (should (string-equal (buffer-string) "foo"))) |
| 3895 | 3895 | ||
| 3896 | ;; Cleanup. | 3896 | ;; Cleanup. |
| @@ -3910,7 +3910,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3910 | ;; Read output. | 3910 | ;; Read output. |
| 3911 | (with-timeout (10 (ert-fail "`make-process' timed out")) | 3911 | (with-timeout (10 (ert-fail "`make-process' timed out")) |
| 3912 | (while (< (- (point-max) (point-min)) (length "foo")) | 3912 | (while (< (- (point-max) (point-min)) (length "foo")) |
| 3913 | (accept-process-output proc 0.1))) | 3913 | (while (accept-process-output proc 0 nil t)))) |
| 3914 | (should (string-equal (buffer-string) "foo"))) | 3914 | (should (string-equal (buffer-string) "foo"))) |
| 3915 | 3915 | ||
| 3916 | ;; Cleanup. | 3916 | ;; Cleanup. |
| @@ -3935,7 +3935,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3935 | ;; Read output. | 3935 | ;; Read output. |
| 3936 | (with-timeout (10 (ert-fail "`make-process' timed out")) | 3936 | (with-timeout (10 (ert-fail "`make-process' timed out")) |
| 3937 | (while (< (- (point-max) (point-min)) (length "foo")) | 3937 | (while (< (- (point-max) (point-min)) (length "foo")) |
| 3938 | (accept-process-output proc 0.1))) | 3938 | (while (accept-process-output proc 0 nil t)))) |
| 3939 | (should (string-equal (buffer-string) "foo"))) | 3939 | (should (string-equal (buffer-string) "foo"))) |
| 3940 | 3940 | ||
| 3941 | ;; Cleanup. | 3941 | ;; Cleanup. |
| @@ -3958,8 +3958,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3958 | (delete-process proc) | 3958 | (delete-process proc) |
| 3959 | ;; Read output. | 3959 | ;; Read output. |
| 3960 | (with-timeout (10 (ert-fail "`make-process' timed out")) | 3960 | (with-timeout (10 (ert-fail "`make-process' timed out")) |
| 3961 | (while (process-live-p proc) | 3961 | (while (accept-process-output proc 0 nil t))) |
| 3962 | (accept-process-output proc 0.1))) | ||
| 3963 | (should (string-equal (buffer-string) "killed\n"))) | 3962 | (should (string-equal (buffer-string) "killed\n"))) |
| 3964 | 3963 | ||
| 3965 | ;; Cleanup. | 3964 | ;; Cleanup. |
| @@ -3980,7 +3979,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3980 | (with-current-buffer stderr | 3979 | (with-current-buffer stderr |
| 3981 | (with-timeout (10 (ert-fail "`make-process' timed out")) | 3980 | (with-timeout (10 (ert-fail "`make-process' timed out")) |
| 3982 | (while (= (point-min) (point-max)) | 3981 | (while (= (point-min) (point-max)) |
| 3983 | (accept-process-output proc 0.1))) | 3982 | (while (accept-process-output proc 0 nil t)))) |
| 3984 | (should | 3983 | (should |
| 3985 | (string-equal (buffer-string) "cat: /: Is a directory\n")))) | 3984 | (string-equal (buffer-string) "cat: /: Is a directory\n")))) |
| 3986 | 3985 | ||
| @@ -4007,7 +4006,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4007 | (should (numberp (process-get proc 'remote-pid))) | 4006 | (should (numberp (process-get proc 'remote-pid))) |
| 4008 | (should (interrupt-process proc)) | 4007 | (should (interrupt-process proc)) |
| 4009 | ;; Let the process accept the interrupt. | 4008 | ;; Let the process accept the interrupt. |
| 4010 | (accept-process-output proc 1 nil 0) | 4009 | (while (accept-process-output proc nil nil 0)) |
| 4011 | (should-not (process-live-p proc)) | 4010 | (should-not (process-live-p proc)) |
| 4012 | ;; An interrupted process cannot be interrupted, again. | 4011 | ;; An interrupted process cannot be interrupted, again. |
| 4013 | (should-error (interrupt-process proc) :type 'error)) | 4012 | (should-error (interrupt-process proc) :type 'error)) |
| @@ -4056,10 +4055,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4056 | (current-buffer)) | 4055 | (current-buffer)) |
| 4057 | ;; Read output. | 4056 | ;; Read output. |
| 4058 | (with-timeout (10 (ert-fail "`async-shell-command' timed out")) | 4057 | (with-timeout (10 (ert-fail "`async-shell-command' timed out")) |
| 4059 | (while (< (- (point-max) (point-min)) | 4058 | (while (accept-process-output |
| 4060 | (1+ (length (file-name-nondirectory tmp-name)))) | 4059 | (get-buffer-process (current-buffer)) nil nil t))) |
| 4061 | (accept-process-output | ||
| 4062 | (get-buffer-process (current-buffer)) 0.1))) | ||
| 4063 | ;; `ls' could produce colorized output. | 4060 | ;; `ls' could produce colorized output. |
| 4064 | (goto-char (point-min)) | 4061 | (goto-char (point-min)) |
| 4065 | (while | 4062 | (while |
| @@ -4087,10 +4084,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4087 | (format "%s\n" (file-name-nondirectory tmp-name))) | 4084 | (format "%s\n" (file-name-nondirectory tmp-name))) |
| 4088 | ;; Read output. | 4085 | ;; Read output. |
| 4089 | (with-timeout (10 (ert-fail "`async-shell-command' timed out")) | 4086 | (with-timeout (10 (ert-fail "`async-shell-command' timed out")) |
| 4090 | (while (< (- (point-max) (point-min)) | 4087 | (while (accept-process-output |
| 4091 | (1+ (length (file-name-nondirectory tmp-name)))) | 4088 | (get-buffer-process (current-buffer)) nil nil t))) |
| 4092 | (accept-process-output | ||
| 4093 | (get-buffer-process (current-buffer)) 0.1))) | ||
| 4094 | ;; `ls' could produce colorized output. | 4089 | ;; `ls' could produce colorized output. |
| 4095 | (goto-char (point-min)) | 4090 | (goto-char (point-min)) |
| 4096 | (while | 4091 | (while |
| @@ -4112,10 +4107,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4112 | "Like `shell-command-to-string', but for asynchronous processes." | 4107 | "Like `shell-command-to-string', but for asynchronous processes." |
| 4113 | (with-temp-buffer | 4108 | (with-temp-buffer |
| 4114 | (async-shell-command command (current-buffer)) | 4109 | (async-shell-command command (current-buffer)) |
| 4115 | (with-timeout (10) | 4110 | (with-timeout (10 (ert-fail "`async-shell-command-to-string' timed out")) |
| 4116 | (while (get-buffer-process (current-buffer)) | 4111 | (while (accept-process-output |
| 4117 | (accept-process-output (get-buffer-process (current-buffer)) 0.1))) | 4112 | (get-buffer-process (current-buffer)) nil nil t))) |
| 4118 | (accept-process-output nil 0.1) | ||
| 4119 | (buffer-substring-no-properties (point-min) (point-max)))) | 4113 | (buffer-substring-no-properties (point-min) (point-max)))) |
| 4120 | 4114 | ||
| 4121 | ;; This test is inspired by Bug#23952. | 4115 | ;; This test is inspired by Bug#23952. |
| @@ -5359,7 +5353,7 @@ process sentinels. They shall not disturb each other." | |||
| 5359 | (should (file-attributes file))) | 5353 | (should (file-attributes file))) |
| 5360 | ;; Send string to process. | 5354 | ;; Send string to process. |
| 5361 | (process-send-string proc (format "%s\n" (buffer-name buf))) | 5355 | (process-send-string proc (format "%s\n" (buffer-name buf))) |
| 5362 | (accept-process-output proc 0.1 nil 0) | 5356 | (while (accept-process-output proc 0 nil 0)) |
| 5363 | ;; Give the watchdog a chance. | 5357 | ;; Give the watchdog a chance. |
| 5364 | (read-event nil nil 0.01) | 5358 | (read-event nil nil 0.01) |
| 5365 | (tramp--test-message | 5359 | (tramp--test-message |