diff options
| author | Mattias EngdegÄrd | 2019-12-30 14:10:02 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2019-12-30 21:00:27 +0100 |
| commit | 206531674947789841a61bd428dd6babce933a0d (patch) | |
| tree | c9c8eb41c1b569c5a6c9735751622f1ae34488ac | |
| parent | 59f71d20eade09e6c2ef99fc4d9b99a161bff040 (diff) | |
| download | emacs-206531674947789841a61bd428dd6babce933a0d.tar.gz emacs-206531674947789841a61bd428dd6babce933a0d.zip | |
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.
| -rw-r--r-- | test/lisp/comint-tests.el | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el index c04134599f6..4c1c5cc5e20 100644 --- a/test/lisp/comint-tests.el +++ b/test/lisp/comint-tests.el | |||
| @@ -64,10 +64,10 @@ alter normal password flow." | |||
| 64 | (with-temp-buffer | 64 | (with-temp-buffer |
| 65 | (make-comint-in-buffer "test-comint-password" (current-buffer) cat) | 65 | (make-comint-in-buffer "test-comint-password" (current-buffer) cat) |
| 66 | (let ((proc (get-buffer-process (current-buffer)))) | 66 | (let ((proc (get-buffer-process (current-buffer)))) |
| 67 | (set-process-query-on-exit-flag proc nil) | ||
| 67 | (comint-send-string proc "Password: ") | 68 | (comint-send-string proc "Password: ") |
| 68 | (accept-process-output proc 0 1 t) | ||
| 69 | (comint-send-eof) | 69 | (comint-send-eof) |
| 70 | (accept-process-output proc 0 1 t) | 70 | (while (accept-process-output proc 0.1 nil t)) |
| 71 | (should (string-equal (buffer-substring-no-properties (point-min) (point-max)) | 71 | (should (string-equal (buffer-substring-no-properties (point-min) (point-max)) |
| 72 | "Password: PaSsWoRd123\n")) | 72 | "Password: PaSsWoRd123\n")) |
| 73 | (when (process-live-p proc) | 73 | (when (process-live-p proc) |
| @@ -87,10 +87,10 @@ flow. Hook function returns alternative password." | |||
| 87 | (with-temp-buffer | 87 | (with-temp-buffer |
| 88 | (make-comint-in-buffer "test-comint-password" (current-buffer) cat) | 88 | (make-comint-in-buffer "test-comint-password" (current-buffer) cat) |
| 89 | (let ((proc (get-buffer-process (current-buffer)))) | 89 | (let ((proc (get-buffer-process (current-buffer)))) |
| 90 | (set-process-query-on-exit-flag proc nil) | ||
| 90 | (comint-send-string proc "Password: ") | 91 | (comint-send-string proc "Password: ") |
| 91 | (accept-process-output proc 0 1 t) | ||
| 92 | (comint-send-eof) | 92 | (comint-send-eof) |
| 93 | (accept-process-output proc 0 1 t) | 93 | (while (accept-process-output proc 0.1 nil t)) |
| 94 | (should (string-equal (buffer-substring-no-properties (point-min) (point-max)) | 94 | (should (string-equal (buffer-substring-no-properties (point-min) (point-max)) |
| 95 | "Password: MaGiC-PaSsWoRd789\n")) | 95 | "Password: MaGiC-PaSsWoRd789\n")) |
| 96 | (when (process-live-p proc) | 96 | (when (process-live-p proc) |
| @@ -110,10 +110,10 @@ password flow if it returns a nil value." | |||
| 110 | (with-temp-buffer | 110 | (with-temp-buffer |
| 111 | (make-comint-in-buffer "test-comint-password" (current-buffer) cat) | 111 | (make-comint-in-buffer "test-comint-password" (current-buffer) cat) |
| 112 | (let ((proc (get-buffer-process (current-buffer)))) | 112 | (let ((proc (get-buffer-process (current-buffer)))) |
| 113 | (set-process-query-on-exit-flag proc nil) | ||
| 113 | (comint-send-string proc "Password: ") | 114 | (comint-send-string proc "Password: ") |
| 114 | (accept-process-output proc 0 1 t) | ||
| 115 | (comint-send-eof) | 115 | (comint-send-eof) |
| 116 | (accept-process-output proc 0 1 t) | 116 | (while (accept-process-output proc 0.1 nil t)) |
| 117 | (should (string-equal (buffer-substring-no-properties (point-min) (point-max)) | 117 | (should (string-equal (buffer-substring-no-properties (point-min) (point-max)) |
| 118 | "Password: PaSsWoRd456\n")) | 118 | "Password: PaSsWoRd456\n")) |
| 119 | (when (process-live-p proc) | 119 | (when (process-live-p proc) |