From: Jeff King Date: Tue, 27 Oct 2026 17:40:22 GMT Subject: [PATCH 6/8] t: drop redundant unit-test invocations Message-ID: <20261027174022.GF136740@coredump.intra.peff.net> In-Reply-To: <20261027173205.GA97799@coredump.intra.peff.net> Now that t0011 runs the clar unit tests, running the binary separately from the shell tests would execute them twice. Drop the separate Meson test and the extra invocation in the first CI test slice, along with the unit-tests-test-tool target it used. We can also drop UNIT_TESTS_NO_DIR, which supplied the arguments for that target. Likewise, stop passing the unit-test binaries to prove alongside the shell tests. Since all of its inputs are now shell scripts, we can use TEST_SHELL_PATH directly instead of run-test.sh, and pass GIT_TEST_OPTS through prove's "::" separator. This leaves no users of run-test.sh, so we can drop it, too. You can still run the unit-tests directly if you want to. I've also left "make unit-tests" intact, though I'm not sure if it is actually useful. Signed-off-by: Jeff King --- ci/run-test-slice.sh | 5 ----- t/Makefile | 12 ++---------- t/meson.build | 1 - t/run-test.sh | 18 ------------------ 4 files changed, 2 insertions(+), 34 deletions(-) delete mode 100755 t/run-test.sh diff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh index d0063efc42..fd66443626 100755 --- a/ci/run-test-slice.sh +++ b/ci/run-test-slice.sh @@ -10,9 +10,4 @@ TESTS=$(cd t && ./helper/test-tool path-utils slice-tests "$1" "$2" t[0-9]*.sh) group "Run tests" make --quiet -C t T="$(echo "$TESTS" | tr '\n' ' ')" || handle_failed_tests -# We only have one unit test at the moment, so run it in the first slice. -if [ "$1" == "1" ] ; then - group "Run unit tests" make --quiet -C t unit-tests-test-tool -fi - check_unignored_build_artifacts diff --git a/t/Makefile b/t/Makefile index e3249879c4..1d2eca9ae4 100644 --- a/t/Makefile +++ b/t/Makefile @@ -54,7 +54,6 @@ UNIT_TEST_SOURCES = $(wildcard unit-tests/t-*.c) UNIT_TEST_PROGRAMS = $(patsubst unit-tests/%.c,unit-tests/bin/%$(X),$(UNIT_TEST_SOURCES)) UNIT_TEST_PROGRAMS += unit-tests/bin/unit-tests$(X) UNIT_TESTS = $(sort $(UNIT_TEST_PROGRAMS)) -UNIT_TESTS_NO_DIR = $(notdir $(UNIT_TESTS)) # `test-chainlint` (which is a dependency of `test-lint`, `test` and `prove`) # checks all tests in all scripts via a single invocation, so tell individual @@ -79,7 +78,7 @@ failed: prove: pre-clean $(TEST_LINT) @echo "*** prove (shell & unit tests) ***" - @$(CHAINLINTSUPPRESS) TEST_OPTIONS='$(GIT_TEST_OPTS)' TEST_SHELL_PATH='$(TEST_SHELL_PATH_SQ)' $(PROVE) --exec ./run-test.sh $(GIT_PROVE_OPTS) $(T) $(UNIT_TESTS) + @$(CHAINLINTSUPPRESS) $(PROVE) --exec '$(TEST_SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS) $(MAKE) clean-except-prove-cache $(T): @@ -88,21 +87,14 @@ $(T): $(UNIT_TESTS): @echo "*** $@ ***"; $@ -.PHONY: unit-tests unit-tests-raw unit-tests-prove unit-tests-test-tool +.PHONY: unit-tests unit-tests-raw unit-tests-prove unit-tests: $(DEFAULT_UNIT_TEST_TARGET) unit-tests-raw: $(UNIT_TESTS) unit-tests-prove: @echo "*** prove - unit tests ***"; $(PROVE) $(GIT_PROVE_OPTS) $(UNIT_TESTS) -unit-tests-test-tool: - @echo "*** test-tool - unit tests **" - ( \ - cd unit-tests/bin && \ - ../../helper/test-tool$X run-command testsuite $(UNIT_TESTS_NO_DIR)\ - ) - pre-clean: $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)' diff --git a/t/meson.build b/t/meson.build index fc628ad2d1..4dc47824f5 100644 --- a/t/meson.build +++ b/t/meson.build @@ -74,7 +74,6 @@ clar_unit_tests = executable('unit-tests', ), dependencies: [libgit_commonmain], ) -test('unit-tests', clar_unit_tests, kwargs: test_kwargs) test_dependencies += clar_unit_tests diff --git a/t/run-test.sh b/t/run-test.sh deleted file mode 100755 index 63328ac630..0000000000 --- a/t/run-test.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# A simple wrapper to run shell tests via TEST_SHELL_PATH, -# or exec unit tests directly. - -case "$1" in -*.sh) - if test -z "${TEST_SHELL_PATH}" - then - echo >&2 "ERROR: TEST_SHELL_PATH is empty or not set" - exit 1 - fi - exec "${TEST_SHELL_PATH}" "$@" ${TEST_OPTIONS} - ;; -*) - exec "$@" - ;; -esac -- 2.56.0.559.g7c1a1d8168