mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
unit tests: add rule for running with test-tool
In the previous commit, we added support in test-tool for running collections of unit tests. Now, add rules in t/Makefile for running in this way. This new rule can be executed from the top-level Makefile via `make DEFAULT_UNIT_TEST_TARGET=unit-tests-test-tool unit-tests`, or by setting DEFAULT_UNIT_TEST_TARGET in config.mak. Signed-off-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
a2b55e2506
commit
5bbc8c927f
2
Makefile
2
Makefile
@@ -3875,5 +3875,5 @@ $(UNIT_TEST_PROGS): $(UNIT_TEST_BIN)/%$X: $(UNIT_TEST_DIR)/%.o $(UNIT_TEST_DIR)/
|
|||||||
|
|
||||||
.PHONY: build-unit-tests unit-tests
|
.PHONY: build-unit-tests unit-tests
|
||||||
build-unit-tests: $(UNIT_TEST_PROGS)
|
build-unit-tests: $(UNIT_TEST_PROGS)
|
||||||
unit-tests: $(UNIT_TEST_PROGS)
|
unit-tests: $(UNIT_TEST_PROGS) t/helper/test-tool$X
|
||||||
$(MAKE) -C t/ unit-tests
|
$(MAKE) -C t/ unit-tests
|
||||||
|
|||||||
10
t/Makefile
10
t/Makefile
@@ -49,6 +49,7 @@ CHAINLINT = '$(PERL_PATH_SQ)' chainlint.pl
|
|||||||
UNIT_TEST_SOURCES = $(wildcard unit-tests/t-*.c)
|
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 = $(patsubst unit-tests/%.c,unit-tests/bin/%$(X),$(UNIT_TEST_SOURCES))
|
||||||
UNIT_TESTS = $(sort $(UNIT_TEST_PROGRAMS))
|
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`)
|
# `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
|
# checks all tests in all scripts via a single invocation, so tell individual
|
||||||
@@ -76,7 +77,7 @@ $(T):
|
|||||||
$(UNIT_TESTS):
|
$(UNIT_TESTS):
|
||||||
@echo "*** $@ ***"; $@
|
@echo "*** $@ ***"; $@
|
||||||
|
|
||||||
.PHONY: unit-tests unit-tests-raw unit-tests-prove
|
.PHONY: unit-tests unit-tests-raw unit-tests-prove unit-tests-test-tool
|
||||||
unit-tests: $(DEFAULT_UNIT_TEST_TARGET)
|
unit-tests: $(DEFAULT_UNIT_TEST_TARGET)
|
||||||
|
|
||||||
unit-tests-raw: $(UNIT_TESTS)
|
unit-tests-raw: $(UNIT_TESTS)
|
||||||
@@ -84,6 +85,13 @@ unit-tests-raw: $(UNIT_TESTS)
|
|||||||
unit-tests-prove:
|
unit-tests-prove:
|
||||||
@echo "*** prove - unit tests ***"; $(PROVE) $(GIT_PROVE_OPTS) $(UNIT_TESTS)
|
@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:
|
pre-clean:
|
||||||
$(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
|
$(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user