Skip to content

Commit 2065316

Browse files
committed
Make comint-tests more robust (bug#38813)
* test/lisp/comint-tests.el (comint-test-no-password-function) (comint-test-password-function-with-value) (comint-test-password-function-with-nil): Call accept-process-output as many times as needed, with a slightly more generous timeout (100 ms), after sending the Password: prompt to the process, since there must be time for some back-and-forth communication. Also clear the process-query-on-exit flag, since it doesn't go well with noninteractive tests.
1 parent 59f71d2 commit 2065316

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/lisp/comint-tests.el

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ alter normal password flow."
6464
(with-temp-buffer
6565
(make-comint-in-buffer "test-comint-password" (current-buffer) cat)
6666
(let ((proc (get-buffer-process (current-buffer))))
67+
(set-process-query-on-exit-flag proc nil)
6768
(comint-send-string proc "Password: ")
68-
(accept-process-output proc 0 1 t)
6969
(comint-send-eof)
70-
(accept-process-output proc 0 1 t)
70+
(while (accept-process-output proc 0.1 nil t))
7171
(should (string-equal (buffer-substring-no-properties (point-min) (point-max))
7272
"Password: PaSsWoRd123\n"))
7373
(when (process-live-p proc)
@@ -87,10 +87,10 @@ flow. Hook function returns alternative password."
8787
(with-temp-buffer
8888
(make-comint-in-buffer "test-comint-password" (current-buffer) cat)
8989
(let ((proc (get-buffer-process (current-buffer))))
90+
(set-process-query-on-exit-flag proc nil)
9091
(comint-send-string proc "Password: ")
91-
(accept-process-output proc 0 1 t)
9292
(comint-send-eof)
93-
(accept-process-output proc 0 1 t)
93+
(while (accept-process-output proc 0.1 nil t))
9494
(should (string-equal (buffer-substring-no-properties (point-min) (point-max))
9595
"Password: MaGiC-PaSsWoRd789\n"))
9696
(when (process-live-p proc)
@@ -110,10 +110,10 @@ password flow if it returns a nil value."
110110
(with-temp-buffer
111111
(make-comint-in-buffer "test-comint-password" (current-buffer) cat)
112112
(let ((proc (get-buffer-process (current-buffer))))
113+
(set-process-query-on-exit-flag proc nil)
113114
(comint-send-string proc "Password: ")
114-
(accept-process-output proc 0 1 t)
115115
(comint-send-eof)
116-
(accept-process-output proc 0 1 t)
116+
(while (accept-process-output proc 0.1 nil t))
117117
(should (string-equal (buffer-substring-no-properties (point-min) (point-max))
118118
"Password: PaSsWoRd456\n"))
119119
(when (process-live-p proc)

0 commit comments

Comments
 (0)