Package coverage files as a zip.

Bug: 148178774
Test: make NATIVE_COVERAGE=true COVERAGE_PATHS="*"
Change-Id: I7ee9253ef47a502a9d29f7e15a4402cbb90e34ae
Merged-In: I7ee9253ef47a502a9d29f7e15a4402cbb90e34ae
(cherry picked from commit e91ab2397f)
This commit is contained in:
Oliver Nguyen 2019-04-30 15:14:44 -07:00
parent 7aa3039ef9
commit 71640a3296
6 changed files with 25 additions and 19 deletions

View file

@ -4329,11 +4329,10 @@ $(SYMBOLS_ZIP): $(SOONG_ZIP)
# -----------------------------------------------------------------
# A zip of the coverage directory.
#
name := $(TARGET_PRODUCT)
name := gcov-report-files-all
ifeq ($(TARGET_BUILD_TYPE),debug)
name := $(name)_debug
endif
name := $(name)-coverage-$(FILE_NAME_TAG)
COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
ifndef TARGET_BUILD_APPS
$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \

View file

@ -1839,6 +1839,16 @@ define transform-host-o-to-executable
$(transform-host-o-to-executable-inner)
endef
###########################################################
## Commands for packaging native coverage files
###########################################################
define package-coverage-files
@rm -f $@ $@.lst $@.premerged
@touch $@.lst
$(foreach obj,$(strip $(PRIVATE_ALL_OBJECTS)), $(hide) echo $(obj) >> $@.lst$(newline))
$(hide) $(SOONG_ZIP) -o $@.premerged -C $(OUT_DIR) -l $@.lst
$(hide) $(MERGE_ZIPS) -ignore-duplicates $@ $@.premerged $(strip $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES))
endef
###########################################################
## Commands for running javac to make .class files

View file

@ -84,7 +84,7 @@ $(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries
endif
ifeq ($(my_native_coverage),true)
gcno_suffix := .gcnodir
gcno_suffix := .zip
built_whole_gcno_libraries := \
$(foreach lib,$(my_whole_static_libraries), \
@ -106,11 +106,11 @@ endif
GCNO_ARCHIVE := $(my_installed_module_stem)$(gcno_suffix)
$(intermediates)/$(GCNO_ARCHIVE) : $(SOONG_ZIP) $(MERGE_ZIPS)
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := $(strip $(LOCAL_GCNO_FILES))
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(strip $(built_whole_gcno_libraries)) $(strip $(built_static_gcno_libraries))
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_INTERMEDIATES_DIR := $(intermediates)
$(intermediates)/$(GCNO_ARCHIVE) : $(LOCAL_GCNO_FILES) $(built_whole_gcno_libraries) $(built_static_gcno_libraries)
$(transform-o-to-static-lib)
$(package-coverage-files)
$(my_coverage_path)/$(GCNO_ARCHIVE) : $(intermediates)/$(GCNO_ARCHIVE)
$(copy-file-to-target)

View file

@ -77,7 +77,7 @@ $(linked_module): \
$(transform-o-to-shared-lib)
ifeq ($(my_native_coverage),true)
gcno_suffix := .gcnodir
gcno_suffix := .zip
built_whole_gcno_libraries := \
$(foreach lib,$(my_whole_static_libraries), \
@ -99,11 +99,11 @@ endif
GCNO_ARCHIVE := $(basename $(my_installed_module_stem))$(gcno_suffix)
$(intermediates)/$(GCNO_ARCHIVE) : $(SOONG_ZIP) $(MERGE_ZIPS)
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := $(strip $(LOCAL_GCNO_FILES))
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(strip $(built_whole_gcno_libraries)) $(strip $(built_static_gcno_libraries))
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_INTERMEDIATES_DIR := $(intermediates)
$(intermediates)/$(GCNO_ARCHIVE) : $(LOCAL_GCNO_FILES) $(built_whole_gcno_libraries) $(built_static_gcno_libraries)
$(transform-o-to-static-lib)
$(package-coverage-files)
$(my_coverage_path)/$(GCNO_ARCHIVE) : $(intermediates)/$(GCNO_ARCHIVE)
$(copy-file-to-target)

View file

@ -177,14 +177,14 @@ endif
ifeq ($(NATIVE_COVERAGE),true)
ifneq (,$(strip $(LOCAL_PREBUILT_COVERAGE_ARCHIVE)))
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(intermediates)/$(LOCAL_MODULE).gcnodir))
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(intermediates)/$(LOCAL_MODULE).zip))
ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true)
ifdef LOCAL_IS_HOST_MODULE
my_coverage_path := $($(my_prefix)OUT_COVERAGE)/$(patsubst $($(my_prefix)OUT)/%,%,$(my_module_path))
else
my_coverage_path := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
endif
my_coverage_path := $(my_coverage_path)/$(patsubst %.so,%,$(my_installed_module_stem)).gcnodir
my_coverage_path := $(my_coverage_path)/$(patsubst %.so,%,$(my_installed_module_stem)).zip
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(my_coverage_path)))
$(LOCAL_BUILT_MODULE): $(my_coverage_path)
endif
@ -192,13 +192,12 @@ ifeq ($(NATIVE_COVERAGE),true)
# Coverage information is needed when static lib is a dependency of another
# coverage-enabled module.
ifeq (STATIC_LIBRARIES, $(LOCAL_MODULE_CLASS))
GCNO_ARCHIVE := $(LOCAL_MODULE).gcnodir
GCNO_ARCHIVE := $(LOCAL_MODULE).zip
$(intermediates)/$(GCNO_ARCHIVE) : $(SOONG_ZIP) $(MERGE_ZIPS)
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS :=
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES :=
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_PREFIX := $(my_prefix)
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
$(intermediates)/$(GCNO_ARCHIVE) :
$(transform-o-to-static-lib)
$(package-coverage-files)
endif
endif
endif

View file

@ -25,7 +25,7 @@ $(LOCAL_BUILT_MODULE) : $(all_objects)
$(transform-o-to-static-lib)
ifeq ($(NATIVE_COVERAGE),true)
gcno_suffix := .gcnodir
gcno_suffix := .zip
built_whole_gcno_libraries := \
$(foreach lib,$(my_whole_static_libraries), \
@ -35,11 +35,9 @@ built_whole_gcno_libraries := \
GCNO_ARCHIVE := $(LOCAL_MODULE)$(gcno_suffix)
$(intermediates)/$(GCNO_ARCHIVE) : $(SOONG_ZIP) $(MERGE_ZIPS)
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := $(strip $(LOCAL_GCNO_FILES))
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(strip $(built_whole_gcno_libraries))
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_PREFIX := $(my_prefix)
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_INTERMEDIATES_DIR := $(intermediates)
$(intermediates)/$(GCNO_ARCHIVE) : $(LOCAL_GCNO_FILES) $(built_whole_gcno_libraries)
$(transform-o-to-static-lib)
$(package-coverage-files)
endif