diff options
author | 2022-06-07 20:12:06 +0000 | |
---|---|---|
committer | 2022-07-12 01:20:17 +0000 | |
commit | f4b1c3a7a75fdbdf755d10f476d782c2ffe641c7 (patch) | |
tree | 852f385adb48640b277c96d8af8208771f4a269b /fuzz/fuzz_common.go | |
parent | 87d74dc54e41ef9e9077834136fd8dffc1d84f99 (diff) |
Adding support for building AFLpp
Test: Build AFL fuzzers locally and ran them
Change-Id: Ie07ec336892649192a844a4d0d231196673e34a0
Diffstat (limited to 'fuzz/fuzz_common.go')
-rw-r--r-- | fuzz/fuzz_common.go | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/fuzz/fuzz_common.go b/fuzz/fuzz_common.go index 700cdf0a7..66d5abab6 100644 --- a/fuzz/fuzz_common.go +++ b/fuzz/fuzz_common.go @@ -26,12 +26,13 @@ import ( "android/soong/android" ) -type Lang string +type FuzzType string const ( - Cc Lang = "" - Rust Lang = "rust" - Java Lang = "java" + Cc FuzzType = "" + Rust FuzzType = "rust" + Java FuzzType = "java" + AFL FuzzType = "AFL" ) var BoolDefault = proptools.BoolDefault @@ -46,6 +47,7 @@ type FuzzPackager struct { Packages android.Paths FuzzTargets map[string]bool SharedLibInstallStrings []string + FuzzType FuzzType } type FileToZip struct { @@ -208,7 +210,7 @@ func (f *FuzzConfig) String() string { return string(b) } -func (s *FuzzPackager) CreateFuzzPackage(ctx android.SingletonContext, archDirs map[ArchOs][]FileToZip, lang Lang, pctx android.PackageContext) { +func (s *FuzzPackager) CreateFuzzPackage(ctx android.SingletonContext, archDirs map[ArchOs][]FileToZip, fuzzType FuzzType, pctx android.PackageContext) { var archOsList []ArchOs for archOs := range archDirs { archOsList = append(archOsList, archOs) @@ -221,12 +223,15 @@ func (s *FuzzPackager) CreateFuzzPackage(ctx android.SingletonContext, archDirs hostOrTarget := archOs.HostOrTarget builder := android.NewRuleBuilder(pctx, ctx) zipFileName := "fuzz-" + hostOrTarget + "-" + arch + ".zip" - if lang == Rust { + if fuzzType == Rust { zipFileName = "fuzz-rust-" + hostOrTarget + "-" + arch + ".zip" } - if lang == Java { + if fuzzType == Java { zipFileName = "fuzz-java-" + hostOrTarget + "-" + arch + ".zip" } + if fuzzType == AFL { + zipFileName = "fuzz-afl-" + hostOrTarget + "-" + arch + ".zip" + } outputFile := android.PathForOutput(ctx, zipFileName) s.Packages = append(s.Packages, outputFile) @@ -237,7 +242,6 @@ func (s *FuzzPackager) CreateFuzzPackage(ctx android.SingletonContext, archDirs Flag("-L 0") // No need to try and re-compress the zipfiles. for _, fileToZip := range filesToZip { - if fileToZip.DestinationPathPrefix != "" { command.FlagWithArg("-P ", fileToZip.DestinationPathPrefix) } else { @@ -256,6 +260,7 @@ func (s *FuzzPackager) PreallocateSlice(ctx android.MakeVarsContext, targets str for target, _ := range s.FuzzTargets { fuzzTargets = append(fuzzTargets, target) } + sort.Strings(fuzzTargets) ctx.Strict(targets, strings.Join(fuzzTargets, " ")) } |