Merge "Re-plumb fuzz corpora."
This commit is contained in:
@@ -308,15 +308,13 @@ func (fuzz *fuzzBinary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkDa
|
||||
|
||||
var fuzzFiles []string
|
||||
for _, d := range fuzz.corpus {
|
||||
rel := d.Rel()
|
||||
path := d.String()
|
||||
path = strings.TrimSuffix(path, rel)
|
||||
fuzzFiles = append(fuzzFiles, path+":corpus/"+d.Base())
|
||||
fuzzFiles = append(fuzzFiles,
|
||||
filepath.Dir(fuzz.corpusIntermediateDir.String())+":corpus/"+d.Base())
|
||||
}
|
||||
|
||||
if fuzz.dictionary != nil {
|
||||
path := strings.TrimSuffix(fuzz.dictionary.String(), fuzz.dictionary.Rel())
|
||||
fuzzFiles = append(fuzzFiles, path+":"+fuzz.dictionary.Base())
|
||||
fuzzFiles = append(fuzzFiles,
|
||||
filepath.Dir(fuzz.dictionary.String())+":"+fuzz.dictionary.Base())
|
||||
}
|
||||
|
||||
if len(fuzzFiles) > 0 {
|
||||
|
17
cc/fuzz.go
17
cc/fuzz.go
@@ -53,9 +53,10 @@ type fuzzBinary struct {
|
||||
*binaryDecorator
|
||||
*baseCompiler
|
||||
|
||||
Properties FuzzProperties
|
||||
corpus android.Paths
|
||||
dictionary android.Path
|
||||
Properties FuzzProperties
|
||||
dictionary android.Path
|
||||
corpus android.Paths
|
||||
corpusIntermediateDir android.Path
|
||||
}
|
||||
|
||||
func (fuzz *fuzzBinary) linkerProps() []interface{} {
|
||||
@@ -103,6 +104,16 @@ func (fuzz *fuzzBinary) install(ctx ModuleContext, file android.Path) {
|
||||
fuzz.binaryDecorator.baseInstaller.install(ctx, file)
|
||||
|
||||
fuzz.corpus = android.PathsForModuleSrc(ctx, fuzz.Properties.Corpus)
|
||||
builder := android.NewRuleBuilder()
|
||||
intermediateDir := android.PathForModuleOut(ctx, "corpus")
|
||||
for _, entry := range fuzz.corpus {
|
||||
builder.Command().Text("cp").
|
||||
Input(entry).
|
||||
Output(intermediateDir.Join(ctx, entry.Base()))
|
||||
}
|
||||
builder.Build(pctx, ctx, "copy_corpus", "copy corpus")
|
||||
fuzz.corpusIntermediateDir = intermediateDir
|
||||
|
||||
if fuzz.Properties.Dictionary != nil {
|
||||
fuzz.dictionary = android.PathForModuleSrc(ctx, *fuzz.Properties.Dictionary)
|
||||
if fuzz.dictionary.Ext() != ".dict" {
|
||||
|
Reference in New Issue
Block a user