Re-plumb fuzz corpora.
Re-plumb the fuzz corpora through an intermediates directory.
Previously, due to the way that LOCAL_TEST_DATA is implemented, we would
break when corpora were included:
a) outside of a corpus/ directory, or
b) not directly under the module directory (i.e. my_module/subdir/corpus)
Corpora are now written into an intermediates directory so that they
play nice with LOCAL_TEST_DATA, because unfortunately the key-value pair
required there is not as simple as source:destination.
Test: m example_fuzzer && ls \
$ANDROID_PRODUCT_OUT/data/fuzz/arm64/example_fuzzer/corpus
Bug: N/A
Change-Id: I5888b06ed349781c6712f1ae77cc3582283a9552
diff --git a/cc/androidmk.go b/cc/androidmk.go
index f1d329f..9a98b0e 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -308,15 +308,13 @@
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 {