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

[PATCH 3/4] Makefile: add a NO_TEST_TOOLS flag

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jan 26, 2021, 16:07 UTC
Message-ID
<20210126160708.20903-4-avarab@gmail.com>
In-Reply-To
<20210126160708.20903-1-avarab@gmail.com>

Add a NO_TEST_TOOLS flag to build an installable git, but one that can't run "make test". This is useful e.g. in CI environments where you'd like to run external tests against a built git, but have no desire to run git's own tests.

On my 8 core machine this saves me around 1 second out of an otherwise 11-12 second build time. So it doesn't make all the difference, but when you're wanting to run tests against a lot of git versions it adds up.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile      | 6 ++++++
 t/test-lib.sh | 5 +++++
 2 files changed, 11 insertions(+)
diff --git a/Makefile b/Makefile
index 4031fb1b22f..cfa7bc58edf 100644
--- a/Makefile
+++ b/Makefile
@@ -309,6 +309,9 @@ all::
 #
 # Define NO_TCLTK if you do not want Tcl/Tk GUI.
 #
+# Define NO_TEST_TOOLS if you'd like to skip building the assets
+# required to run the tests. 
+#
 # Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
 # and egrep that are pickier when their input contains non-ASCII data.
 #
@@ -2732,6 +2735,7 @@ GIT-BUILD-OPTIONS: FORCE
 	@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
 	@echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
 	@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
+	@echo NO_TEST_TOOLS=\''$(subst ','\'',$(subst ','\'',$(NO_TEST_TOOLS)))'\' >>$@+
 	@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
 	@echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
 	@echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
@@ -2787,8 +2791,10 @@ GIT-PYTHON-VARS: FORCE
             fi
 endif
 
+ifndef NO_TEST_TOOLS
 test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
 TEST_TOOLS = $(TEST_PROGRAMS) $(test_bindir_programs)
+endif
 
 all:: $(TEST_TOOLS)
 
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 03c1c0836f1..4029cd18031 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -55,6 +55,11 @@ then
 	exit 1
 fi
 . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
+if test -n "$NO_TEST_TOOLS"
+then
+	echo >&2 'error: NO_TEST_TOOLS=$NO_TEST_TOOLS set in GIT-BUILD-OPTIONS, cannot run tests!.'
+	exit 1
+fi
 export PERL_PATH SHELL_PATH
 
 # Disallow the use of abbreviated options in the test suite by default
-- 
2.29.2.222.g5d2a92d10f8
Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 4 of 39 in “Makefile: micro-optimize light non-test builds”
  1. 0/4 Makefile: micro-optimize light non-test buildsÆvar Arnfjörð Bjarmason, Jan 26, 2021
  2. 1/4 Makefile: refactor assignment for subsequent changeÆvar Arnfjörð Bjarmason, Jan 26, 2021
  3. Junio C HamanoJan 27, 2021
  4. 3/4 Makefile: add a NO_TEST_TOOLS flagÆvar Arnfjörð Bjarmason, Jan 26, 2021
  5. 4/4 Makefile: add a NO_{INSTALL_,}SCRIPT_FALLBACKS targetÆvar Arnfjörð Bjarmason, Jan 26, 2021
  6. 2/4 Makefile: refactor for subsequent changeÆvar Arnfjörð Bjarmason, Jan 26, 2021
  7. Jeff KingJan 26, 2021
  8. Junio C HamanoJan 27, 2021
  9. Jeff KingJan 27, 2021
  10. Junio C HamanoJan 27, 2021
  11. 0/6 Makefile: add {program,xdiff,test,git}-objs & objects targetsÆvar Arnfjörð Bjarmason, Jan 28, 2021
  12. 0/6 Makefile: add {program,xdiff,test,git}-objs & objects targetsÆvar Arnfjörð Bjarmason, Feb 1, 2021
  13. Junio C HamanoFeb 3, 2021
  14. Jeff KingFeb 4, 2021
  15. Junio C HamanoFeb 4, 2021
  16. 0/6 Makefile: add {program,xdiff,test,git,fuzz}-objs & objects targetsÆvar Arnfjörð Bjarmason, Feb 23, 2021
  17. Junio C HamanoFeb 23, 2021
  18. Jeff KingFeb 23, 2021
  19. 1/6 Makefile: guard against TEST_OBJS in the environmentÆvar Arnfjörð Bjarmason, Feb 23, 2021
  20. 2/6 Makefile: split up long OBJECTS lineÆvar Arnfjörð Bjarmason, Feb 23, 2021
  21. 4/6 Makefile: split OBJECTS into OBJECTS and GIT_OBJSÆvar Arnfjörð Bjarmason, Feb 23, 2021
  22. 3/6 Makefile: sort OBJECTS assignment for subsequent changeÆvar Arnfjörð Bjarmason, Feb 23, 2021
  23. 5/6 Makefile: add {program,xdiff,test,git,fuzz}-objs & objects targetsÆvar Arnfjörð Bjarmason, Feb 23, 2021
  24. 6/6 Makefile: build "$(FUZZ_OBJS)" in CI, not under "all"Ævar Arnfjörð Bjarmason, Feb 23, 2021
  25. Jeff KingFeb 23, 2021
  26. Junio C HamanoFeb 23, 2021
  27. Ævar Arnfjörð BjarmasonFeb 28, 2021
  28. Jeff KingMar 1, 2021
  29. 1/6 Makefile: remove "all" on "$(FUZZ_OBJS)"Ævar Arnfjörð Bjarmason, Feb 1, 2021
  30. Jeff KingFeb 4, 2021
  31. 3/6 Makefile: split up long OBJECTS lineÆvar Arnfjörð Bjarmason, Feb 1, 2021
  32. 2/6 Makefile: guard against TEST_OBJS in the environmentÆvar Arnfjörð Bjarmason, Feb 1, 2021
  33. 4/6 Makefile: sort OBJECTS assignment for subsequent changeÆvar Arnfjörð Bjarmason, Feb 1, 2021
  34. 6/6 Makefile: add {program,xdiff,test,git}-objs & objects targetsÆvar Arnfjörð Bjarmason, Feb 1, 2021
  35. Junio C HamanoFeb 1, 2021
  36. 5/6 Makefile: split OBJECTS into OBJECTS and GIT_OBJSÆvar Arnfjörð Bjarmason, Feb 1, 2021
  37. 1/6 Makefile: remove "all" on "$(FUZZ_OBJS)"Ævar Arnfjörð Bjarmason, Jan 28, 2021
  38. 2/6 Makefile: guard against TEST_OBJS in the environmentÆvar Arnfjörð Bjarmason, Jan 28, 2021
  39. Junio C HamanoJan 29, 2021

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.