Merge "Add use_platform_libs to fuzz config"
This commit is contained in:
@@ -170,6 +170,27 @@ func (service_privilege ServicePrivilege) isValidServicePrivilege() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type UsePlatformLibs string
|
||||||
|
|
||||||
|
const (
|
||||||
|
unknown_use_platform_libs UsePlatformLibs = "unknown_use_platform_libs"
|
||||||
|
// Use the native libraries on the device, typically in /system directory
|
||||||
|
use_platform_libs = "use_platform_libs"
|
||||||
|
// Do not use any native libraries (ART will not be initialized)
|
||||||
|
use_none = "use_none"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (use_platform_libs UsePlatformLibs) isValidUsePlatformLibs() bool {
|
||||||
|
switch use_platform_libs {
|
||||||
|
case "",
|
||||||
|
unknown_use_platform_libs,
|
||||||
|
use_platform_libs,
|
||||||
|
use_none:
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
type UserData string
|
type UserData string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -284,6 +305,10 @@ func IsValidConfig(fuzzModule FuzzPackagedModule, moduleName string) bool {
|
|||||||
if !config.Automatically_route_to.isValidAutomaticallyRouteTo() {
|
if !config.Automatically_route_to.isValidAutomaticallyRouteTo() {
|
||||||
panic(fmt.Errorf("Invalid automatically_route_to in fuzz config in %s", moduleName))
|
panic(fmt.Errorf("Invalid automatically_route_to in fuzz config in %s", moduleName))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !config.Use_platform_libs.isValidUsePlatformLibs() {
|
||||||
|
panic(fmt.Errorf("Invalid use_platform_libs in fuzz config in %s", moduleName))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -341,6 +366,8 @@ type FuzzConfig struct {
|
|||||||
Target_modules []string `json:"target_modules,omitempty"`
|
Target_modules []string `json:"target_modules,omitempty"`
|
||||||
// Specifies a bug assignee to replace default ISE assignment
|
// Specifies a bug assignee to replace default ISE assignment
|
||||||
Triage_assignee string `json:"triage_assignee,omitempty"`
|
Triage_assignee string `json:"triage_assignee,omitempty"`
|
||||||
|
// Specifies libs used to initialize ART (java only, 'use_none' for no initialization)
|
||||||
|
Use_platform_libs UsePlatformLibs `json:"use_platform_libs,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FuzzFrameworks struct {
|
type FuzzFrameworks struct {
|
||||||
|
15
java/fuzz.go
15
java/fuzz.go
@@ -30,8 +30,12 @@ import (
|
|||||||
const (
|
const (
|
||||||
hostString = "host"
|
hostString = "host"
|
||||||
targetString = "target"
|
targetString = "target"
|
||||||
|
deviceString = "device"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Any shared libs for these deps will also be packaged
|
||||||
|
var artDeps = []string{"libdl_android"}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
RegisterJavaFuzzBuildComponents(android.InitRegistrationContext)
|
RegisterJavaFuzzBuildComponents(android.InitRegistrationContext)
|
||||||
}
|
}
|
||||||
@@ -78,7 +82,18 @@ func JavaFuzzFactory() android.Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (j *JavaFuzzTest) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (j *JavaFuzzTest) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
|
if j.Os().Class.String() == deviceString {
|
||||||
|
j.testProperties.Jni_libs = append(j.testProperties.Jni_libs, artDeps...)
|
||||||
|
}
|
||||||
|
|
||||||
if len(j.testProperties.Jni_libs) > 0 {
|
if len(j.testProperties.Jni_libs) > 0 {
|
||||||
|
if j.fuzzPackagedModule.FuzzProperties.Fuzz_config == nil {
|
||||||
|
config := &fuzz.FuzzConfig{}
|
||||||
|
j.fuzzPackagedModule.FuzzProperties.Fuzz_config = config
|
||||||
|
}
|
||||||
|
// this will be used by the ingestion pipeline to determine the version
|
||||||
|
// of jazzer to add to the fuzzer package
|
||||||
|
j.fuzzPackagedModule.FuzzProperties.Fuzz_config.IsJni = proptools.BoolPtr(true)
|
||||||
for _, target := range ctx.MultiTargets() {
|
for _, target := range ctx.MultiTargets() {
|
||||||
sharedLibVariations := append(target.Variations(), blueprint.Variation{Mutator: "link", Variation: "shared"})
|
sharedLibVariations := append(target.Variations(), blueprint.Variation{Mutator: "link", Variation: "shared"})
|
||||||
ctx.AddFarVariationDependencies(sharedLibVariations, jniLibTag, j.testProperties.Jni_libs...)
|
ctx.AddFarVariationDependencies(sharedLibVariations, jniLibTag, j.testProperties.Jni_libs...)
|
||||||
|
Reference in New Issue
Block a user