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
This commit is contained in:
Junio C Hamano 2013-06-02 15:57:18 -07:00
Родитель edc7f0abcb 5ce4367d64
Коммит 67b57a90f4
1 изменённых файлов: 13 добавлений и 8 удалений

Просмотреть файл

@ -2469,7 +2469,7 @@ profile-clean:
$(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs))) $(RM) $(addsuffix *.gcda,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
$(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs))) $(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
clean: profile-clean clean: profile-clean coverage-clean
$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \ $(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB) builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
@ -2550,29 +2550,34 @@ check-builtins::
### Test suite coverage testing ### Test suite coverage testing
# #
.PHONY: coverage coverage-clean coverage-build coverage-report .PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report
.PHONY: coverage-clean-results
coverage: coverage:
$(MAKE) coverage-build $(MAKE) coverage-test
$(MAKE) coverage-report $(MAKE) coverage-untested-functions
object_dirs := $(sort $(dir $(OBJECTS))) object_dirs := $(sort $(dir $(OBJECTS)))
coverage-clean: coverage-clean-results:
$(RM) $(addsuffix *.gcov,$(object_dirs)) $(RM) $(addsuffix *.gcov,$(object_dirs))
$(RM) $(addsuffix *.gcda,$(object_dirs)) $(RM) $(addsuffix *.gcda,$(object_dirs))
$(RM) $(addsuffix *.gcno,$(object_dirs))
$(RM) coverage-untested-functions $(RM) coverage-untested-functions
$(RM) -r cover_db/ $(RM) -r cover_db/
$(RM) -r cover_db_html/ $(RM) -r cover_db_html/
coverage-clean: coverage-clean-results
$(RM) $(addsuffix *.gcno,$(object_dirs))
COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks
coverage-build: coverage-clean coverage-compile:
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
coverage-test: coverage-clean-results coverage-compile
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \ $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
-j1 test DEFAULT_TEST_TARGET=test -j1 test
coverage-report: coverage-report:
$(QUIET_GCOV)for dir in $(object_dirs); do \ $(QUIET_GCOV)for dir in $(object_dirs); do \