summaryrefslogtreecommitdiff
path: root/rust/fuzz_test.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2023-07-27 10:40:52 -0400
committer Ivan Lozano <ivanlozano@google.com> 2023-08-10 09:48:13 -0400
commit2fcbffa4a1dd445586bb6be14caa38ba3ef4bdc3 (patch)
tree17e9dc29401c8d303404252f7564fff72512cd5c /rust/fuzz_test.go
parent69bda98f506e2c585d43e74d374ea09892db4218 (diff)
rust: Add support for host fuzzers.
Adds support for host-based Rust fuzzers. Bug: 282897366 Test: SANITZE_HOST="address" m <host_fuzzer> Test: run fuzzer Change-Id: Ibb951f651ef12e763778ebbf12e66769a7113920
Diffstat (limited to 'rust/fuzz_test.go')
-rw-r--r--rust/fuzz_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/rust/fuzz_test.go b/rust/fuzz_test.go
index 0aecf617e..ee28c6d3a 100644
--- a/rust/fuzz_test.go
+++ b/rust/fuzz_test.go
@@ -34,6 +34,10 @@ func TestRustFuzz(t *testing.T) {
srcs: ["foo.rs"],
rustlibs: ["libtest_fuzzing"],
}
+ rust_fuzz_host {
+ name: "host_fuzzer",
+ srcs: ["foo.rs"],
+ }
`)
// Check that appropriate dependencies are added and that the rustlib linkage is correct.
@@ -50,7 +54,13 @@ func TestRustFuzz(t *testing.T) {
if !strings.Contains(fuzz_libtest.Args["rustcFlags"], "-C passes='sancov-module'") ||
!strings.Contains(fuzz_libtest.Args["rustcFlags"], "--cfg fuzzing") {
t.Errorf("rust_fuzz module does not contain the expected flags (sancov-module, cfg fuzzing).")
+ }
+ // Check that host modules support fuzzing.
+ host_fuzzer := ctx.ModuleForTests("fuzz_libtest", "android_arm64_armv8-a_fuzzer").Rule("rustc")
+ if !strings.Contains(host_fuzzer.Args["rustcFlags"], "-C passes='sancov-module'") ||
+ !strings.Contains(host_fuzzer.Args["rustcFlags"], "--cfg fuzzing") {
+ t.Errorf("rust_fuzz_host module does not contain the expected flags (sancov-module, cfg fuzzing).")
}
// Check that dependencies have 'fuzzer' variants produced for them as well.