Skip to content

Commit 483b759

Browse files
committed
Merge branch 'jk/unit-tests-buildfix' into js/unit-test-suite-runner
* jk/unit-tests-buildfix: t/Makefile: say the default target upfront t/Makefile: get UNIT_TESTS list from C sources Makefile: remove UNIT_TEST_BIN directory with "make clean" Makefile: use mkdir_p_parent_template for UNIT_TEST_BIN
2 parents 2a540e4 + 4904a4d commit 483b759

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

Makefile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3680,14 +3680,14 @@ cocciclean:
36803680
$(RM) contrib/coccinelle/*.cocci.patch
36813681

36823682
clean: profile-clean coverage-clean cocciclean
3683-
$(RM) -r .build
3683+
$(RM) -r .build $(UNIT_TEST_BIN)
36843684
$(RM) po/git.pot po/git-core.pot
36853685
$(RM) git.res
36863686
$(RM) $(OBJECTS)
36873687
$(RM) headless-git.o
36883688
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
36893689
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) $(OTHER_PROGRAMS)
3690-
$(RM) $(TEST_PROGRAMS) $(UNIT_TEST_PROGS)
3690+
$(RM) $(TEST_PROGRAMS)
36913691
$(RM) $(FUZZ_PROGRAMS)
36923692
$(RM) $(SP_OBJ)
36933693
$(RM) $(HCC)
@@ -3868,10 +3868,8 @@ $(FUZZ_PROGRAMS): %: %.o oss-fuzz/dummy-cmd-main.o $(GITLIBS) GIT-LDFLAGS
38683868

38693869
fuzz-all: $(FUZZ_PROGRAMS)
38703870

3871-
$(UNIT_TEST_BIN):
3872-
@mkdir -p $(UNIT_TEST_BIN)
3873-
3874-
$(UNIT_TEST_PROGS): $(UNIT_TEST_BIN)/%$X: $(UNIT_TEST_DIR)/%.o $(UNIT_TEST_DIR)/test-lib.o $(GITLIBS) GIT-LDFLAGS $(UNIT_TEST_BIN)
3871+
$(UNIT_TEST_PROGS): $(UNIT_TEST_BIN)/%$X: $(UNIT_TEST_DIR)/%.o $(UNIT_TEST_DIR)/test-lib.o $(GITLIBS) GIT-LDFLAGS
3872+
$(call mkdir_p_parent_template)
38753873
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
38763874
$(filter %.o,$^) $(filter %.a,$^) $(LIBS)
38773875

t/Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# The default target of this Makefile is...
2+
all::
3+
14
# Import tree-wide shared Makefile behavior and libraries
25
include ../shared.mak
36

@@ -6,6 +9,7 @@ include ../shared.mak
69
# Copyright (c) 2005 Junio C Hamano
710
#
811

12+
-include ../config.mak.uname
913
-include ../config.mak.autogen
1014
-include ../config.mak
1115

@@ -42,14 +46,16 @@ TPERF = $(sort $(wildcard perf/p[0-9][0-9][0-9][0-9]-*.sh))
4246
TINTEROP = $(sort $(wildcard interop/i[0-9][0-9][0-9][0-9]-*.sh))
4347
CHAINLINTTESTS = $(sort $(patsubst chainlint/%.test,%,$(wildcard chainlint/*.test)))
4448
CHAINLINT = '$(PERL_PATH_SQ)' chainlint.pl
45-
UNIT_TESTS = $(sort $(filter-out %.pdb unit-tests/bin/t-basic%,$(wildcard unit-tests/bin/t-*)))
49+
UNIT_TEST_SOURCES = $(wildcard unit-tests/t-*.c)
50+
UNIT_TEST_PROGRAMS = $(patsubst unit-tests/%.c,unit-tests/bin/%$(X),$(UNIT_TEST_SOURCES))
51+
UNIT_TESTS = $(sort $(filter-out unit-tests/bin/t-basic%,$(UNIT_TEST_PROGRAMS)))
4652

4753
# `test-chainlint` (which is a dependency of `test-lint`, `test` and `prove`)
4854
# checks all tests in all scripts via a single invocation, so tell individual
4955
# scripts not to run the external "chainlint.pl" script themselves
5056
CHAINLINTSUPPRESS = GIT_TEST_EXT_CHAIN_LINT=0 && export GIT_TEST_EXT_CHAIN_LINT &&
5157

52-
all: $(DEFAULT_TEST_TARGET)
58+
all:: $(DEFAULT_TEST_TARGET)
5359

5460
test: pre-clean check-chainlint $(TEST_LINT)
5561
$(CHAINLINTSUPPRESS) $(MAKE) aggregate-results-and-cleanup

0 commit comments

Comments
 (0)