Merge "Add use_platform_libs to fuzz config"
This commit is contained in:
commit
3bc9c57dc4
2 changed files with 42 additions and 0 deletions
|
@ -170,6 +170,27 @@ func (service_privilege ServicePrivilege) isValidServicePrivilege() bool {
|
|||
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
|
||||
|
||||
const (
|
||||
|
@ -284,6 +305,10 @@ func IsValidConfig(fuzzModule FuzzPackagedModule, moduleName string) bool {
|
|||
if !config.Automatically_route_to.isValidAutomaticallyRouteTo() {
|
||||
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
|
||||
}
|
||||
|
@ -341,6 +366,8 @@ type FuzzConfig struct {
|
|||
Target_modules []string `json:"target_modules,omitempty"`
|
||||
// Specifies a bug assignee to replace default ISE assignment
|
||||
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 {
|
||||
|
|
15
java/fuzz.go
15
java/fuzz.go
|
@ -30,8 +30,12 @@ import (
|
|||
const (
|
||||
hostString = "host"
|
||||
targetString = "target"
|
||||
deviceString = "device"
|
||||
)
|
||||
|
||||
// Any shared libs for these deps will also be packaged
|
||||
var artDeps = []string{"libdl_android"}
|
||||
|
||||
func init() {
|
||||
RegisterJavaFuzzBuildComponents(android.InitRegistrationContext)
|
||||
}
|
||||
|
@ -78,7 +82,18 @@ func JavaFuzzFactory() android.Module {
|
|||
}
|
||||
|
||||
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 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() {
|
||||
sharedLibVariations := append(target.Variations(), blueprint.Variation{Mutator: "link", Variation: "shared"})
|
||||
ctx.AddFarVariationDependencies(sharedLibVariations, jniLibTag, j.testProperties.Jni_libs...)
|
||||
|
|
Loading…
Reference in a new issue