unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: 38813@debbugs.gnu.org
Cc: "Michael R. Mauger" <michael@mauger.com>
Subject: bug#38813: Make comint-tests more robust
Date: Mon, 30 Dec 2019 14:57:03 +0100	[thread overview]
Message-ID: <B7384FCA-DC62-450C-91E3-C6252F57319C@acm.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 169 bytes --]

There seem to be races in the new comint-tests; they frequently hang and/or fail when run (make check) on macOS.
This patch should improve matters. OK for emacs-27?


[-- Attachment #2: 0001-Make-comint-tests-more-robust.patch --]
[-- Type: application/octet-stream, Size: 3303 bytes --]

From b5ec344dc37408bc97385476767df953a47d0061 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
Date: Mon, 30 Dec 2019 14:10:02 +0100
Subject: [PATCH] Make comint-tests more robust

* 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 twice, 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.
---
 test/lisp/comint-tests.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el
index c04134599f..9960f5e65d 100644
--- a/test/lisp/comint-tests.el
+++ b/test/lisp/comint-tests.el
@@ -64,10 +64,11 @@ comint-test-no-password-function
         (with-temp-buffer
           (make-comint-in-buffer "test-comint-password" (current-buffer) cat)
           (let ((proc (get-buffer-process (current-buffer))))
+            (set-process-query-on-exit-flag proc nil)
             (comint-send-string proc "Password: ")
-            (accept-process-output proc 0 1 t)
             (comint-send-eof)
-            (accept-process-output proc 0 1 t)
+            (accept-process-output proc 0 100 t)
+            (accept-process-output proc 0 100 t)
             (should (string-equal (buffer-substring-no-properties (point-min) (point-max))
                                   "Password: PaSsWoRd123\n"))
             (when (process-live-p proc)
@@ -87,10 +88,11 @@ comint-test-password-function-with-value
         (with-temp-buffer
           (make-comint-in-buffer "test-comint-password" (current-buffer) cat)
           (let ((proc (get-buffer-process (current-buffer))))
+            (set-process-query-on-exit-flag proc nil)
             (comint-send-string proc "Password: ")
-            (accept-process-output proc 0 1 t)
             (comint-send-eof)
-            (accept-process-output proc 0 1 t)
+            (accept-process-output proc 0 100 t)
+            (accept-process-output proc 0 100 t)
             (should (string-equal (buffer-substring-no-properties (point-min) (point-max))
                                   "Password: MaGiC-PaSsWoRd789\n"))
             (when (process-live-p proc)
@@ -110,10 +112,11 @@ comint-test-password-function-with-nil
         (with-temp-buffer
           (make-comint-in-buffer "test-comint-password" (current-buffer) cat)
           (let ((proc (get-buffer-process (current-buffer))))
+            (set-process-query-on-exit-flag proc nil)
             (comint-send-string proc "Password: ")
-            (accept-process-output proc 0 1 t)
             (comint-send-eof)
-            (accept-process-output proc 0 1 t)
+            (accept-process-output proc 0 100 t)
+            (accept-process-output proc 0 100 t)
             (should (string-equal (buffer-substring-no-properties (point-min) (point-max))
                                   "Password: PaSsWoRd456\n"))
             (when (process-live-p proc)
-- 
2.21.0 (Apple Git-122.2)


             reply	other threads:[~2019-12-30 13:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-30 13:57 Mattias Engdegård [this message]
2019-12-30 15:20 ` bug#38813: Make comint-tests more robust Michael Albinus
2019-12-30 16:19   ` Mattias Engdegård
2019-12-30 18:28     ` Michael Albinus
2019-12-30 20:05       ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B7384FCA-DC62-450C-91E3-C6252F57319C@acm.org \
    --to=mattiase@acm.org \
    --cc=38813@debbugs.gnu.org \
    --cc=michael@mauger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).