Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 469a18aa authored by Ryan Campbell's avatar Ryan Campbell
Browse files

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
parent 4c46af89
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -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
}
+3 −2
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@ type productVariables struct {

	NativeCoverage       *bool     `json:",omitempty"`
	CoveragePaths        *[]string `json:",omitempty"`
	CoverageExcludePaths *[]string `json:",omitempty"`

	DevicePrefer32BitExecutables *bool `json:",omitempty"`
	HostPrefer32BitExecutables   *bool `json:",omitempty"`