Fix jacoco filters
Add space after -x argument for jacoco excludes. Add .class to end of file name for jacoco includes. Bug: 64836607 Test: jacoco_test.go Change-Id: I4c1024755882c976f7326f7382c4f2e99a20233d
This commit is contained in:
parent
7a3139e05d
commit
d7deceb8fa
|
@ -76,7 +76,7 @@ func (j *Module) jacocoModuleToZipCommand(ctx android.ModuleContext) string {
|
|||
func jacocoFiltersToZipCommand(includes, excludes []string) string {
|
||||
specs := ""
|
||||
if len(excludes) > 0 {
|
||||
specs += android.JoinWithPrefix(excludes, "-x") + " "
|
||||
specs += android.JoinWithPrefix(excludes, "-x ") + " "
|
||||
}
|
||||
if len(includes) > 0 {
|
||||
specs += strings.Join(includes, " ")
|
||||
|
@ -113,6 +113,8 @@ func jacocoFilterToSpec(filter string) (string, error) {
|
|||
spec += "**/*.class"
|
||||
} else if wildcard {
|
||||
spec += "*.class"
|
||||
} else {
|
||||
spec += ".class"
|
||||
}
|
||||
|
||||
return spec, nil
|
||||
|
|
|
@ -20,6 +20,11 @@ func TestJacocoFilterToSpecs(t *testing.T) {
|
|||
testCases := []struct {
|
||||
name, in, out string
|
||||
}{
|
||||
{
|
||||
name: "class",
|
||||
in: "package.Class",
|
||||
out: "package/Class.class",
|
||||
},
|
||||
{
|
||||
name: "class wildcard",
|
||||
in: "package.Class*",
|
||||
|
@ -71,6 +76,12 @@ func TestJacocoFiltersToZipCommand(t *testing.T) {
|
|||
includes: []string{"package/Class.class", "package2/Class.class"},
|
||||
out: "package/Class.class package2/Class.class",
|
||||
},
|
||||
{
|
||||
name: "excludes",
|
||||
includes: []string{"package/**/*.class"},
|
||||
excludes: []string{"package/Class.class"},
|
||||
out: "-x package/Class.class package/**/*.class",
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
|
|
Loading…
Reference in New Issue