aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorRyan Campbell <ryanjcampbell@google.com>2017-02-27 09:01:54 -0800
committerRyan Campbell <ryanjcampbell@google.com>2017-02-27 11:08:34 -0800
commit469a18aae2f4924d4bfd0e76639dc43c55467443 (patch)
tree9971d20b82b4bf7af64d2bc763b1a8bc8a17568a /android
parent4c46af8943e81bab2e8de92d8e9b5a0e7e8d79ea (diff)
downloadbuild_soong-469a18aae2f4924d4bfd0e76639dc43c55467443.tar.gz
build_soong-469a18aae2f4924d4bfd0e76639dc43c55467443.tar.bz2
build_soong-469a18aae2f4924d4bfd0e76639dc43c55467443.zip
Support path exclusion for native coverage.
Specify list of paths to exclude from coverage instrumentation. Test: make NATIVE_COVERAGE=true COVERAGE_PATHS=hardware/interfaces COVERAGE_EXCLUDE_PATHS=hardware/interfaces/graphics Bug: 35769817 Change-Id: I3bf10e5e5697d140d6cff73d000768b00aa28ca4
Diffstat (limited to 'android')
-rw-r--r--android/config.go14
-rw-r--r--android/variable.go5
2 files changed, 15 insertions, 4 deletions
diff --git a/android/config.go b/android/config.go
index b4b0be87..1d8cdba4 100644
--- a/android/config.go
+++ b/android/config.go
@@ -477,12 +477,22 @@ func (c *deviceConfig) NativeCoverageEnabled() bool {
}
func (c *deviceConfig) CoverageEnabledForPath(path string) bool {
+ coverage := false
if c.config.ProductVariables.CoveragePaths != nil {
for _, prefix := range *c.config.ProductVariables.CoveragePaths {
if strings.HasPrefix(path, prefix) {
- return true
+ coverage = true
+ break
}
}
}
- return false
+ if coverage && c.config.ProductVariables.CoverageExcludePaths != nil {
+ for _, prefix := range *c.config.ProductVariables.CoverageExcludePaths {
+ if strings.HasPrefix(path, prefix) {
+ coverage = false
+ break
+ }
+ }
+ }
+ return coverage
}
diff --git a/android/variable.go b/android/variable.go
index 68fa7cd0..c5b957be 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -121,8 +121,9 @@ type productVariables struct {
ClangTidy *bool `json:",omitempty"`
TidyChecks *string `json:",omitempty"`
- NativeCoverage *bool `json:",omitempty"`
- CoveragePaths *[]string `json:",omitempty"`
+ NativeCoverage *bool `json:",omitempty"`
+ CoveragePaths *[]string `json:",omitempty"`
+ CoverageExcludePaths *[]string `json:",omitempty"`
DevicePrefer32BitExecutables *bool `json:",omitempty"`
HostPrefer32BitExecutables *bool `json:",omitempty"`