emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Leo Butler <Leo.Butler@umanitoba.ca>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] lisp/ob-octave.el, was [PATCH] rfc: using ert-deftest with side-effects
Date: Thu, 5 Jan 2023 20:08:56 +0000	[thread overview]
Message-ID: <87358ovj53.fsf@t14.reltub.ca> (raw)
In-Reply-To: <87bknh5nva.fsf@localhost> (Ihor Radchenko's message of "Mon, 02 Jan 2023 08:42:17 +0000")

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

On Mon, Jan 02 2023, Ihor Radchenko <yantar92@posteo.net> wrote:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> Ihor Radchenko <yantar92@posteo.net> writes:
>>
>>>> There is a race condition between writing the contents of the graphics
>>>> file to disk and emacs checking the file size. My guess is that this is
>>>> causing the problem (and that the same failure applies for emacs-2{6,7},
>>>> since only the emacs-28 reports the exact test failure).
>>>
>>> Maybe we can just add several `sleep-for' calls to the test?
>>
>> I just did this. Let's see if CI errs again.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=e5c45358a
>
> Apparently, `sleep-for' 1 second was not enough, and I decided to remove
> checking file size completely.

Hello Ihor,

Is there an environment variable that could be used to determine is the
tests are being run on sourcehut? This would let us cut out that test on
sourcehut, while still keeping it elsewhere.

>
> Upon doing this, another failure popped up. This time, it looks like an
> actual Elisp issue:
>
> https://builds.sr.ht/~bzg/job/914954
> 2 unexpected results:
>    FAILED  ob-octave/graphics-file  ((should-not (get-buffer "*Org-Babel
>    Error Output*")) :form (get-buffer "*Org-Babel Error Output*") :value
>    #<killed buffer>) 
>    FAILED  ob-octave/graphics-file-space  ((should-not (get-buffer
>    "*Org-Babel Error Output*")) :form (get-buffer "*Org-Babel Error
>    Output*") :value #<killed buffer>) 
>
> As you can see *Org-Babel Error Output* buffer does not exist when
> running the test.
>
> Leo, could you please take a look?

An earlier test is creating that *Org Babel Error Output* buffer. That
is killed on the first test, before the test is actually run. But
GET-BUFFER behaves in an undocumented way: it returns a non-nil value,
#<killed buffer>. To remedy that, I have wrapped the calls in
BUFFER-LIVE-P.

See the attached patch.

Leo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-test-ob-octave.el-wrap-get-buffer-in-buffer-live-p.patch --]
[-- Type: text/x-diff; name="0001-test-ob-octave.el-wrap-get-buffer-in-buffer-live-p.patch", Size: 2172 bytes --]

From b84f2f50b88fe6da3dcca3d751f6d75f7177ddaf Mon Sep 17 00:00:00 2001
From: Leo Butler <leo.butler@umanitoba.ca>
Date: Thu, 5 Jan 2023 13:53:44 -0600
Subject: [PATCH] test-ob-octave.el: wrap get-buffer in buffer-live-p

* testing/lisp/test-ob-octave.el (ob-octave/graphics-file):
(ob-octave/graphics-file-session):
(ob-octave/graphics-file-space): Wrap GET-BUFFER in BUFFER-LIVE-P.
This ensures that a killed buffer does not cause an incorrect failure
of a test.

Link: https://orgmode.org/list/87bknh5nva.fsf@localhost
---
 testing/lisp/test-ob-octave.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/testing/lisp/test-ob-octave.el b/testing/lisp/test-ob-octave.el
index 4e9fea97b..0b8ecea3b 100644
--- a/testing/lisp/test-ob-octave.el
+++ b/testing/lisp/test-ob-octave.el
@@ -79,7 +79,7 @@ sombrero;
           (org-babel-execute-src-block)
           (should (search-forward (format "[[file:%s]]" file) nil nil))
           (should (file-readable-p file))
-          (should-not (get-buffer "*Org-Babel Error Output*")))
+          (should-not (buffer-live-p (get-buffer "*Org-Babel Error Output*"))))
       ;; clean-up
       (delete-file file)
       (when (get-buffer "*Org-Babel Error Output*")
@@ -99,7 +99,7 @@ sombrero;
           (should (get-buffer "*Inferior Octave*"))
           (should (search-forward (format "[[file:%s]]" file) nil nil))
           (should (file-readable-p file))
-          (should-not (get-buffer "*Org-Babel Error Output*")))
+          (should-not (buffer-live-p (get-buffer "*Org-Babel Error Output*"))))
       ;; clean-up
       (delete-file file)
       (let (kill-buffer-query-functions kill-buffer-hook)
@@ -119,7 +119,7 @@ sombrero;
           (org-babel-execute-src-block)
           (should (search-forward (format "[[file:%s]]" file) nil nil))
           (should (file-readable-p file))
-          (should-not (get-buffer "*Org-Babel Error Output*")))
+          (should-not (buffer-live-p (get-buffer "*Org-Babel Error Output*"))))
       ;; clean-up
       (delete-file file)
       (when (get-buffer "*Org-Babel Error Output*")
-- 
2.39.0


  reply	other threads:[~2023-01-05 20:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 17:03 [PATCH] rfc: using ert-deftest with side-effects Leo Butler
2022-11-08  7:40 ` Ihor Radchenko
2022-11-08 19:55   ` [PATCH] lisp/ob-octave.el, was " Leo Butler
2022-11-09  5:14     ` Ihor Radchenko
2022-11-09 20:33       ` Leo Butler
2022-11-14  1:56         ` Ihor Radchenko
2022-11-15 19:43           ` Leo Butler
2022-12-17  8:25             ` Ihor Radchenko
2022-12-17 10:06               ` Ihor Radchenko
2022-12-21 11:56                 ` Ihor Radchenko
2022-12-22 13:32                   ` Leo Butler
2022-12-27 14:45                     ` Ihor Radchenko
2022-12-29  9:54                       ` Ihor Radchenko
2023-01-02  8:42                         ` Ihor Radchenko
2023-01-05 20:08                           ` Leo Butler [this message]
2023-01-06 15:11                             ` Ihor Radchenko
2023-01-07  3:08                               ` Leo Butler
2023-01-10 20:30                                 ` Leo Butler
2023-01-11 11:15                                   ` Ihor Radchenko
2023-01-11 21:51                                     ` Leo Butler
2023-01-12  8:42                                       ` Ihor Radchenko
2023-01-13 18:00                                     ` Ihor Radchenko
2023-01-14 13:04                                       ` Leo Butler
2023-01-14 13:13                                         ` Ihor Radchenko
2023-01-14 15:16                                         ` Max Nikulin
2023-01-23 10:32                                       ` Ihor Radchenko
2023-01-24 18:08                                         ` Leo Butler
2023-01-07 12:48                               ` Ihor Radchenko

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.orgmode.org/

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

  git send-email \
    --in-reply-to=87358ovj53.fsf@t14.reltub.ca \
    --to=leo.butler@umanitoba.ca \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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/org-mode.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).