Enable host coverage.

Don't remember why I didn't enable this for the host when I made the
first pass, but it works just fine.

Change-Id: I0892c0bc353bf8b60b432ba9f69f97281177d41d
This commit is contained in:
Dan Albert 2015-01-23 16:12:57 -08:00
parent 6aa932cabf
commit 43e128acfc
2 changed files with 29 additions and 27 deletions

View File

@ -251,33 +251,6 @@ my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAG
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
endif # my_clang
# To enable coverage for a given module, set LOCAL_NATIVE_COVERAGE=true and
# build with NATIVE_COVERAGE=true in your enviornment. Note that the build
# system is not sensitive to changes to NATIVE_COVERAGE, so you should do a
# clean build of your module after toggling it.
ifeq ($(NATIVE_COVERAGE),true)
ifeq ($(my_native_coverage),true)
# We can't currently generate coverage for clang binaries for two
# reasons:
#
# 1) b/17574078 We currently don't have a prebuilt
# libclang_rt.profile-<ARCH>.a, which clang is hardcoded to link if
# --coverage is passed in the link stage. For now we manually link
# libprofile_rt (which is the name it is built as from
# external/compiler-rt).
#
# 2) b/17583330 Clang doesn't generate .gcno files when using
# -no-integrated-as. Since most of the assembly in our tree is
# incompatible with clang's assembler, we can't turn off this flag.
ifneq ($(my_clang),true)
my_cflags += --coverage -O0
my_ldflags += --coverage
endif
endif
else
my_native_coverage := false
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
@ -308,6 +281,33 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_LDFLAGS := $(my_host_global_ldflags)
endif # LOCAL_IS_HOST_MODULE
# To enable coverage for a given module, set LOCAL_NATIVE_COVERAGE=true and
# build with NATIVE_COVERAGE=true in your enviornment. Note that the build
# system is not sensitive to changes to NATIVE_COVERAGE, so you should do a
# clean build of your module after toggling it.
ifeq ($(NATIVE_COVERAGE),true)
ifeq ($(my_native_coverage),true)
# We can't currently generate coverage for clang binaries for two
# reasons:
#
# 1) b/17574078 We currently don't have a prebuilt
# libclang_rt.profile-<ARCH>.a, which clang is hardcoded to link if
# --coverage is passed in the link stage. For now we manually link
# libprofile_rt (which is the name it is built as from
# external/compiler-rt).
#
# 2) b/17583330 Clang doesn't generate .gcno files when using
# -no-integrated-as. Since most of the assembly in our tree is
# incompatible with clang's assembler, we can't turn off this flag.
ifneq ($(my_clang),true)
my_cflags += --coverage -O0
my_ldflags += --coverage
endif
endif
else
my_native_coverage := false
endif
###########################################################
## Define PRIVATE_ variables used by multiple module types
###########################################################

View File

@ -1302,6 +1302,7 @@ $(hide) $(PRIVATE_CXX) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
$(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(filter true,$(NATIVE_COVERAGE)),-lgcov) \
$(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDLIBS)
@ -1482,6 +1483,7 @@ $(hide) $(PRIVATE_CXX) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
$(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(filter true,$(NATIVE_COVERAGE)),-lgcov) \
$(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-Wl,-rpath-link=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES) \
-Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \