mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 15:03:46 +00:00
enable using both cargo-fuzz and afl.rs for fuzzing
This commit is contained in:
parent
6bdab37541
commit
b79c855f15
1 changed files with 12 additions and 4 deletions
|
@ -263,14 +263,21 @@ fn gen_from_mono_module_llvm<'a>(
|
|||
"address" => passes.push("asan-module"),
|
||||
"memory" => passes.push("msan-module"),
|
||||
"thread" => passes.push("tsan-module"),
|
||||
"fuzzer" => {
|
||||
"cargo-fuzz" => {
|
||||
passes.push("sancov-module");
|
||||
extra_args.extend_from_slice(&[
|
||||
"-sanitizer-coverage-level=3",
|
||||
"-sanitizer-coverage-prune-blocks=0",
|
||||
"-sanitizer-coverage-inline-8bit-counters",
|
||||
"-sanitizer-coverage-pc-table",
|
||||
]);
|
||||
}
|
||||
"afl.rs" => {
|
||||
passes.push("sancov-module");
|
||||
extra_args.extend_from_slice(&[
|
||||
"-sanitizer-coverage-level=3",
|
||||
"-sanitizer-coverage-prune-blocks=0",
|
||||
"-sanitizer-coverage-trace-pc-guard",
|
||||
// This can be used instead of the line above to enable working with `cargo fuzz` and libFuzzer.
|
||||
// "-sanitizer-coverage-inline-8bit-counters",
|
||||
]);
|
||||
}
|
||||
x => unrecognized.push(x.to_owned()),
|
||||
|
@ -282,7 +289,8 @@ fn gen_from_mono_module_llvm<'a>(
|
|||
.map(|x| format!("{:?}", x))
|
||||
.collect::<Vec<String>>()
|
||||
.join(", ");
|
||||
eprintln!("Unrecognized sanitizer: {}\nSupported options are \"address\", \"memory\", \"thread\", and \"fuzzer\"", out);
|
||||
eprintln!("Unrecognized sanitizer: {}\nSupported options are \"address\", \"memory\", \"thread\", \"cargo-fuzz\", and \"afl.rs\".", out);
|
||||
eprintln!("Note: \"cargo-fuzz\" and \"afl.rs\" both enable sanitizer coverage for fuzzing. They just use different parameters to match the respective libraries.")
|
||||
}
|
||||
|
||||
use std::process::Command;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue