Enable clang coverage
This is to align with build/soong to support clang coverage. - support env CLANG_COVERAGE and CLANG_COVERAGE_CONTINUOUS_MODE. - support kill -37 signal to dump coverage. - support build clang coverage together with hwasan. Bug: 309894892 Change-Id: I14f75d7fdfdf872d2db3bbceb2c10d6572bcfebf
This commit is contained in:
parent
04591b6315
commit
946ca19d49
1 changed files with 37 additions and 0 deletions
|
@ -145,15 +145,21 @@ endif
|
||||||
ifneq (,$(strip $(foreach dir,$(NATIVE_COVERAGE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
|
ifneq (,$(strip $(foreach dir,$(NATIVE_COVERAGE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
|
||||||
ifeq (,$(strip $(foreach dir,$(NATIVE_COVERAGE_EXCLUDE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
|
ifeq (,$(strip $(foreach dir,$(NATIVE_COVERAGE_EXCLUDE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
|
||||||
my_native_coverage := true
|
my_native_coverage := true
|
||||||
|
my_clang_coverage := true
|
||||||
else
|
else
|
||||||
my_native_coverage := false
|
my_native_coverage := false
|
||||||
|
my_clang_coverage := false
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
my_native_coverage := false
|
my_native_coverage := false
|
||||||
|
my_clang_coverage := false
|
||||||
endif
|
endif
|
||||||
ifneq ($(NATIVE_COVERAGE),true)
|
ifneq ($(NATIVE_COVERAGE),true)
|
||||||
my_native_coverage := false
|
my_native_coverage := false
|
||||||
endif
|
endif
|
||||||
|
ifneq ($(CLANG_COVERAGE),true)
|
||||||
|
my_clang_coverage := false
|
||||||
|
endif
|
||||||
|
|
||||||
# Exclude directories from checking allowed manual binder interface lists.
|
# Exclude directories from checking allowed manual binder interface lists.
|
||||||
# TODO(b/145621474): Move this check into IInterface.h when clang-tidy no longer uses absolute paths.
|
# TODO(b/145621474): Move this check into IInterface.h when clang-tidy no longer uses absolute paths.
|
||||||
|
@ -270,6 +276,7 @@ ifneq ($(LOCAL_SDK_VERSION),)
|
||||||
ifneq ($(my_ndk_api),current)
|
ifneq ($(my_ndk_api),current)
|
||||||
ifeq ($(call math_lt, $(my_ndk_api),23),true)
|
ifeq ($(call math_lt, $(my_ndk_api),23),true)
|
||||||
my_native_coverage := false
|
my_native_coverage := false
|
||||||
|
my_clang_coverage := false
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -295,6 +302,36 @@ ifeq ($(NATIVE_COVERAGE),true)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CLANG_COVERAGE),true)
|
||||||
|
ifndef LOCAL_IS_HOST_MODULE
|
||||||
|
my_ldflags += $(CLANG_COVERAGE_HOST_LDFLAGS)
|
||||||
|
ifneq ($(LOCAL_MODULE_CLASS),STATIC_LIBRARIES)
|
||||||
|
my_whole_static_libraries += libclang_rt.profile
|
||||||
|
ifeq ($(LOCAL_SDK_VERSION),)
|
||||||
|
my_whole_static_libraries += libprofile-clang-extras
|
||||||
|
else
|
||||||
|
my_whole_static_libraries += libprofile-clang-extras_ndk
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(my_clang_coverage),true)
|
||||||
|
my_profile_instr_generate := $(CLANG_COVERAGE_INSTR_PROFILE)
|
||||||
|
ifeq ($(CLANG_COVERAGE_CONTINUOUS_MODE),true)
|
||||||
|
my_cflags += $(CLANG_COVERAGE_CONTINUOUS_FLAGS)
|
||||||
|
my_ldflags += $(CLANG_COVERAGE_CONTINUOUS_FLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
my_profile_instr_generate += $(CLANG_COVERAGE_CONFIG_COMMFLAGS)
|
||||||
|
my_cflags += $(CLANG_COVERAGE_INSTR_PROFILE) $(CLANG_COVERAGE_CONFIG_CFLAGS) $(CLANG_COVERAGE_CONFIG_COMMFLAGS)
|
||||||
|
my_ldflags += $(CLANG_COVERAGE_CONFIG_COMMFLAGS)
|
||||||
|
|
||||||
|
ifneq ($(filter hwaddress,$(my_sanitize)),)
|
||||||
|
my_cflags += $(CLANG_COVERAGE_HWASAN_FLAGS)
|
||||||
|
my_ldflags += $(CLANG_COVERAGE_HWASAN_FLAGS)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(LOCAL_USE_VNDK),)
|
ifneq ($(LOCAL_USE_VNDK),)
|
||||||
my_cflags += -D__ANDROID_VNDK__
|
my_cflags += -D__ANDROID_VNDK__
|
||||||
ifneq ($(LOCAL_USE_VNDK_VENDOR),)
|
ifneq ($(LOCAL_USE_VNDK_VENDOR),)
|
||||||
|
|
Loading…
Reference in a new issue