From: Eli Zaretskii <eliz@gnu.org>
To: Pip Cet <pipcet@protonmail.com>,
Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 71988@debbugs.gnu.org
Subject: bug#71988: 31.0.50; ert-test-run-tests-batch-expensive runs out of memory if previous tests failed
Date: Mon, 08 Jul 2024 14:17:26 +0300 [thread overview]
Message-ID: <868qyc16bd.fsf@gnu.org> (raw)
In-Reply-To: <cVt0dZOYriBO6Tpo1lJSHrnbA6ttTZvZIClty3TCFUNMfHf66UhbHi7A329CLnWz5ueIn3ypvcKDLsBynBK8wzd41YA29AKEPDgokIrVsqs=@protonmail.com> (bug-gnu-emacs@gnu.org)
> Date: Mon, 08 Jul 2024 04:49:54 +0000
> From: Pip Cet via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> This bug report is mostly to get a bug number to put in the patch :-).
>
> The test `ert-test-run-tests-batch-expensive' overrides print settings
> and prints a full backtrace to a temporary buffer repeatedly. If a
> previous test, such as `ert-test-run-tests-batch', failed, this
> eventually runs out of memory even on a 64 GB system.
>
> For example, one can add "(should nil)" to ert-test-run-tests-batch and
> run:
>
> $ make -C test lisp/emacs-lisp/ert-tests
>
> The problem is the ert--stats structure's tests vector is being printed,
> which recursively prints all previous tests' data.
>
> A possible fix is to temporarily override cl-print-object for either
> vectors or the ert--stats object to print nothing.
>
> Unfortunately, we don't appear to have an official mechanism for
> temporarily calling cl-defmethod, such as a generalized variable one can
> cl-letf to. The patch does that by running cl-defmethod inside a
> (cl-letf* (((symbol-function 'cl-print-object) (symbol-function
> 'cl-print-object))) ...) form. As future changes to cl-generic might
> break that, an additional test is added to make sure our binding is
> undone and die loudly if it hasn't been.
>
> This also speeds up the test significantly and it might be possible to
> remove the :unstable tag.
>
>
> diff --git a/test/lisp/emacs-lisp/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el
> index 1aff73d66f6..2f8e7382bea 100644
> --- a/test/lisp/emacs-lisp/ert-tests.el
> +++ b/test/lisp/emacs-lisp/ert-tests.el
> @@ -583,6 +583,7 @@ ert-test-run-tests-batch
> (setq found-long (string-match long-text msg)))
> (unless found-complex
> (setq found-complex (string-match complex-text msg))))
> + (should nil)
> (should found-long)
> (should found-complex)))))
Stefan, any comments or suggestions?
next prev parent reply other threads:[~2024-07-08 11:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-08 4:49 bug#71988: 31.0.50; ert-test-run-tests-batch-expensive runs out of memory if previous tests failed Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-08 11:17 ` Eli Zaretskii [this message]
2024-07-08 19:54 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
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=868qyc16bd.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=71988@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=pipcet@protonmail.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).