git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Josh Steadmon <steadmon@google.com>,
	git@vger.kernel.org, johannes.schindelin@gmx.de,
	phillip.wood@dunelm.org.uk
Subject: Re: [RFC PATCH v2 6/6] t/Makefile: run unit tests alongside shell tests
Date: Wed, 7 Feb 2024 17:43:50 -0500	[thread overview]
Message-ID: <20240207224350.GA537799@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqzfwc6lle.fsf@gitster.g>

On Wed, Feb 07, 2024 at 12:55:09PM -0800, Junio C Hamano wrote:

> > +# A simple wrapper to run shell tests via TEST_SHELL_PATH,
> > +# or exec unit tests directly.
> > +
> > +case "$1" in
> > +*.sh)
> > +	exec ${TEST_SHELL_PATH:-/bin/sh} "$@"
> > +	;;
> > +*)
> > +	exec "$@"
> > +	;;
> > +esac
> 
> Hmph.  This penalizes the non-unit tests by doing an extra "exec",
> once per program?

It does, but IMHO that is not likely to be a problem. It's once per
top-level script (so ~1000), and each of those scripts spawns hundreds
or thousands of sub-commands. I didn't do any measurements, though.

You can extend "prove" with extra perl modules so that it makes the
distinction internally without the extra shell invocation. But when I
tried to do it, I found it rather baroque and complicated (I can't
remember if I succeeded but found it too gross, or just gave up halfway
through trying).

> Of course we cannot run two $(PROVE) invocations serially, one for
> doing $(T) and the other for doing $(UNIT_TESTS)?

Not if they share the same command-line options. If you use something
like "--state=slow,save", then the first run will write the list of all
tests to ".prove", and then the second will run every test mentioned in
.prove (in addition to the unit-tests provided on the command-line).

You should be able to work around it by passing "--statefile". I _think_
it might be OK to just do that unconditionally. Something like:

  prove --exec $(TEST_SHELL_PATH $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
  prove --statefile=.prove-unit-tests $(GIT_PROVE_OPTS) $(UNIT_TESTS) :: $(GIT_TEST_OPTS)

and then it's just a noop if GIT_PROVE_OPTS doesn't use --state. But I
haven't played with it myself.

-Peff

  reply	other threads:[~2024-02-07 22:43 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 22:22 [RFC PATCH 0/4] test-tool: add unit test suite runner Josh Steadmon
2024-01-16 22:22 ` [RFC PATCH 1/4] t0080: turn t-basic unit test into a helper Josh Steadmon
2024-01-16 22:54   ` Junio C Hamano
2024-01-23  0:43     ` Jeff King
2024-02-01 19:40       ` Josh Steadmon
2024-01-16 22:22 ` [RFC PATCH 2/4] test-tool run-command testsuite: support unit tests Josh Steadmon
2024-01-16 23:18   ` Junio C Hamano
2024-01-16 23:40     ` Junio C Hamano
2024-01-23  0:59       ` Jeff King
2024-02-01 22:06     ` Josh Steadmon
2024-02-01 22:26       ` Junio C Hamano
2024-02-01 23:08     ` Josh Steadmon
2024-02-01 23:14       ` Josh Steadmon
2024-01-16 22:23 ` [RFC PATCH 3/4] unit tests: add rule for running with test-tool Josh Steadmon
2024-01-16 22:23 ` [RFC PATCH 4/4] t/Makefile: run unit tests alongside shell tests Josh Steadmon
2024-01-16 23:24 ` [RFC PATCH 0/4] test-tool: add unit test suite runner Junio C Hamano
2024-02-03  0:50 ` [RFC PATCH v2 0/6] " Josh Steadmon
2024-02-03  0:50   ` [RFC PATCH v2 1/6] t0080: turn t-basic unit test into a helper Josh Steadmon
2024-02-07 20:55     ` Junio C Hamano
2024-02-12 20:42       ` Josh Steadmon
2024-02-07 22:58     ` Jeff King
2024-02-08  0:09       ` Junio C Hamano
2024-02-12 20:53       ` Josh Steadmon
2024-02-12 21:27         ` Junio C Hamano
2024-02-13  7:41           ` Jeff King
2024-02-13 14:36             ` rsbecker
2024-02-22 23:57               ` Josh Steadmon
2024-02-23  0:06                 ` rsbecker
2024-02-13 17:28             ` Junio C Hamano
2024-02-22 23:55             ` Josh Steadmon
2024-02-03  0:50   ` [RFC PATCH v2 2/6] test-tool run-command testsuite: get shell from env Josh Steadmon
2024-02-07 20:55     ` Junio C Hamano
2024-02-12 21:35       ` Josh Steadmon
2024-02-03  0:50   ` [RFC PATCH v2 3/6] test-tool run-command testsuite: remove hardcoded filter Josh Steadmon
2024-02-07 20:55     ` Junio C Hamano
2024-02-12 22:48       ` Josh Steadmon
2024-02-12 22:51         ` Junio C Hamano
2024-02-03  0:50   ` [RFC PATCH v2 4/6] test-tool run-command testsuite: support unit tests Josh Steadmon
2024-02-05 16:16     ` phillip.wood123
2024-02-12 21:15       ` Josh Steadmon
2024-02-07 20:48     ` Junio C Hamano
2024-02-23 22:45       ` Josh Steadmon
2024-02-03  0:50   ` [RFC PATCH v2 5/6] unit tests: add rule for running with test-tool Josh Steadmon
2024-02-07 20:50     ` Junio C Hamano
2024-02-03  0:50   ` [RFC PATCH v2 6/6] t/Makefile: run unit tests alongside shell tests Josh Steadmon
2024-02-07 20:55     ` Junio C Hamano
2024-02-07 22:43       ` Jeff King [this message]
2024-02-07 23:26         ` Junio C Hamano
2024-02-03 18:52   ` [RFC PATCH v2 0/6] test-tool: add unit test suite runner Junio C Hamano
2024-02-12 22:50     ` Josh Steadmon
2024-02-07 21:14   ` Junio C Hamano
2024-02-23 23:33 ` [PATCH v3 0/7] " Josh Steadmon
2024-02-23 23:33   ` [PATCH v3 1/7] t0080: turn t-basic unit test into a helper Josh Steadmon
2024-02-23 23:33   ` [PATCH v3 2/7] test-tool run-command testsuite: get shell from env Josh Steadmon
2024-02-23 23:33   ` [PATCH v3 3/7] test-tool run-command testsuite: remove hardcoded filter Josh Steadmon
2024-02-23 23:33   ` [PATCH v3 4/7] test-tool run-command testsuite: support unit tests Josh Steadmon
2024-02-23 23:33   ` [PATCH v3 5/7] unit tests: add rule for running with test-tool Josh Steadmon
2024-02-23 23:33   ` [PATCH v3 6/7] t/Makefile: run unit tests alongside shell tests Josh Steadmon
2024-03-27  8:58     ` Jeff King
2024-04-11 18:44       ` Josh Steadmon
2024-04-12  4:29         ` Jeff King
2024-04-24 18:57           ` Josh Steadmon
2024-02-23 23:33   ` [PATCH v3 7/7] ci: use test-tool as unit test runner on Windows Josh Steadmon
2024-03-26 21:33   ` [PATCH v3 0/7] test-tool: add unit test suite runner Junio C Hamano
2024-03-27  9:00     ` Jeff King
2024-04-24 19:14 ` [PATCH v4 " Josh Steadmon
2024-04-24 19:14   ` [PATCH v4 1/7] t0080: turn t-basic unit test into a helper Josh Steadmon
2024-04-24 19:14   ` [PATCH v4 2/7] test-tool run-command testsuite: get shell from env Josh Steadmon
2024-04-24 19:14   ` [PATCH v4 3/7] test-tool run-command testsuite: remove hardcoded filter Josh Steadmon
2024-04-24 19:14   ` [PATCH v4 4/7] test-tool run-command testsuite: support unit tests Josh Steadmon
2024-04-24 19:14   ` [PATCH v4 5/7] unit tests: add rule for running with test-tool Josh Steadmon
2024-04-24 19:14   ` [PATCH v4 6/7] t/Makefile: run unit tests alongside shell tests Josh Steadmon
2024-04-24 21:25     ` Junio C Hamano
2024-04-30 19:49       ` Josh Steadmon
2024-05-03 18:02       ` Jeff King
2024-05-03 19:17         ` Junio C Hamano
2024-05-06 19:58         ` Josh Steadmon
2024-04-24 19:14   ` [PATCH v4 7/7] ci: use test-tool as unit test runner on Windows Josh Steadmon
2024-04-30 19:55 ` [PATCH v5 0/7] test-tool: add unit test suite runner Josh Steadmon
2024-04-30 19:55   ` [PATCH v5 1/7] t0080: turn t-basic unit test into a helper Josh Steadmon
2024-04-30 19:55   ` [PATCH v5 2/7] test-tool run-command testsuite: get shell from env Josh Steadmon
2024-04-30 19:55   ` [PATCH v5 3/7] test-tool run-command testsuite: remove hardcoded filter Josh Steadmon
2024-04-30 19:55   ` [PATCH v5 4/7] test-tool run-command testsuite: support unit tests Josh Steadmon
2024-04-30 19:55   ` [PATCH v5 5/7] unit tests: add rule for running with test-tool Josh Steadmon
2024-04-30 19:55   ` [PATCH v5 6/7] t/Makefile: run unit tests alongside shell tests Josh Steadmon
2024-04-30 21:05     ` Junio C Hamano
2024-05-06 19:58       ` Josh Steadmon
2024-04-30 19:55   ` [PATCH v5 7/7] ci: use test-tool as unit test runner on Windows Josh Steadmon
2024-04-30 21:15   ` [PATCH v5 0/7] test-tool: add unit test suite runner Junio C Hamano
2024-05-06 20:02     ` Josh Steadmon
2024-05-06 19:57 ` [PATCH v6 " Josh Steadmon
2024-05-06 19:57   ` [PATCH v6 1/7] t0080: turn t-basic unit test into a helper Josh Steadmon
2024-05-06 19:57   ` [PATCH v6 2/7] test-tool run-command testsuite: get shell from env Josh Steadmon
2024-05-06 19:57   ` [PATCH v6 3/7] test-tool run-command testsuite: remove hardcoded filter Josh Steadmon
2024-05-06 19:57   ` [PATCH v6 4/7] test-tool run-command testsuite: support unit tests Josh Steadmon
2024-05-06 19:57   ` [PATCH v6 5/7] unit tests: add rule for running with test-tool Josh Steadmon
2024-05-06 19:57   ` [PATCH v6 6/7] t/Makefile: run unit tests alongside shell tests Josh Steadmon
2024-05-06 19:57   ` [PATCH v6 7/7] ci: use test-tool as unit test runner on Windows Josh Steadmon
2024-05-06 21:11   ` [PATCH v6 0/7] test-tool: add unit test suite runner Junio C Hamano

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=20240207224350.GA537799@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=steadmon@google.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.
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 NNTP newsgroup(s).