Skip to content

Commit

Permalink
Renamed option
Browse files Browse the repository at this point in the history
  • Loading branch information
hkctkuy committed Jun 12, 2024
1 parent 7f52ce1 commit ea477c0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions casr/src/bin/casr-afl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ fn main() -> Result<()> {
.help("Output directory with triaged reports")
)
.arg(
Arg::new("seed")
.short('s')
.long("seed")
.env("CASR_SEED_DIR")
Arg::new("base")
.short('b')
.long("base")
.env("CASR_BASE_DIR")
.action(ArgAction::Set)
.value_parser(clap::value_parser!(PathBuf))
.value_name("SEED_DIR")
.help("Seed directory with previously triaged reports")
.value_name("BASE_DIR")
.help("Base directory with previously triaged reports")
)
.arg(
Arg::new("force-remove")
Expand Down
12 changes: 6 additions & 6 deletions casr/src/bin/casr-libfuzzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ fn main() -> Result<()> {
.help("Output directory with triaged reports")
)
.arg(
Arg::new("seed")
.short('s')
.long("seed")
.env("CASR_SEED_DIR")
Arg::new("base")
.short('b')
.long("base")
.env("CASR_BASE_DIR")
.action(ArgAction::Set)
.value_parser(clap::value_parser!(PathBuf))
.value_name("SEED_DIR")
.help("Seed directory with previously triaged reports")
.value_name("BASE_DIR")
.help("Base directory with previously triaged reports")
)
.arg(
Arg::new("force-remove")
Expand Down
6 changes: 3 additions & 3 deletions casr/src/triage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ pub fn fuzzing_crash_triage_pipeline(
bail!("No crashes found");
}

let seed_mode = matches.contains_id("seed");
let base_mode = matches.contains_id("base");

let output_dir = initialize_dirs(matches)?;

let casrep_dir = if seed_mode {
let casrep_dir = if base_mode {
output_dir.join("casrep")
} else {
output_dir.to_path_buf()
Expand Down Expand Up @@ -238,7 +238,7 @@ pub fn fuzzing_crash_triage_pipeline(
}

if !matches.get_flag("no-cluster") {
if seed_mode {
if base_mode {
info!("Accumulating CASR reports...");
let casr_cluster_u = Command::new(&casr_cluster)
.arg("-u")
Expand Down
6 changes: 3 additions & 3 deletions casr/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ pub fn initialize_dirs(matches: &clap::ArgMatches) -> Result<&PathBuf> {
}
}

if let Some(seed_dir) = matches.get_one::<PathBuf>("seed") {
copy_dir(seed_dir, output_dir)
.with_context(|| format!("Couldn't copy seed directory {}", seed_dir.display()))?;
if let Some(base_dir) = matches.get_one::<PathBuf>("base") {
copy_dir(base_dir, output_dir)
.with_context(|| format!("Couldn't copy base directory {}", base_dir.display()))?;
// Get casrep dir
let casrep_dir = output_dir.join("casrep");
if !casrep_dir.exists() && fs::create_dir_all(&casrep_dir).is_err() {
Expand Down
14 changes: 7 additions & 7 deletions casr/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3951,7 +3951,7 @@ fn test_casr_libfuzzer() {

let paths = [
abs_path("tests/casr_tests/casrep/libfuzzer_crashes_xlnt"),
abs_path("tests/tmp_tests_casr/casr_libfuzzer_seed"),
abs_path("tests/tmp_tests_casr/casr_libfuzzer_base"),
abs_path("tests/tmp_tests_casr/casr_libfuzzer_out"),
abs_path("tests/casr_tests/bin/load_fuzzer"),
];
Expand Down Expand Up @@ -4039,19 +4039,19 @@ fn test_casr_libfuzzer() {

// Remove several clusters
let cluster_paths = [
abs_path("tests/tmp_tests_casr/casr_libfuzzer_seed/cl2"),
abs_path("tests/tmp_tests_casr/casr_libfuzzer_seed/cl20"),
abs_path("tests/tmp_tests_casr/casr_libfuzzer_seed/cl21"),
abs_path("tests/tmp_tests_casr/casr_libfuzzer_seed/cl22"),
abs_path("tests/tmp_tests_casr/casr_libfuzzer_seed/cl23"),
abs_path("tests/tmp_tests_casr/casr_libfuzzer_base/cl2"),
abs_path("tests/tmp_tests_casr/casr_libfuzzer_base/cl20"),
abs_path("tests/tmp_tests_casr/casr_libfuzzer_base/cl21"),
abs_path("tests/tmp_tests_casr/casr_libfuzzer_base/cl22"),
abs_path("tests/tmp_tests_casr/casr_libfuzzer_base/cl23"),
];
for path in cluster_paths {
let _ = fs::remove_dir_all(path);
}

let mut cmd = Command::new(*EXE_CASR_LIBFUZZER.read().unwrap());
cmd.args([
"-i", &paths[0], "-s", &paths[1], "-o", &paths[2], "-f", "--", &paths[3],
"-i", &paths[0], "-b", &paths[1], "-o", &paths[2], "-f", "--", &paths[3],
])
.env(
"PATH",
Expand Down

0 comments on commit ea477c0

Please sign in to comment.