Skip to content

Commit

Permalink
Handle copy_dir and remove range from .value_parser
Browse files Browse the repository at this point in the history
  • Loading branch information
headshog committed Mar 27, 2024
1 parent 615f0e4 commit 494463c
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion casr/src/bin/casr-afl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn main() -> Result<()> {
.default_value("0")
.value_name("SECONDS")
.help("Timeout (in seconds) for target execution, 0 value means that timeout is disabled")
.value_parser(clap::value_parser!(u64).range(0..))
.value_parser(clap::value_parser!(u64))
)
.arg(
Arg::new("input")
Expand Down
4 changes: 0 additions & 4 deletions casr/src/bin/casr-cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,10 +669,6 @@ fn build_slider_report(
select.add_item("CSharpReport", report.csharp_report.join("\n"));
}

if !report.csharp_report.is_empty() {
select.add_item("CSharpReport", report.csharp_report.join("\n"));
}

if !report.source.is_empty() {
select.add_item("Source", report.source.join("\n"));
}
Expand Down
2 changes: 1 addition & 1 deletion casr/src/bin/casr-csharp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn main() -> Result<()> {
.default_value("0")
.value_name("SECONDS")
.help("Timeout (in seconds) for target execution, 0 value means that timeout is disabled")
.value_parser(clap::value_parser!(u64).range(0..))
.value_parser(clap::value_parser!(u64))
)
.arg(
Arg::new("ignore")
Expand Down
2 changes: 1 addition & 1 deletion casr/src/bin/casr-gdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn main() -> Result<()> {
.default_value("0")
.value_name("SECONDS")
.help("Timeout (in seconds) for target execution, 0 value means that timeout is disabled")
.value_parser(clap::value_parser!(u64).range(0..))
.value_parser(clap::value_parser!(u64))
)
.arg(
Arg::new("ignore")
Expand Down
2 changes: 1 addition & 1 deletion casr/src/bin/casr-java.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn main() -> Result<()> {
.default_value("0")
.value_name("SECONDS")
.help("Timeout (in seconds) for target execution, 0 value means that timeout is disabled")
.value_parser(clap::value_parser!(u64).range(0..))
.value_parser(clap::value_parser!(u64))
)
.arg(
Arg::new("ignore")
Expand Down
2 changes: 1 addition & 1 deletion casr/src/bin/casr-js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn main() -> Result<()> {
.default_value("0")
.value_name("SECONDS")
.help("Timeout (in seconds) for target execution, 0 value means that timeout is disabled")
.value_parser(clap::value_parser!(u64).range(0..))
.value_parser(clap::value_parser!(u64))
)
.arg(
Arg::new("ignore")
Expand Down
2 changes: 1 addition & 1 deletion casr/src/bin/casr-libfuzzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn main() -> Result<()> {
.default_value("0")
.value_name("SECONDS")
.help("Timeout (in seconds) for target execution, 0 means that timeout is disabled")
.value_parser(clap::value_parser!(u64).range(0..))
.value_parser(clap::value_parser!(u64))
)
.arg(
Arg::new("input")
Expand Down
2 changes: 1 addition & 1 deletion casr/src/bin/casr-python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn main() -> Result<()> {
.default_value("0")
.value_name("SECONDS")
.help("Timeout (in seconds) for target execution, 0 value means that timeout is disabled")
.value_parser(clap::value_parser!(u64).range(0..))
.value_parser(clap::value_parser!(u64))
)
.arg(
Arg::new("ignore")
Expand Down
2 changes: 1 addition & 1 deletion casr/src/bin/casr-san.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn main() -> Result<()> {
.default_value("0")
.value_name("SECONDS")
.help("Timeout (in seconds) for target execution, 0 value means that timeout is disabled")
.value_parser(clap::value_parser!(u64).range(0..))
.value_parser(clap::value_parser!(u64))
)
.arg(
Arg::new("ignore")
Expand Down
2 changes: 1 addition & 1 deletion casr/src/bin/casr-ubsan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ fn main() -> Result<()> {
.default_value("0")
.value_name("SECONDS")
.help("Timeout (in seconds) for target execution, 0 value means that timeout is disabled")
.value_parser(clap::value_parser!(u64).range(0..))
.value_parser(clap::value_parser!(u64))
)
.arg(
Arg::new("input")
Expand Down
22 changes: 11 additions & 11 deletions casr/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3867,7 +3867,7 @@ fn test_casr_ubsan() {
let test_dir = abs_path("tests/tmp_tests_casr/test_casr_ubsan");

let _ = fs::remove_dir_all(&test_dir);
let _ = copy_dir(work_dir, &test_dir);
let _ = copy_dir(work_dir, &test_dir).unwrap();

let paths = [
abs_path("tests/tmp_tests_casr/test_casr_ubsan/test_ubsan.cpp"),
Expand Down Expand Up @@ -4367,7 +4367,7 @@ fn test_casr_san_python_df() {
let work_dir = abs_path("tests/casr_tests/python");
let test_dir = abs_path("tests/tmp_tests_casr/test_casr_san_python_df");

let _ = copy_dir(work_dir, &test_dir);
let _ = copy_dir(work_dir, &test_dir).unwrap();

let paths = [
abs_path("tests/tmp_tests_casr/test_casr_san_python_df/cpp_module.cpp"),
Expand Down Expand Up @@ -4464,7 +4464,7 @@ fn test_casr_san_atheris_df() {
let work_dir = abs_path("tests/casr_tests/python");
let test_dir = abs_path("tests/tmp_tests_casr/test_casr_san_atheris_df");

let _ = copy_dir(work_dir, &test_dir);
let _ = copy_dir(work_dir, &test_dir).unwrap();

let paths = [
abs_path("tests/tmp_tests_casr/test_casr_san_atheris_df/cpp_module.cpp"),
Expand Down Expand Up @@ -4565,7 +4565,7 @@ fn test_casr_python_call_san_df() {
let work_dir = abs_path("tests/casr_tests/python");
let test_dir = abs_path("tests/tmp_tests_casr/test_casr_python_call_san_df");

let _ = copy_dir(work_dir, &test_dir);
let _ = copy_dir(work_dir, &test_dir).unwrap();

let paths = [
abs_path("tests/tmp_tests_casr/test_casr_python_call_san_df/cpp_module.cpp"),
Expand Down Expand Up @@ -4925,7 +4925,7 @@ fn test_casr_js_native() {
let test_dir = abs_path("tests/tmp_tests_casr/test_casr_js_native");

let _ = std::fs::remove_dir_all(&test_dir);
let _ = copy_dir(work_dir, &test_dir);
let _ = copy_dir(work_dir, &test_dir).unwrap();

let paths = [
abs_path("tests"),
Expand Down Expand Up @@ -5050,7 +5050,7 @@ fn test_casr_js_native_jsfuzz() {
let test_dir = abs_path("tests/tmp_tests_casr/test_casr_js_native_jsfuzz");

let _ = std::fs::remove_dir_all(&test_dir);
let _ = copy_dir(work_dir, &test_dir);
let _ = copy_dir(work_dir, &test_dir).unwrap();

let paths = [
abs_path("tests"),
Expand Down Expand Up @@ -5175,7 +5175,7 @@ fn test_casr_js_native_jazzer() {
let test_dir = abs_path("tests/tmp_tests_casr/test_casr_js_native_jazzer");

let _ = std::fs::remove_dir_all(&test_dir);
let _ = copy_dir(work_dir, &test_dir);
let _ = copy_dir(work_dir, &test_dir).unwrap();

let paths = [
abs_path("tests"),
Expand Down Expand Up @@ -5740,8 +5740,8 @@ fn test_casr_afl_csharp() {

let _ = fs::remove_dir_all(&paths[1]);
let _ = fs::create_dir(abs_path("tests/tmp_tests_casr"));
let _ = copy_dir(&paths[2], &paths[4]);
let _ = copy_dir(&paths[3], &paths[5]);
let _ = copy_dir(&paths[2], &paths[4]).unwrap();
let _ = copy_dir(&paths[3], &paths[5]).unwrap();
let Ok(dotnet_path) = which::which("dotnet") else {
panic!("No dotnet is found.");
};
Expand Down Expand Up @@ -5840,8 +5840,8 @@ fn test_casr_afl_csharp_ignore_cmd() {

let _ = fs::remove_dir_all(&paths[1]);
let _ = fs::create_dir(abs_path("tests/tmp_tests_casr"));
let _ = copy_dir(&paths[2], &paths[4]);
let _ = copy_dir(&paths[3], &paths[5]);
let _ = copy_dir(&paths[2], &paths[4]).unwrap();
let _ = copy_dir(&paths[3], &paths[5]).unwrap();
let Ok(dotnet_path) = which::which("dotnet") else {
panic!("No dotnet is found.");
};
Expand Down

0 comments on commit 494463c

Please sign in to comment.