From 7185f8cc2d67f733acb3b597cab100edf8fd1499 Mon Sep 17 00:00:00 2001 From: Kavi Gupta Date: Tue, 11 Jun 2019 10:27:47 -0700 Subject: [PATCH] Modify build to put dumpcoverage agent into /system/lib This location allows the agent to be attached to arbitrary processes. It only makes sense to include libdumpcoverage.so on coverage builds, as these are the only builds that have any information to be dumped. Test: manual, used examples in README (see other CL) to test whether it works on a userdebug_coverage build on cuttlefish Change-Id: Ib2fece1b41a3b5d16c8a2a444c5486137e475fda --- core/main.mk | 10 ++++++++++ core/product.mk | 2 ++ target/product/base_system.mk | 3 +++ 3 files changed, 15 insertions(+) diff --git a/core/main.mk b/core/main.mk index 73aa649c8e..7ee63c6421 100644 --- a/core/main.mk +++ b/core/main.mk @@ -343,6 +343,15 @@ ifneq (,$(filter debug,$(tags_to_install))) endif endif +## java coverage ## +# Install additional tools on java coverage builds +ifeq (true,$(EMMA_INSTRUMENT)) +ifneq (,$(filter debug,$(tags_to_install))) + tags_to_install += java_coverage +endif +endif + + ## sdk ## ifdef is_sdk_build @@ -1140,6 +1149,7 @@ define product-installed-files $(if $(filter debug,$(tags_to_install)),$(PRODUCTS.$(_mk).PRODUCT_PACKAGES_DEBUG)) \ $(if $(filter tests,$(tags_to_install)),$(PRODUCTS.$(_mk).PRODUCT_PACKAGES_TESTS)) \ $(if $(filter asan,$(tags_to_install)),$(PRODUCTS.$(_mk).PRODUCT_PACKAGES_DEBUG_ASAN)) \ + $(if $(filter java_coverage,$(tags_to_install)),$(PRODUCTS.$(_mk).PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE)) \ $(call auto-included-modules) \ ) \ $(eval ### Filter out the overridden packages and executables before doing expansion) \ diff --git a/core/product.mk b/core/product.mk index 9ec3257bcf..77b129da4e 100644 --- a/core/product.mk +++ b/core/product.mk @@ -126,6 +126,8 @@ _product_list_vars += PRODUCT_HOST_PACKAGES _product_list_vars += PRODUCT_PACKAGES _product_list_vars += PRODUCT_PACKAGES_DEBUG _product_list_vars += PRODUCT_PACKAGES_DEBUG_ASAN +# Packages included only for eng/userdebug builds, when building with EMMA_INSTRUMENT=true +_product_list_vars += PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE _product_list_vars += PRODUCT_PACKAGES_ENG _product_list_vars += PRODUCT_PACKAGES_TESTS diff --git a/target/product/base_system.mk b/target/product/base_system.mk index f09493ef73..bb714f9790 100644 --- a/target/product/base_system.mk +++ b/target/product/base_system.mk @@ -375,6 +375,9 @@ PRODUCT_SYSTEM_SERVER_APPS += \ # Packages included only for eng/userdebug builds, when building with SANITIZE_TARGET=address PRODUCT_PACKAGES_DEBUG_ASAN := +PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE := \ + libdumpcoverage + PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\ frameworks/base/config/preloaded-classes:system/etc/preloaded-classes)