summaryrefslogtreecommitdiff
path: root/rust/testing.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2021-11-01 10:13:25 -0400
committer Ivan Lozano <ivanlozano@google.com> 2021-11-03 12:29:01 -0400
commit5482d6a991b896e0143dfeacbab6356c8e6f5b64 (patch)
tree2ed110b49a8d521f61910d2157a5c59aa6db9939 /rust/testing.go
parenta3bd96398837b2e758ca8f9cf3c7e5cc6338c8a9 (diff)
rust: Support global sanitizers
This CL adds Rust support for the SANITIZE_TARGET options. This CL includes a couple small fixes to related to HWASAN, ASAN, ensuring that the Never sanitize property is respected. Notably, additional llvm-args are passed to ensure that HWASAN-ified Rust/C interop works correctly. Bug: 170672854 Bug: 204915322 Test: SANITIZE_TARGET globally applies hwasan to Rust targets Change-Id: Ia904d07b4618f72cdc95c51f88961905c240ac53
Diffstat (limited to 'rust/testing.go')
-rw-r--r--rust/testing.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/rust/testing.go b/rust/testing.go
index 94cdd9dcd..abcf23544 100644
--- a/rust/testing.go
+++ b/rust/testing.go
@@ -151,7 +151,12 @@ func GatherRequiredDepsForTest() string {
no_libcrt: true,
nocrt: true,
system_shared_libs: [],
- export_include_dirs: ["libprotobuf-cpp-full-includes"],
+ }
+ cc_library {
+ name: "libclang_rt.hwasan_static-aarch64-android",
+ no_libcrt: true,
+ nocrt: true,
+ system_shared_libs: [],
}
rust_library {
name: "libstd",
@@ -246,5 +251,8 @@ func registerRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
ctx.BottomUp("rust_begin", BeginMutator).Parallel()
})
ctx.RegisterSingletonType("rust_project_generator", rustProjectGeneratorSingleton)
+ ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
+ ctx.BottomUp("rust_sanitizers", rustSanitizerRuntimeMutator).Parallel()
+ })
registerRustSnapshotModules(ctx)
}