Make native_coverage clause work with ClangCoverage
Make uses NATIVE_COVERAGE to enable gcov coverage and CLANG_COVERAGE to enable clang coverage. NATIVE_COVERAGE is translated to the Soong Native_coverage product variable which triggers the native_coverage clause in Android.bp files. The clause also needs to be triggered for CLANG_COVERAGE. Rename the existing Native_coverage product variable to GcovCoverage, and regenerate Native_coverage when either GcovCoverage or ClangCoverage are set. Also remove NativeLineCoverage, it wasn't doing anything differently than Native_coverage. Bug: 159059537 Test: m checkbuild Merged-In: I215124a9b35a2ad50ad562079d392e3d33da11f4 Change-Id: I215124a9b35a2ad50ad562079d392e3d33da11f4
This commit is contained in:
committed by
Oliver Nguyen
parent
583691a060
commit
72cabc6255
@@ -406,6 +406,14 @@ func NewConfig(srcDir, buildDir string) (Config, error) {
|
||||
return Config{}, err
|
||||
}
|
||||
|
||||
if Bool(config.productVariables.GcovCoverage) && Bool(config.productVariables.ClangCoverage) {
|
||||
return Config{}, fmt.Errorf("GcovCoverage and ClangCoverage cannot both be set")
|
||||
}
|
||||
|
||||
config.productVariables.Native_coverage = proptools.BoolPtr(
|
||||
Bool(config.productVariables.GcovCoverage) ||
|
||||
Bool(config.productVariables.ClangCoverage))
|
||||
|
||||
return Config{config}, nil
|
||||
}
|
||||
|
||||
@@ -1058,18 +1066,20 @@ func (c *deviceConfig) JavaCoverageEnabledForPath(path string) bool {
|
||||
return coverage
|
||||
}
|
||||
|
||||
func (c *config) NativeLineCoverage() bool {
|
||||
return Bool(c.productVariables.NativeLineCoverage)
|
||||
}
|
||||
|
||||
// Returns true if gcov or clang coverage is enabled.
|
||||
func (c *deviceConfig) NativeCoverageEnabled() bool {
|
||||
return Bool(c.config.productVariables.Native_coverage) || Bool(c.config.productVariables.NativeLineCoverage)
|
||||
return Bool(c.config.productVariables.GcovCoverage) ||
|
||||
Bool(c.config.productVariables.ClangCoverage)
|
||||
}
|
||||
|
||||
func (c *deviceConfig) ClangCoverageEnabled() bool {
|
||||
return Bool(c.config.productVariables.ClangCoverage)
|
||||
}
|
||||
|
||||
func (c *deviceConfig) GcovCoverageEnabled() bool {
|
||||
return Bool(c.config.productVariables.GcovCoverage)
|
||||
}
|
||||
|
||||
// NativeCoverageEnabledForPath returns whether (GCOV- or Clang-based) native
|
||||
// code coverage is enabled for path. By default, coverage is not enabled for a
|
||||
// given path unless it is part of the NativeCoveragePaths product variable (and
|
||||
|
Reference in New Issue
Block a user