git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t/Makefile: retain cache t/.prove across prove runs
@ 2012-05-02 15:31 mhagger
  2012-05-02 16:07 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: mhagger @ 2012-05-02 15:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Michael Haggerty

From: Michael Haggerty <mhagger@alum.mit.edu>

prove(1) can write a summary of its test results and timings into a
cache file, t/.prove, then use this information during later runs for
various purposes.  But deleting t/.prove after every test run defeats
this purpose.  So do not delete t/.prove as part of "make
DEFAILT_TEST_TARGET=prove test".  (Continue to delete the file on
"make clean".)

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
prove(1) can be told to retain information about test runs, and to use
it for interesting purposes during future invocations.  For example,
it can be told to run tests that failed during the last run:

    GIT_PROVE_OPTS = --state=failed,save

or that have failed recently:

    GIT_PROVE_OPTS = --state=hot,save

or that have been edited since the last run of prove:

    GIT_PROVE_OPTS = --state=fresh,save

It can also run tests in parallel, and start them in order from
slowest to fastest, which, combined with running tests in parallel,
can improve CPU utilization:

    GIT_PROVE_OPTS = --timer --jobs 5 --state=slow,save

(On my 4-core notebook, the latter speeds up the tests by about 10%
compared to running them in parallel in numerical order.)

 t/Makefile |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/t/Makefile b/t/Makefile
index 6091211..88e289f 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -28,7 +28,7 @@ test: pre-clean $(TEST_LINT)
 
 prove: pre-clean $(TEST_LINT)
 	@echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
-	$(MAKE) clean
+	$(MAKE) clean-except-prove-cache
 
 $(T):
 	@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
@@ -36,9 +36,11 @@ $(T):
 pre-clean:
 	$(RM) -r test-results
 
-clean:
+clean-except-prove-cache:
 	$(RM) -r 'trash directory'.* test-results
 	$(RM) -r valgrind/bin
+
+clean: clean-except-prove-cache
 	$(RM) .prove
 
 test-lint: test-lint-duplicates test-lint-executable
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] t/Makefile: retain cache t/.prove across prove runs
  2012-05-02 15:31 [PATCH] t/Makefile: retain cache t/.prove across prove runs mhagger
@ 2012-05-02 16:07 ` Jeff King
  2012-05-19 14:54   ` Michael Haggerty
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2012-05-02 16:07 UTC (permalink / raw)
  To: mhagger; +Cc: Junio C Hamano, git

On Wed, May 02, 2012 at 05:31:52PM +0200, mhagger@alum.mit.edu wrote:

> prove(1) can write a summary of its test results and timings into a
> cache file, t/.prove, then use this information during later runs for
> various purposes.  But deleting t/.prove after every test run defeats
> this purpose.  So do not delete t/.prove as part of "make
> DEFAILT_TEST_TARGET=prove test".  (Continue to delete the file on
> "make clean".)

Thanks. I had found some odd behaviors with putting "--state" into
GIT_PROVE_OPTS when I first switched my setup to use prove, but I didn't
investigate. I think this issue explained some of what I saw.

Do note, though, that we only clean ".prove" on a successful run. So
something like "--state=hot,save" will still see the cache from the last
run if there were failures. However, the prove cache is meant to be kept
across many runs, even successful ones, so I think your patch makes
sense.

> ---
> prove(1) can be told to retain information about test runs, and to use
> it for interesting purposes during future invocations.  For example,
> it can be told to run tests that failed during the last run:
> 
>     GIT_PROVE_OPTS = --state=failed,save

I don't think this actually works, because we also feed all of the test
scripts to prove on the command line. So it will run them all, both
failed and successful.

I'm not sure if it is worth solving for "make test". I suspect having
that not test everything would be error prone (i.e., it's too easy to
accidentally not run the full suite when you meant to, and unexpected
regressions in other tests will go unnoticed). You can always run
"prove" yourself from the command line, or we can add a new target to do
a partial test (with other options set up properly).

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] t/Makefile: retain cache t/.prove across prove runs
  2012-05-02 16:07 ` Jeff King
@ 2012-05-19 14:54   ` Michael Haggerty
  2012-05-19 15:27     ` Jeff King
  2012-05-20 21:18     ` Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Haggerty @ 2012-05-19 14:54 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, git

On 05/02/2012 06:07 PM, Jeff King wrote:
> On Wed, May 02, 2012 at 05:31:52PM +0200, mhagger@alum.mit.edu wrote:
>> prove(1) can write a summary of its test results and timings into a
>> cache file, t/.prove, then use this information during later runs for
>> various purposes.  But deleting t/.prove after every test run defeats
>> this purpose.  So do not delete t/.prove as part of "make
>> DEFAILT_TEST_TARGET=prove test".  (Continue to delete the file on
>> "make clean".)
>
> Thanks. I had found some odd behaviors with putting "--state" into
> GIT_PROVE_OPTS when I first switched my setup to use prove, but I didn't
> investigate. I think this issue explained some of what I saw.
>
> Do note, though, that we only clean ".prove" on a successful run. So
> something like "--state=hot,save" will still see the cache from the last
> run if there were failures. However, the prove cache is meant to be kept
> across many runs, even successful ones, so I think your patch makes
> sense.
>
>> ---
>> prove(1) can be told to retain information about test runs, and to use
>> it for interesting purposes during future invocations.  For example,
>> it can be told to run tests that failed during the last run:
>>
>>      GIT_PROVE_OPTS = --state=failed,save
>
> I don't think this actually works, because we also feed all of the test
> scripts to prove on the command line. So it will run them all, both
> failed and successful.
>
> I'm not sure if it is worth solving for "make test". I suspect having
> that not test everything would be error prone (i.e., it's too easy to
> accidentally not run the full suite when you meant to, and unexpected
> regressions in other tests will go unnoticed). You can always run
> "prove" yourself from the command line, or we can add a new target to do
> a partial test (with other options set up properly).

I totally believe you that some of the variations that I listed in my 
commentary don't work in the git context.  I'm not a prove expert; I 
just noticed that removing the .prove file is counterproductive and 
breaks some other prove features.  I also agree with you that it would 
be dangerous to encourage partial testing and that it is therefore not a 
priority to make the use case that you mentioned work in the git context.

I still think my patch makes sense.  The error that Peff pointed out was 
in my commentary, not in the patch itself or in the log message.  Junio, 
is there something else keeping you from applying this patch?

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] t/Makefile: retain cache t/.prove across prove runs
  2012-05-19 14:54   ` Michael Haggerty
@ 2012-05-19 15:27     ` Jeff King
  2012-05-20 21:18     ` Junio C Hamano
  1 sibling, 0 replies; 5+ messages in thread
From: Jeff King @ 2012-05-19 15:27 UTC (permalink / raw)
  To: Michael Haggerty; +Cc: Junio C Hamano, git

On Sat, May 19, 2012 at 04:54:33PM +0200, Michael Haggerty wrote:

> I totally believe you that some of the variations that I listed in my
> commentary don't work in the git context.  I'm not a prove expert; I
> just noticed that removing the .prove file is counterproductive and
> breaks some other prove features.  I also agree with you that it
> would be dangerous to encourage partial testing and that it is
> therefore not a priority to make the use case that you mentioned work
> in the git context.
> 
> I still think my patch makes sense.  The error that Peff pointed out
> was in my commentary, not in the patch itself or in the log message.
> Junio, is there something else keeping you from applying this patch?

Yeah, I hope my comments weren't interpreted as "don't apply this".
Keeping the .prove file around is a prerequisite for lots of clever
things, including some useful (--state=slow) and some less so
(--state=failed). But if the latter case does not work (if we even want
it to), it is because this patch is only the first building block. We
should definitely apply it.

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] t/Makefile: retain cache t/.prove across prove runs
  2012-05-19 14:54   ` Michael Haggerty
  2012-05-19 15:27     ` Jeff King
@ 2012-05-20 21:18     ` Junio C Hamano
  1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2012-05-20 21:18 UTC (permalink / raw)
  To: Michael Haggerty; +Cc: Jeff King, git

Michael Haggerty <mhagger@alum.mit.edu> writes:

> I still think my patch makes sense.  The error that Peff pointed out
> was in my commentary, not in the patch itself or in the log message.
> Junio, is there something else keeping you from applying this patch?

No.

I was waiting just in case if anything other than "Ah, that does indeed
not work but it does not mean this patch is wrong" comes out (e.g. "With
the patch it does not work as pointed out, but I made it also work by this
reroll, which also is correct") to avoid the trouble of applying and
replacing.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-20 21:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-02 15:31 [PATCH] t/Makefile: retain cache t/.prove across prove runs mhagger
2012-05-02 16:07 ` Jeff King
2012-05-19 14:54   ` Michael Haggerty
2012-05-19 15:27     ` Jeff King
2012-05-20 21:18     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.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).