Bug: http://b/128524141
The goal is to add a static library (libprofile-extras) to modules that
require coverage. Since the coverageMutator is a post-deps mutator, the
results of the coverageMutator are not available when the dependencies
get constructed in deps(). This change moves the detection from the
coverageMutator to begin().
Test: m NATIVE_COVERAGE=true COVERAGE_PATHS=*
Test: blueline_coverage target in internal branch (using forrest)
Change-Id: I4e7c8b31ed5060642c6218ea33c532a0f6619967
Bug: http://b/116873221
Disable -Wframe-larger-than because building without optimization can
make frame larger. Building dng_sdk with coverage results in a bigger
stack frame than the limit in C flags.
Get optimization level back to -O0 if module has a non-default
optimization level. Not doing so causes link failures with
libneuralnetworks.so.
Test: Build with coverage.
Change-Id: I36b2979bb6a73023458c8de3241e975845bd36eb
Bug: http://b/116873221
Enable coverage for libraries that use VNDK and those that have vendor
variants. This previously caused a redefinition error in the
Android-<product>.mk but was indirectly fixed when
https://android-review.googlesource.com/c/platform/build/soong/+/906394
disabled coverage for LLNDK stub libraries.
Test: m NATIVE_COVERAGE=true COVERAGE_PATHS=frameworks nothing
Change-Id: Iccbc1c15c68562449ffffe7bbcc3d22419d84bfe
Bug: http://b/116873221
These are used only for linking, and secondly, don't link with libc or
other system libraries.
Test: Build system/core/libnativeloader with coverage
Change-Id: I37eae572a5eaa00f0e8c72bc1453e967b5bcb577
Bug: http://b/116873221
This allows us to enable coverage for a module (typically static
libraries) even if a dependent module cannot build with coverage. In
this case, the dependent module can just pick the variant with coverage
off.
- Create the following variants from the coverage mutator:
- "" (empty): Don't build with coverage and always pick the
non-coverage variants for dependents. This variant is
created for modules with 'native_coverage: false'.
- "cov": If this module's path is covered by the COVERAGE_PATHS
option, build this module with coverage. If not, build
this module without coverage. In either case, pick
coverage variants ("cov") for dependencies if available.
- Do not enable coverage:
- for NDK stub libraries
- if sdk_version < 23 since libc doesn't export 'stderr' which is
needed by the coverage/profile runtime library.
- for VNDK libraries
Test: In AOSP: m COVERAGE_PATHS=system/security NATIVE_COVERAGE=true nothing
Change-Id: I4d08790d35cdeaf12fb3c4f999d69a870e65836a
Bug: http://b/77792074
- Add the libclang_rt.profile runtime libraries directly to the compile
command (for both host and target) instead of relying on the Clang
driver.
- Move the coverage mutator to PreDepsMutators so the mutation has
already happened when runtime libraries are added during dependence
computation.
- Factor out cc/config/toolchain to identify libclang_rt.profile modules
for the x86 and x86_64 host.
Test: make NATIVE_COVERAGE=true produces coverage-enabled host binaries.
Change-Id: I1ebc8cffdf11622bfc18199a57674672888b3a5f
Add a method on ModuleContext and TopDownMutatorContext to visit
direct dependencies that have a given dependency tag.
Test: m checkbuild
Change-Id: Ib875563091dcae6b7282b3e3427d0eb07d8c8af5
Also adds checks that the dependencies are android.Modules and
are not disabled.
Test: m checkbuild
Change-Id: I05e945f38915d49cd3c0ab72a86576949bc7eff2
Change module factories from returning a blueprint.Module and a list
of property structs to returning an android.Module, which holds the
list of property structs.
Test: build.ninja identical except for Factory: comment lines
Change-Id: Ica1d823f009db812c518f271a386fbff39c9766f
This is configured the same as make -- a global NATIVE_COVERAGE=true
flag to allow native coverage, then COVERAGE_PATHS=path1,path2,... to
turn it on for certain paths.
There are .gcnodir files exported to Make and saved in $OUT/coverage/...
files which are `ar` archives containing all of the compiler-produced
.gcno files for a particular executable / shared library.
Unlike the Make implementation, this only passes links the helper
library (automatically through --coverage) when one of the object files
or static libraries being used actually has coverage enabled.
Host support is currently disabled, since we set -nodefaultlibs, which
prevents libclang_rt.profile-*.a from being picked up automatically.
Bug: 32749731
Test: NATIVE_COVERAGE=true COVERAGE_PATHS=system/core/libcutils m -j libbacktrace libutils tombstoned
$OUT/coverage/system/lib*/libcutils.gcnodir looks correct (self)
$OUT/coverage/system/lib*/libbacktrace.gcnodir looks correct (static)
$OUT/coverage/system/lib*/libutils.gcnodir doesn't exist (shared)
$OUT/coverage/system/bin/tombstoned.gcnodir looks correct (executable)
Test: NATIVE_COVERAGE=true COVERAGE_PATHS=external/libcxxabi m -j libc++
Confirm that $OUT/coverage/system/lib*/libc++.gcnodir looks correct (whole_static_libs)
Change-Id: I48aaa0ba8d76e50e9c2d1151421c0c6dc8ed79a9