Skip to content

Commit

Permalink
Merge branch 'tr/coverage'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Junio C Hamano committed Jun 2, 2013
2 parents edc7f0a + 5ce4367 commit 67b57a9
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2469,7 +2469,7 @@ profile-clean:
$(RM) $(addsuffix *.gcda,$(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 \
builtin/*.o $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
Expand Down Expand Up @@ -2550,29 +2550,34 @@ check-builtins::

### 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:
$(MAKE) coverage-build
$(MAKE) coverage-report
$(MAKE) coverage-test
$(MAKE) coverage-untested-functions

object_dirs := $(sort $(dir $(OBJECTS)))
coverage-clean:
coverage-clean-results:
$(RM) $(addsuffix *.gcov,$(object_dirs))
$(RM) $(addsuffix *.gcda,$(object_dirs))
$(RM) $(addsuffix *.gcno,$(object_dirs))
$(RM) coverage-untested-functions
$(RM) -r cover_db/
$(RM) -r cover_db_html/

coverage-clean: coverage-clean-results
$(RM) $(addsuffix *.gcno,$(object_dirs))

COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
GCOVFLAGS = --preserve-paths --branch-probabilities --all-blocks

coverage-build: coverage-clean
coverage-compile:
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all

coverage-test: coverage-clean-results coverage-compile
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
-j1 test
DEFAULT_TEST_TARGET=test -j1 test

coverage-report:
$(QUIET_GCOV)for dir in $(object_dirs); do \
Expand Down

0 comments on commit 67b57a9

Please sign in to comment.