From a588d153c85485336e0509f475a4eec653be339b Mon Sep 17 00:00:00 2001 From: Sam Delmerico Date: Fri, 16 Jun 2023 10:28:04 -0400 Subject: support sandboxed rust rules 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 --- rust/fuzz_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'rust/fuzz_test.go') diff --git a/rust/fuzz_test.go b/rust/fuzz_test.go index ee28c6d3a..ea3590556 100644 --- a/rust/fuzz_test.go +++ b/rust/fuzz_test.go @@ -51,23 +51,23 @@ func TestRustFuzz(t *testing.T) { // Check that compiler flags are set appropriately . fuzz_libtest := ctx.ModuleForTests("fuzz_libtest", "android_arm64_armv8-a_fuzzer").Rule("rustc") - if !strings.Contains(fuzz_libtest.Args["rustcFlags"], "-C passes='sancov-module'") || - !strings.Contains(fuzz_libtest.Args["rustcFlags"], "--cfg fuzzing") { + if !strings.Contains(fuzz_libtest.RuleParams.Command, "-C passes='sancov-module'") || + !strings.Contains(fuzz_libtest.RuleParams.Command, "--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") { + if !strings.Contains(host_fuzzer.RuleParams.Command, "-C passes='sancov-module'") || + !strings.Contains(host_fuzzer.RuleParams.Command, "--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. - libtest_fuzzer := ctx.ModuleForTests("libtest_fuzzing", "android_arm64_armv8-a_rlib_rlib-std_fuzzer").Output("libtest_fuzzing.rlib") - if !strings.Contains(libtest_fuzzer.Args["rustcFlags"], "-C passes='sancov-module'") || - !strings.Contains(libtest_fuzzer.Args["rustcFlags"], "--cfg fuzzing") { - t.Errorf("rust_fuzz dependent library does not contain the expected flags (sancov-module, cfg fuzzing).") + libtest_fuzzer := ctx.ModuleForTests("libtest_fuzzing", "android_arm64_armv8-a_rlib_rlib-std_fuzzer").Rule("rustc") + if !strings.Contains(libtest_fuzzer.RuleParams.Command, "-C passes='sancov-module'") || + !strings.Contains(libtest_fuzzer.RuleParams.Command, "--cfg fuzzing") { + t.Errorf("rust_fuzz dependent library does not contain the expected flags (sancov-module, cfg fuzzing). command: %q", libtest_fuzzer.RuleParams.Command) } } -- cgit v1.2.3-59-g8ed1b