git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t/Makefile: retain cache t/.prove across prove runs

From
mhagger@alum.mit.edu <mhagger@alum.mit.edu>
Date
May 2, 2012, 15:31 UTC
Message-ID
<1335972712-20621-1-git-send-email-mhagger@alum.mit.edu>
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
Next: Jeff King
Message 1 of 5 in “t/Makefile: retain cache t/.prove across prove runs”
  1. t/Makefile: retain cache t/.prove across prove runsmhagger@alum.mit.edu, May 2, 2012
  2. Jeff KingMay 2, 2012
  3. Michael HaggertyMay 19, 2012
  4. Jeff KingMay 19, 2012
  5. Junio C HamanoMay 20, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.