Soong frontend for shared library fuzzing.
Additional context (for Googlers): go/android-fuzzing-shared
This patch adds the Soong frontend for shared library fuzzing. We
traverse dependencies at soong install time to find all transient shared
libraries that $module depends on. We then ask the Make backend to
depend on the shared library.
We also create the source:destination mappings between where the shared
libraries are built to where they should be installed to for fuzzing.
This is then depended on by the Make backend.
Bug: N/A
Test: m fuzz, note the contents of $ANDROID_PRODUCT_OUT/data/fuzz/lib,
and out/soong/fuzz-target-*.zip now has shared libraries.
Change-Id: Id7afbd34bc9c055110af96cd3c668b730d404aee
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 91a3c99..ff181d8 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -327,14 +327,15 @@
filepath.Dir(fuzz.config.String())+":config.json")
}
- if len(fuzzFiles) > 0 {
- ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
- fmt.Fprintln(w, "LOCAL_TEST_DATA := "+strings.Join(fuzzFiles, " "))
- })
- }
-
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
fmt.Fprintln(w, "LOCAL_IS_FUZZ_TARGET := true")
+ if len(fuzzFiles) > 0 {
+ fmt.Fprintln(w, "LOCAL_TEST_DATA := "+strings.Join(fuzzFiles, " "))
+ }
+ if fuzz.installedSharedDeps != nil {
+ fmt.Fprintln(w, "LOCAL_FUZZ_INSTALLED_SHARED_DEPS :="+
+ strings.Join(fuzz.installedSharedDeps, " "))
+ }
})
}