Fix clap in fuzzbench fuzzers (#866)

This commit is contained in:
Andrea Fioraldi 2022-10-26 14:06:14 +02:00 committed by GitHub
parent 5da5997b20
commit ebdab32b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 19 deletions

View File

@ -71,22 +71,19 @@ pub fn libafl_main() {
Arg::new("out") Arg::new("out")
.short('o') .short('o')
.long("output") .long("output")
.help("The directory to place finds in ('corpus')") .help("The directory to place finds in ('corpus')"),
.takes_value(true),
) )
.arg( .arg(
Arg::new("in") Arg::new("in")
.short('i') .short('i')
.long("input") .long("input")
.help("The directory to read initial inputs from ('seeds')") .help("The directory to read initial inputs from ('seeds')"),
.takes_value(true),
) )
.arg( .arg(
Arg::new("tokens") Arg::new("tokens")
.short('x') .short('x')
.long("tokens") .long("tokens")
.help("A file to read tokens from, to be used during fuzzing") .help("A file to read tokens from, to be used during fuzzing"),
.takes_value(true),
) )
.arg( .arg(
Arg::new("logfile") Arg::new("logfile")
@ -102,7 +99,7 @@ pub fn libafl_main() {
.help("Timeout for each individual execution, in milliseconds") .help("Timeout for each individual execution, in milliseconds")
.default_value("1200"), .default_value("1200"),
) )
.arg(Arg::new("remaining").multiple_values(true)) .arg(Arg::new("remaining"))
.try_get_matches() .try_get_matches()
{ {
Ok(res) => res, Ok(res) => res,
@ -123,8 +120,8 @@ pub fn libafl_main() {
env::current_dir().unwrap().to_string_lossy().to_string() env::current_dir().unwrap().to_string_lossy().to_string()
); );
if let Some(filenames) = res.values_of("remaining") { if let Some(filenames) = res.get_many::<String>("remaining") {
let filenames: Vec<&str> = filenames.collect(); let filenames: Vec<&str> = filenames.map(|v| v.as_str()).collect();
if !filenames.is_empty() { if !filenames.is_empty() {
run_testcases(&filenames); run_testcases(&filenames);
return; return;

View File

@ -23,7 +23,7 @@ libafl = { path = "../../libafl/" }
libafl_targets = { path = "../../libafl_targets/", features = ["sancov_pcguard_hitcounts", "sancov_cmplog", "libfuzzer"] } libafl_targets = { path = "../../libafl_targets/", features = ["sancov_pcguard_hitcounts", "sancov_cmplog", "libfuzzer"] }
# TODO Include it only when building cc # TODO Include it only when building cc
libafl_cc = { path = "../../libafl_cc/" } libafl_cc = { path = "../../libafl_cc/" }
clap = { version = "3.2", features = ["default"] } clap = { version = "4.0", features = ["default"] }
nix = "0.25" nix = "0.25"
mimalloc = { version = "*", default-features = false } mimalloc = { version = "*", default-features = false }
content_inspector = "0.2.4" content_inspector = "0.2.4"

View File

@ -77,22 +77,19 @@ pub fn libafl_main() {
Arg::new("out") Arg::new("out")
.short('o') .short('o')
.long("output") .long("output")
.help("The directory to place finds in ('corpus')") .help("The directory to place finds in ('corpus')"),
.takes_value(true),
) )
.arg( .arg(
Arg::new("in") Arg::new("in")
.short('i') .short('i')
.long("input") .long("input")
.help("The directory to read initial inputs from ('seeds')") .help("The directory to read initial inputs from ('seeds')"),
.takes_value(true),
) )
.arg( .arg(
Arg::new("tokens") Arg::new("tokens")
.short('x') .short('x')
.long("tokens") .long("tokens")
.help("A file to read tokens from, to be used during fuzzing") .help("A file to read tokens from, to be used during fuzzing"),
.takes_value(true),
) )
.arg( .arg(
Arg::new("logfile") Arg::new("logfile")
@ -108,7 +105,7 @@ pub fn libafl_main() {
.help("Timeout for each individual execution, in milliseconds") .help("Timeout for each individual execution, in milliseconds")
.default_value("1200"), .default_value("1200"),
) )
.arg(Arg::new("remaining").multiple_values(true)) .arg(Arg::new("remaining"))
.try_get_matches() .try_get_matches()
{ {
Ok(res) => res, Ok(res) => res,
@ -129,8 +126,8 @@ pub fn libafl_main() {
env::current_dir().unwrap().to_string_lossy().to_string() env::current_dir().unwrap().to_string_lossy().to_string()
); );
if let Some(filenames) = res.values_of("remaining") { if let Some(filenames) = res.get_many::<String>("remaining") {
let filenames: Vec<&str> = filenames.collect(); let filenames: Vec<&str> = filenames.map(|v| v.as_str()).collect();
if !filenames.is_empty() { if !filenames.is_empty() {
run_testcases(&filenames); run_testcases(&filenames);
return; return;