unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: Run (some) tests more automagically?
Date: Sun, 21 Feb 2021 14:28:00 +0000	[thread overview]
Message-ID: <CAOqdjBdLVYmzRfxLdXdszfaRnzp7vUdG6Q0zJbHCXoUzjAM3PA@mail.gmail.com> (raw)
In-Reply-To: <87v9alk0xi.fsf@gnus.org>

On Sun, Feb 21, 2021 at 1:27 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:
> I wonder whether anybody's considered making "make" run some tests.
>
> It's a recurring issue that we make a change, and then we forget to run
> the test suite.  I mean, it's not a major problem, because it'll
> eventually get run by somebody, but I'd feel more confident in my own
> changes if I'd remember to run more tests more often.
>
> The reason we don't is because we don't want to wait for some minutes
> while running the entire suite.

That's certainly part of the reason for me. I find it important to
remember that (to me) make is a tool to save time, and that requires
compromise between remaking everything that could possibly have
changed (which would require recompiling all elcs (and elns) for every
change in the C sources, and also would require us to accurately model
all potential ELisp-to-ELisp dependencies, some of which are circular)
and just making things once. Doing the former is possible for projects
that have flat dependency trees, not for deep (and possibly cyclic)
dependency graphs.

> So here's today's not-thought-out-at-all idea: Since tests for
> lisp/foo.el live in test/lisp/foo-tests.el, could we add some Makefile
> magic to automatically run foo-tests.el if lisp/foo.el has been changed?

Yes, let's! Except we need to agree on what "has been changed" means.
My initial idea would be to create a time stamp file the first time
make is run in an emacs directory and consider only those source files
which are newer than the time stamp, only if they're recompiled. But
what should we do when we run "git pull"? Should the time stamp be
updated for all tests after every make, for successful tests only, or
only if all tests that were run were successful? Should the check run
after the rest of make has (possibly after a "build successful,
continuing automatically to run tests" message so the impatient can
interrupt it at that point), at the same time as the rest of make
(increasing time-to-test, IMHO) or asynchronously after make has
finished?

It's easy to get this wrong, and I half-expect I'll have to add
"nocheck" to all my Emacs makefiles if the feature lands.

> Running just those tests shouldn't take too much time, and would
> probably cover 93% of the relevant code changes for foo.el.

Speaking of code changes, one thing I'm worried about is that one
developer on, say, Windows does something, forgets to adjust the tests
so there's a spurious failure on GNU/Linux, and then the next
GNU/Linux developer to touch the file will see a test failure that has
nothing to do with their changes. I don't have a good solution for
that one.

> One disadvantage to doing this (if we find a way) is that "make
> foo-tests" is often very noisy, so we'd need a way to run tests silently
> and just report if anything actually fails unexpectedly, I guess.

I think that's an advantage: tests should be silent by default, rather
than producing all kinds of irrelevant "by the way, your headlight's
working" noise. If we can help enforce that by running them in make,
that would be great.

Pip



  parent reply	other threads:[~2021-02-21 14:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-21 13:25 Run (some) tests more automagically? Lars Ingebrigtsen
2021-02-21 13:48 ` dick.r.chiang
2021-02-21 14:28 ` Pip Cet [this message]
2021-02-21 14:45   ` Philipp
2021-02-21 16:05   ` Lars Ingebrigtsen
2021-02-21 15:37 ` Eli Zaretskii
2021-02-21 15:57   ` Lars Ingebrigtsen
2021-02-24 10:42 ` Phillip Lord
2021-02-24 14:34   ` Lars Ingebrigtsen
2021-02-26 11:44     ` Phillip Lord
2021-02-26 11:50       ` Lars Ingebrigtsen
2021-03-01 17:50         ` Phillip Lord

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=CAOqdjBdLVYmzRfxLdXdszfaRnzp7vUdG6Q0zJbHCXoUzjAM3PA@mail.gmail.com \
    --to=pipcet@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /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).