Skip to content

Commit 5bbc8c9

Browse files
steadmongitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a2b55e2 commit 5bbc8c9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3875,5 +3875,5 @@ $(UNIT_TEST_PROGS): $(UNIT_TEST_BIN)/%$X: $(UNIT_TEST_DIR)/%.o $(UNIT_TEST_DIR)/
38753875

38763876
.PHONY: build-unit-tests unit-tests
38773877
build-unit-tests: $(UNIT_TEST_PROGS)
3878-
unit-tests: $(UNIT_TEST_PROGS)
3878+
unit-tests: $(UNIT_TEST_PROGS) t/helper/test-tool$X
38793879
$(MAKE) -C t/ unit-tests

t/Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ CHAINLINT = '$(PERL_PATH_SQ)' chainlint.pl
4949
UNIT_TEST_SOURCES = $(wildcard unit-tests/t-*.c)
5050
UNIT_TEST_PROGRAMS = $(patsubst unit-tests/%.c,unit-tests/bin/%$(X),$(UNIT_TEST_SOURCES))
5151
UNIT_TESTS = $(sort $(UNIT_TEST_PROGRAMS))
52+
UNIT_TESTS_NO_DIR = $(notdir $(UNIT_TESTS))
5253

5354
# `test-chainlint` (which is a dependency of `test-lint`, `test` and `prove`)
5455
# checks all tests in all scripts via a single invocation, so tell individual
@@ -76,14 +77,21 @@ $(T):
7677
$(UNIT_TESTS):
7778
@echo "*** $@ ***"; $@
7879

79-
.PHONY: unit-tests unit-tests-raw unit-tests-prove
80+
.PHONY: unit-tests unit-tests-raw unit-tests-prove unit-tests-test-tool
8081
unit-tests: $(DEFAULT_UNIT_TEST_TARGET)
8182

8283
unit-tests-raw: $(UNIT_TESTS)
8384

8485
unit-tests-prove:
8586
@echo "*** prove - unit tests ***"; $(PROVE) $(GIT_PROVE_OPTS) $(UNIT_TESTS)
8687

88+
unit-tests-test-tool:
89+
@echo "*** test-tool - unit tests **"
90+
( \
91+
cd unit-tests/bin && \
92+
../../helper/test-tool$X run-command testsuite $(UNIT_TESTS_NO_DIR)\
93+
)
94+
8795
pre-clean:
8896
$(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
8997

0 commit comments

Comments
 (0)