Skip to content

Commit 67b57a9

Browse files
committed
Merge branch 'tr/coverage'
Update the test coverage support that was left to bitrot for some time. * tr/coverage: coverage: build coverage-untested-functions by default coverage: set DEFAULT_TEST_TARGET to avoid using prove coverage: do not delete .gcno files before building coverage: split build target into compile and test
2 parents edc7f0a + 5ce4367 commit 67b57a9

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Makefile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,7 +2469,7 @@ profile-clean:
24692469
$(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
24702470
$(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
24712471

2472-
clean: profile-clean
2472+
clean: profile-clean coverage-clean
24732473
$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
24742474
builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
24752475
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
@@ -2550,29 +2550,34 @@ check-builtins::
25502550

25512551
### Test suite coverage testing
25522552
#
2553-
.PHONY: coverage coverage-clean coverage-build coverage-report
2553+
.PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
2554+
.PHONY: coverage-clean-results
25542555

25552556
coverage:
2556-
$(MAKE) coverage-build
2557-
$(MAKE) coverage-report
2557+
$(MAKE) coverage-test
2558+
$(MAKE) coverage-untested-functions
25582559

25592560
object_dirs := $(sort $(dir $(OBJECTS)))
2560-
coverage-clean:
2561+
coverage-clean-results:
25612562
$(RM) $(addsuffix *.gcov,$(object_dirs))
25622563
$(RM) $(addsuffix *.gcda,$(object_dirs))
2563-
$(RM) $(addsuffix *.gcno,$(object_dirs))
25642564
$(RM) coverage-untested-functions
25652565
$(RM) -r cover_db/
25662566
$(RM) -r cover_db_html/
25672567

2568+
coverage-clean: coverage-clean-results
2569+
$(RM) $(addsuffix *.gcno,$(object_dirs))
2570+
25682571
COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
25692572
COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
25702573
GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
25712574

2572-
coverage-build: coverage-clean
2575+
coverage-compile:
25732576
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
2577+
2578+
coverage-test: coverage-clean-results coverage-compile
25742579
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
2575-
-j1 test
2580+
DEFAULT_TEST_TARGET=test -j1 test
25762581

25772582
coverage-report:
25782583
$(QUIET_GCOV)for dir in $(object_dirs); do \

0 commit comments

Comments
 (0)