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

[PATCH 8/8] t/test-lib: make feature-testbed job more accessible

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 27, 2026, 08:18 UTC
Message-ID
<20261027-b4-pks-ci-test-vars-consolidation-v1-8-f28edf79bd6c@pks.im>
In-Reply-To
<20261027-b4-pks-ci-test-vars-consolidation-v1-0-f28edf79bd6c@pks.im>

Our "feature-testbed" job sets up a bunch of GIT_TEST environment variables and then executes our tests. This is mostly intended as a testbed for features that aren't default-enabled, but that may eventually become so.

Due to the job being special it has a higher potential of failing even though a local test run succeeds. But running these tests locally with the same environment is somewhat painful, as the developer has to manually set all of these environment variables.

Introduce a new "--feature-testbed" toggle for our test suite that, when set, sets up exactly these environment variables. Migrate our CI to use this toggle so that we have a single source of truth, only.

Note that we only set these GIT_TEST variables in the case where they haven't already been configured. This serves two purposes:

  - The user can continue to manually override a subset of those
    variables, if they desire.
  - Test scripts typically source "t/test-lib.sh" after they already
    overrode GIT_TEST variables, and we don't want to discard that.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 ci/lib.sh                | 12 +-----------
 t/README                 |  5 +++++
 t/test-lib.sh            | 21 +++++++++++++++++++++
 t/unit-tests/unit-test.c |  1 +
 4 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/ci/lib.sh b/ci/lib.sh
index fbb13ca6c6a..c3a5ec48f22 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -398,17 +398,7 @@ linux32)
 	;;
 linux-feature-testbed)
 	export OPENSSL_SHA1_UNSAFE=YesPlease
-	export GIT_TEST_SPLIT_INDEX=yes
-	export GIT_TEST_FULL_IN_PACK_ARRAY=true
-	export GIT_TEST_OE_SIZE=10
-	export GIT_TEST_OE_DELTA_SIZE=5
-	export GIT_TEST_COMMIT_GRAPH=1
-	export GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1
-	export GIT_TEST_MULTI_PACK_INDEX=1
-	export GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL=1
-	export GIT_TEST_NO_WRITE_REV_INDEX=1
-	export GIT_TEST_CHECKOUT_WORKERS=2
-	export GIT_TEST_PACK_USE_BITMAP_BOUNDARY_TRAVERSAL=1
+	GIT_TEST_OPTS="$GIT_TEST_OPTS --feature-testbed"
 	;;
 linux-meson)
 	MESONFLAGS="$MESONFLAGS -Dcredential_helpers=libsecret,netrc"
diff --git a/t/README b/t/README
index fd7e8504b51..211bf78aed9 100644
--- a/t/README
+++ b/t/README
@@ -119,6 +119,11 @@ appropriately before running "make". Short options can be bundled, i.e.
 	This causes additional long-running tests to be run (where
 	available), for more exhaustive testing.
 
+--feature-testbed::
+	This causes tests to run with several `GIT_TEST` environment
+	variables set. The intent is to test Git with optional features
+	and non-default configuration.
+
 -r::
 --run=<test-selector>::
 	Run only the subset of tests indicated by
diff --git a/t/test-lib.sh b/t/test-lib.sh
index de566309861..8863bcac930 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -202,6 +202,14 @@ finalize_test_case_output () { :; }
 finalize_test_leak_output () { :; }
 finalize_test_output () { :; }
 
+set_default_env () {
+	if eval "test -z \"\${$1+set}\""
+	then
+		eval "$1=\$2"
+	fi
+	export "$1"
+}
+
 parse_option () {
 	local opt="$1"
 
@@ -212,6 +220,19 @@ parse_option () {
 		immediate=t ;;
 	-l|--l|--lo|--lon|--long|--long-|--long-t|--long-te|--long-tes|--long-test|--long-tests)
 		GIT_TEST_LONG=true; export GIT_TEST_LONG ;;
+	--feature-testbed)
+		set_default_env GIT_TEST_SPLIT_INDEX yes
+		set_default_env GIT_TEST_FULL_IN_PACK_ARRAY true
+		set_default_env GIT_TEST_OE_SIZE 10
+		set_default_env GIT_TEST_OE_DELTA_SIZE 5
+		set_default_env GIT_TEST_COMMIT_GRAPH 1
+		set_default_env GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1
+		set_default_env GIT_TEST_MULTI_PACK_INDEX 1
+		set_default_env GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL 1
+		set_default_env GIT_TEST_NO_WRITE_REV_INDEX 1
+		set_default_env GIT_TEST_CHECKOUT_WORKERS 2
+		set_default_env GIT_TEST_PACK_USE_BITMAP_BOUNDARY_TRAVERSAL 1
+		;;
 	-r)
 		mark_option_requires_arg "$opt" run_list
 		;;
diff --git a/t/unit-tests/unit-test.c b/t/unit-tests/unit-test.c
index 752fb38fb32..f4898353045 100644
--- a/t/unit-tests/unit-test.c
+++ b/t/unit-tests/unit-test.c
@@ -27,6 +27,7 @@ int cmd_main(int argc, const char **argv)
 		 * options understood by integration tests.
 		 */
 		OPT_NOOP_NOARG('d', "debug"),
+		OPT_NOOP_NOARG(0, "feature-testbed"),
 		OPT_NOOP_NOARG(0, "github-workflow-markup"),
 		OPT_NOOP_NOARG(0, "no-bin-wrappers"),
 		OPT_NOOP_ARG(0, "no-chain-lint"),
-- 
2.56.0.341.g393f52fd96.dirty
Previous: Patrick SteinhardtNext: Phillip Wood
Message 9 of 32 in “ci: consolidate test variables”
  1. 0/8 ci: consolidate test variablesPatrick Steinhardt, Oct 27, 2026
  2. 1/8 ci: consolidate setup of test environmentPatrick Steinhardt, Oct 27, 2026
  3. 2/8 ci/lib: always set GIT_TEST_USE_SET_E on Linux jobsPatrick Steinhardt, Oct 27, 2026
  4. 3/8 ci/lib: deduplicate test variables by pattern matchingPatrick Steinhardt, Oct 27, 2026
  5. 4/8 ci/lib: merge switches for specific job namesPatrick Steinhardt, Oct 27, 2026
  6. 5/8 t: honor default ref storage formatPatrick Steinhardt, Oct 27, 2026
  7. 6/8 ci/lib: add another NO_RUST build using glibcPatrick Steinhardt, Oct 27, 2026
  8. 7/8 ci: don't override initial branch name in testbed jobPatrick Steinhardt, Oct 27, 2026
  9. 8/8 t/test-lib: make feature-testbed job more accessiblePatrick Steinhardt, Oct 27, 2026
  10. Phillip WoodOct 27, 2026
  11. Junio C HamanoOct 27, 2026
  12. Patrick SteinhardtOct 28, 2026
  13. Jeff KingOct 27, 2026
  14. Junio C HamanoOct 27, 2026
  15. Patrick SteinhardtOct 28, 2026
  16. Phillip WoodOct 28, 2026
  17. Patrick SteinhardtNov 2, 2026
  18. Phillip WoodOct 27, 2026
  19. Junio C HamanoOct 27, 2026
  20. Jeff KingOct 27, 2026
  21. Toon ClaesOct 28, 2026
  22. 0/7 ci: consolidate test variablesPatrick Steinhardt, Nov 2, 2026
  23. 1/7 ci: consolidate setup of test environmentPatrick Steinhardt, Nov 2, 2026
  24. 2/7 ci/lib: always set GIT_TEST_USE_SET_E on Linux jobsPatrick Steinhardt, Nov 2, 2026
  25. 3/7 ci/lib: deduplicate test variables by pattern matchingPatrick Steinhardt, Nov 2, 2026
  26. 4/7 ci/lib: merge switches for specific job namesPatrick Steinhardt, Nov 2, 2026
  27. 5/7 t: honor default ref storage formatPatrick Steinhardt, Nov 2, 2026
  28. 6/7 ci/lib: add another NO_RUST build using glibcPatrick Steinhardt, Nov 2, 2026
  29. 7/7 ci: don't override initial branch name in testbed jobPatrick Steinhardt, Nov 2, 2026
  30. Phillip WoodNov 2, 2026
  31. Jeff KingNov 4, 2026
  32. Junio C HamanoNov 4, 2026

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.