From: Junio C Hamano Date: Fri, 19 Jul 2013 17:38:18 +0000 (-0700) Subject: Merge branch 'tr/coverage' into maint X-Git-Tag: v1.8.3.4~34 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/7f05e4a6173e65220c11ed2ff42fa3d64ccd98a4?ds=inline;hp=-c Merge branch 'tr/coverage' into maint The test coverage framework was left broken 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 --- 7f05e4a6173e65220c11ed2ff42fa3d64ccd98a4 diff --combined Makefile index 6b91612acb,6f9d1c7c0f..14a38cc422 --- a/Makefile +++ b/Makefile @@@ -69,9 -69,6 +69,9 @@@ all: # Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt # doesn't support GNU extensions like --check and --statistics # +# Define NEEDS_CLIPPED_WRITE if your write(2) cannot write more than +# INT_MAX bytes at once (e.g. MacOS X). +# # Define HAVE_PATHS_H if you have paths.h and want to use the default PATH # it specifies. # @@@ -140,10 -137,6 +140,10 @@@ # specify your own (or DarwinPort's) include directories and # library directories by defining CFLAGS and LDFLAGS appropriately. # +# Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X +# and do not want to use Apple's CommonCrypto library. This allows you +# to provide your own OpenSSL library, for example from MacPorts. +# # Define BLK_SHA1 environment variable to make use of the bundled # optimized C SHA1 routine. # @@@ -1061,11 -1054,6 +1061,11 @@@ ifeq ($(uname_S),Darwin BASIC_LDFLAGS += -L/opt/local/lib endif endif + ifndef NO_APPLE_COMMON_CRYPTO + APPLE_COMMON_CRYPTO = YesPlease + COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO + endif + NO_REGEX = YesPlease PTHREAD_LIBS = endif @@@ -1399,17 -1387,11 +1399,17 @@@ ifdef PPC_SHA SHA1_HEADER = "ppc/sha1.h" LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o LIB_H += ppc/sha1.h +else +ifdef APPLE_COMMON_CRYPTO + COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL + SHA1_HEADER = else SHA1_HEADER = EXTLIBS += $(LIB_4_CRYPTO) endif endif +endif + ifdef NO_PERL_MAKEMAKER export NO_PERL_MAKEMAKER endif @@@ -1484,11 -1466,6 +1484,11 @@@ ifndef NO_MSGFMT_EXTENDED_OPTION MSGFMT += --check --statistics endif +ifdef NEEDS_CLIPPED_WRITE + BASIC_CFLAGS += -DNEEDS_CLIPPED_WRITE + COMPAT_OBJS += compat/clipped-write.o +endif + ifneq (,$(XDL_FAST_HASH)) BASIC_CFLAGS += -DXDL_FAST_HASH endif @@@ -2285,6 -2262,9 +2285,6 @@@ check: common-cmds. exit 1; \ fi -remove-dashes: - ./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS) - ### Installation rules ifneq ($(filter /%,$(firstword $(template_dir))),) @@@ -2463,7 -2443,7 +2463,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 @@@ -2544,29 -2524,34 +2544,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 \