summaryrefslogtreecommitdiff
path: root/rust/fuzz_test.go
AgeCommit message (Collapse)Author
2025-03-19Clear as much of cc.Module as possible after GenerateBuildActions Colin Cross
Reduce peak memory usage by adding a CleanupAfterBuildActions method that is called at the end GenerateBuidlActions, nad use it to clear as much of cc.Module as possible. This is a temporary measure, eventually the entire module should be released by blueprint once all interactions are performed through providers. Test: all soong tests pass Change-Id: Idc3390ae4506ff2eef3231691e1de7446067961a
2025-02-12Don't panic in ModuleForTests and friends Colin Cross
Panicking in ModuleForTests and similar test helper functions was a mistake. Go's test runner stops running tests as soon as any test panics, which means debugging multiple tests panicking requires rerunning all the tests after fixing each panic to find the next one. Pass the *testing.T into ModuleForTests and friends so that it can call t.Fatalf instead. Test: all soong tests pass Change-Id: I5d0f2424eaf04fb795079e6d1e4b9469d8c7033c
2024-12-16rust: Remove rust_ffi_rlibs, keep rust_ffi_static Ivan Lozano
rust_ffi_static and rust_ffi_rlibs both alias to rust_library_rlib now. We need to think about whether we need these aliases at all. There are no users of rust_ffi_rlibs at the moment as developers are continuing to declare rust_ffi_static modules. Let's remove this alias in the meantime at least to simplify things. Bug: 350633786 Bug: 383552450 Test: m blueprint_tests && m rust Change-Id: I6be895ddbffc5ac6303f2edc9ab20f7c20cd1591
2024-06-26cc/rust: Alias ffi rlib variant for static_libs Ivan Lozano
Alias the rlib variant to "link: static". This allows declaring rust_ffi_rlib modules in static_libs. This effectively removes any distinction between rust_ffi_static and rust_ffi_rlib. Removing the functionality for building Rust staticlib modules will be cleaned up in a follow-on CL. This should have the effect of changing the default linkage for all rust modules in static_libs from linking individual staticlibs to building a single staticlib that includes all rust_ffi rlib dependencies. This removes the static_rlibs property, as we're now handling the choice dynamically. This also makes rlibs only propagate through cc_library_static modules if the rlib is included in whole_static_lib. This both mirrors the expected behavior of cc libraries and helps control which version of a crate ends up in the final link (e.g. libdoh_ffi vs libdoh_ffi_for_test). Bug: 254469782 Test: m Test: m blueprint_tests Change-Id: I2925f67f6dc9329dae3dcccafb8560900ac8a6fc
2024-05-16rust: made-to-order rust staticlibs Ivan Lozano
Whenever any two Rust static libraries are included as static libraries anywhere in a CC dependency tree, we sometimes get duplicate symbol errors. To avoid this, we no longer directly link multiple rust static libs to CC modules. Instead, we build rust_ffi_rlib modules and produce the actual static library that gets linked against the CC module based on that CC module's full list of Rust rlib dependencies. This introduces a new static_rlibs property for cc modules to define the rust_ffi_rlib dependencies, which are then used to generate the module above. This CL is intended to deprecate rust_ffi_static. It leaves rust_ffi_static and rust_ffi static variants in place until the remaining rust_ffi_static declarations and uses can be removed. In the meantime, rust_ffi_static produces rust_ffi_rlib variants as well to make the transition easier. Bug: 254469782 Test: m # with no changes Test: m libapexsupport # with static_rlibs Test: m libunwindstack # with static_rlibs Test: m netsimd # with static_rlibs, no duplicate symbols Test: m blueprint_tests # New Soong tests Change-Id: I47e27ac967ef0cad46d398ebf59d8275929ae28a
2023-09-22Revert "support sandboxed rust rules" Wen-yi Chu
Revert submission 2629131-sandbox-rust-inputs Reason for revert: Fail on android build. Reverted changes: /q/submissionid:2629131-sandbox-rust-inputs Change-Id: Ifd9aa46e80a12d8f4ffa0a2daa74b96727cbb7e6
2023-09-15support sandboxed rust rules Sam Delmerico
This commit adds support for compiling rust rules inside the sbox sandbox. To compile a rust module with sandboxing enabled, the entry point to the crate must be specified via the `crate_root` property, and all input sources and compile-time data must be specified via the `srcs` and `compile_data` properties. Bug: 286077158 Change-Id: I8c9dc5cf7578037a583b4be2e2f73cf20ffd4408
2023-08-10rust: Add support for host fuzzers. Ivan Lozano
Adds support for host-based Rust fuzzers. Bug: 282897366 Test: SANITZE_HOST="address" m <host_fuzzer> Test: run fuzzer Change-Id: Ibb951f651ef12e763778ebbf12e66769a7113920
2023-06-09rust: Bundle Rust shared dependencies in fuzzers Ivan Lozano
Rust shared library dependencies are not always bundled in cc_fuzz or rust_fuzz modules, which can lead to difficult to debug runtime errors when running these fuzzers. It can also be hard to determine which dependencies need to be explicitly declared. This CL makes sure that we bundle the appropriate transitive dependencies for our fuzzers. Bug: 249551848 Test: Soong tests Test: m <fuzzer> # check data/fuzz/<arch>/lib dir contents Change-Id: I957ca8898079b61e2ff20d750f8c92bf61ac394f
2023-05-24rust: Support sanitizers in rust_ffi modules Ivan Lozano
Don't automatically assume that HWASAN or ASAN is enabled if Fuzzer is enabled. Bug: 178365482 Test: m bluetooth_stack_with_facade Test: SANITIZE_TARGET=fuzzer m bluetooth_stack_with_facade Test: SANITIZE_TARGET=address m bluetooth_stack_with_facade Test: SANITIZE_TARGET=hwaddress m bluetooth_stack_with_facade Test: SANITIZE_TARGET="fuzzer address" m bluetooth_stack_with_facade Test: SANITIZE_TARGET="fuzzer hwaddress" m bluetooth_stack_with_facade Change-Id: Ief8c0f899837c5889a8035782616025f1b0d54e7
2022-03-02Update `RustDefaultVersion` to 1.59.0 Charisee
bug: 215232614 Test: TreeHugger and compiling with m rust Change-Id: Ia60c77637ab2e41844010e021656fad0870013ac
2021-11-09rust: Refactor stripped output file path Ivan Lozano
Rust installed files reside in "$MODULE_OUT/stripped/" when they are stripped, otherwise they reside in "$MODULE_OUT". However, other parts of Soong assume that installed files are always in $MODULE_OUT (cc_modules place *unstripped* files in $MODULE_OUT/unstripped). This notably causes problems when adding Rust modules as test data in AndroidMkDataPaths. When Rust modules are parsed by AndroidMkDataPaths, if they are stripped then they incorrectly get installed as test data with the path: <install_root>/<relative_install_path>/stripped/file. This CL refactors how we handle Rust stripped output such that the installed file always resides in $MODULE_OUT. Bug: 171710847 Test: Installed files now always reside in $MODULE_OUT Change-Id: I53a6ff57a0a5a55cd95ea78ae592ce22abfa20c9
2021-04-13rust: Switch rust_fuzz to HWASan Tri Vo
Bug: 180495975 Test: example_rust_fuzzer Change-Id: I26e6f15136ee2d5f4ed1167be5c1c6a14b19421a
2021-01-25Add Rust fuzzing support. Ivan Lozano
Add a rust_fuzz module which builds a libfuzzer binary that enabes asan+sancov. This relies on the libfuzzer-sys crate. Bug: 147140513 Test: Local rust_fuzz example builds, fuzzes with asan+sancov. Change-Id: I57db3b8d25869791824ccfab768d13b0bb9d42fa