From: Noam Postavsky <npostavs@gmail.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: emacs-26 b3e2073 4/4: Fix subproc listening when setting filter to non-t (Bug#36591)
Date: Thu, 22 Aug 2019 20:54:07 -0400 [thread overview]
Message-ID: <CAM-tV-_PxoCwtETxKD2cnbFFsK=qydRU+5rMGpcrK3xz3K63AQ@mail.gmail.com> (raw)
In-Reply-To: <87o90hypyo.fsf@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 512 bytes --]
On Thu, 22 Aug 2019 at 15:12, Michael Albinus <michael.albinus@gmx.de> wrote:
> > + (should
> > + (accept-process-output proc 1)) ; Read "one".
> > + (should (equal (buffer-string) "$ one\n$ "))
> This fails on emba occasionally, see for example
> <https://emba.gnu.org/emacs/emacs/-/jobs/3076>.
Ah right, I wrongly assumed all the output would come in a single
chunk. Attached patch should fix it, should I push to emacs-26 since
tests are not included in the tarball release anyway? Or...?
[-- Attachment #2: 0001-Fix-non-deterministic-process-test.patch --]
[-- Type: text/x-diff, Size: 2653 bytes --]
From 1c1def35e9d46dd8e0e38589b768477f917d9bec Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Thu, 22 Aug 2019 20:48:19 -0400
Subject: [PATCH] Fix non-deterministic process test
* test/src/process-tests.el (set-process-filter-t): Don't assume
subprocess output will come in a single chunk, keep waiting for more
data until next "prompt" is read from subprocess.
---
test/src/process-tests.el | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/test/src/process-tests.el b/test/src/process-tests.el
index 7a6762a922..ef057af6b7 100644
--- a/test/src/process-tests.el
+++ b/test/src/process-tests.el
@@ -154,24 +154,30 @@ set-process-filter-t
(concat invocation-directory invocation-name)
"-Q" "--batch" "--eval"
(prin1-to-string
- '(let (s)
- (while (setq s (read-from-minibuffer "$ "))
+ '(let ((s nil) (count 0))
+ (while (setq s (read-from-minibuffer
+ (format "%d> " count)))
(princ s)
- (princ "\n")))))))
+ (princ "\n")
+ (setq count (1+ count))))))))
(set-process-query-on-exit-flag proc nil)
(send-string proc "one\n")
- (should
- (accept-process-output proc 1)) ; Read "one".
- (should (equal (buffer-string) "$ one\n$ "))
+ (while (not (equal (buffer-substring
+ (line-beginning-position) (point-max))
+ "1> "))
+ (accept-process-output proc)) ; Read "one".
+ (should (equal (buffer-string) "0> one\n1> "))
(set-process-filter proc t) ; Stop reading from proc.
(send-string proc "two\n")
(should-not
(accept-process-output proc 1)) ; Can't read "two" yet.
- (should (equal (buffer-string) "$ one\n$ "))
+ (should (equal (buffer-string) "0> one\n1> "))
(set-process-filter proc nil) ; Resume reading from proc.
- (should
- (accept-process-output proc 1)) ; Read "two" from proc.
- (should (equal (buffer-string) "$ one\n$ two\n$ ")))))
+ (while (not (equal (buffer-substring
+ (line-beginning-position) (point-max))
+ "2> "))
+ (accept-process-output proc)) ; Read "Two".
+ (should (equal (buffer-string) "0> one\n1> two\n2> ")))))
(ert-deftest start-process-should-not-modify-arguments ()
"`start-process' must not modify its arguments in-place."
--
2.11.0
next prev parent reply other threads:[~2019-08-23 0:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190725223622.30077.68533@vcs0.savannah.gnu.org>
[not found] ` <20190725223624.B5F4920C06@vcs0.savannah.gnu.org>
2019-08-22 19:12 ` emacs-26 b3e2073 4/4: Fix subproc listening when setting filter to non-t (Bug#36591) Michael Albinus
2019-08-23 0:54 ` Noam Postavsky [this message]
2019-08-24 16:21 ` Noam Postavsky
2019-08-24 18:28 ` Michael Albinus
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAM-tV-_PxoCwtETxKD2cnbFFsK=qydRU+5rMGpcrK3xz3K63AQ@mail.gmail.com' \
--to=npostavs@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=michael.albinus@gmx.de \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.