* Re: emacs-26 b3e2073 4/4: Fix subproc listening when setting filter to non-t (Bug#36591) [not found] ` <20190725223624.B5F4920C06@vcs0.savannah.gnu.org> @ 2019-08-22 19:12 ` Michael Albinus 2019-08-23 0:54 ` Noam Postavsky 0 siblings, 1 reply; 4+ messages in thread From: Michael Albinus @ 2019-08-22 19:12 UTC (permalink / raw) To: Noam Postavsky; +Cc: emacs-devel npostavs@gmail.com (Noam Postavsky) writes: Hi Noam, > --- a/test/src/process-tests.el > +++ b/test/src/process-tests.el > @@ -144,6 +144,35 @@ > (should (equal "hello stderr!\n" > (mapconcat #'identity (nreverse stderr-output) ""))))) > > +(ert-deftest set-process-filter-t () > + "Test setting process filter to t and back." ;; Bug#36591 > + (with-temp-buffer > + (let* ((print-level nil) > + (print-length nil) > + (proc (start-process > + "test proc" (current-buffer) > + (concat invocation-directory invocation-name) > + "-Q" "--batch" "--eval" > + (prin1-to-string > + '(let (s) > + (while (setq s (read-from-minibuffer "$ ")) > + (princ s) > + (princ "\n"))))))) > + (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$ ")) > + (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$ ")) > + (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$ "))))) This fails on emba occasionally, see for example <https://emba.gnu.org/emacs/emacs/-/jobs/3076>. Best regards, Michael. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: emacs-26 b3e2073 4/4: Fix subproc listening when setting filter to non-t (Bug#36591) 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 2019-08-24 16:21 ` Noam Postavsky 0 siblings, 1 reply; 4+ messages in thread From: Noam Postavsky @ 2019-08-23 0:54 UTC (permalink / raw) To: Michael Albinus; +Cc: Emacs developers [-- 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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: emacs-26 b3e2073 4/4: Fix subproc listening when setting filter to non-t (Bug#36591) 2019-08-23 0:54 ` Noam Postavsky @ 2019-08-24 16:21 ` Noam Postavsky 2019-08-24 18:28 ` Michael Albinus 0 siblings, 1 reply; 4+ messages in thread From: Noam Postavsky @ 2019-08-24 16:21 UTC (permalink / raw) To: Michael Albinus; +Cc: Emacs developers On Thu, 22 Aug 2019 at 20:54, Noam Postavsky <npostavs@gmail.com> wrote: > 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...? Since the emacs-26 branch is supposed to be frozen I've pushed to master for now. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: emacs-26 b3e2073 4/4: Fix subproc listening when setting filter to non-t (Bug#36591) 2019-08-24 16:21 ` Noam Postavsky @ 2019-08-24 18:28 ` Michael Albinus 0 siblings, 0 replies; 4+ messages in thread From: Michael Albinus @ 2019-08-24 18:28 UTC (permalink / raw) To: Noam Postavsky; +Cc: Emacs developers Noam Postavsky <npostavs@gmail.com> writes: > Since the emacs-26 branch is supposed to be frozen I've pushed to > master for now. Thanks! Best regards, Michael. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-08-24 18:28 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [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 2019-08-24 16:21 ` Noam Postavsky 2019-08-24 18:28 ` Michael Albinus
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.