Skip to content

Commit

Permalink
Fixes again
Browse files Browse the repository at this point in the history
  • Loading branch information
headshog committed Mar 21, 2024
1 parent 5da2399 commit 90842da
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 88 deletions.
2 changes: 1 addition & 1 deletion casr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ tokio = { version = "1", features = ["rt", "macros"], optional = true }
toml = { version = "0.7", optional = true }
wait-timeout = "0.2"
which = "4.4"
copy_dir = "0.1.3"

libcasr = { path = "../libcasr", version = "2.11.1", features = ["serde", "exploitable"] }

Expand All @@ -54,3 +53,4 @@ required-features = ["dojo"]
[dev-dependencies]
lazy_static = "1.4"
lsb_release = "0.1"
copy_dir = "0.1.3"
98 changes: 13 additions & 85 deletions casr/tests/tests.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
extern crate copy_dir;
extern crate lazy_static;
extern crate regex;
extern crate serde_json;
extern crate copy_dir;

use copy_dir::copy_dir;
use regex::Regex;
use serde_json::Value;
use std::env;
use std::fs;
use copy_dir::copy_dir;

use std::io::Write;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -3867,18 +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 output = Command::new("cp")
.args(["-r", &work_dir, &test_dir])
.output()
.expect("failed to copy dir");

assert!(
output.status.success(),
"Stdout {}.\n Stderr: {}",
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
);
let _ = copy_dir(work_dir, &test_dir);

let paths = [
abs_path("tests/tmp_tests_casr/test_casr_ubsan/test_ubsan.cpp"),
Expand Down Expand Up @@ -4390,17 +4379,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 output = Command::new("cp")
.args(["-r", &work_dir, &test_dir])
.output()
.expect("failed to copy dir");

assert!(
output.status.success(),
"Stdout {}.\n Stderr: {}",
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
);
let _ = copy_dir(work_dir, &test_dir);

let paths = [
abs_path("tests/tmp_tests_casr/test_casr_san_python_df/cpp_module.cpp"),
Expand Down Expand Up @@ -4501,17 +4480,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 output = Command::new("cp")
.args(["-r", &work_dir, &test_dir])
.output()
.expect("failed to copy dir");

assert!(
output.status.success(),
"Stdout {}.\n Stderr: {}",
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
);
let _ = copy_dir(work_dir, &test_dir);

let paths = [
abs_path("tests/tmp_tests_casr/test_casr_san_atheris_df/cpp_module.cpp"),
Expand Down Expand Up @@ -4616,17 +4585,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 output = Command::new("cp")
.args(["-r", &work_dir, &test_dir])
.output()
.expect("failed to copy dir");

assert!(
output.status.success(),
"Stdout {}.\n Stderr: {}",
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
);
let _ = copy_dir(work_dir, &test_dir);

let paths = [
abs_path("tests/tmp_tests_casr/test_casr_python_call_san_df/cpp_module.cpp"),
Expand Down Expand Up @@ -4988,19 +4947,9 @@ fn test_casr_js_native() {
// Copy files to tmp dir
let work_dir = abs_path("tests/casr_tests/js");
let test_dir = abs_path("tests/tmp_tests_casr/test_casr_js_native");
let _ = std::fs::remove_dir_all(&test_dir);

let output = Command::new("cp")
.args(["-r", &work_dir, &test_dir])
.output()
.expect("failed to copy dir");

assert!(
output.status.success(),
"Stdout {}.\n Stderr: {}",
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
);
let _ = std::fs::remove_dir_all(&test_dir);
let _ = copy_dir(work_dir, &test_dir);

let paths = [
abs_path("tests"),
Expand Down Expand Up @@ -5127,19 +5076,9 @@ fn test_casr_js_native_jsfuzz() {
// Copy files to tmp dir
let work_dir = abs_path("tests/casr_tests/js");
let test_dir = abs_path("tests/tmp_tests_casr/test_casr_js_native_jsfuzz");
let _ = std::fs::remove_dir_all(&test_dir);

let output = Command::new("cp")
.args(["-r", &work_dir, &test_dir])
.output()
.expect("failed to copy dir");

assert!(
output.status.success(),
"Stdout {}.\n Stderr: {}",
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
);
let _ = std::fs::remove_dir_all(&test_dir);
let _ = copy_dir(work_dir, &test_dir);

let paths = [
abs_path("tests"),
Expand Down Expand Up @@ -5266,19 +5205,9 @@ fn test_casr_js_native_jazzer() {
// Copy files to tmp dir
let work_dir = abs_path("tests/casr_tests/js");
let test_dir = abs_path("tests/tmp_tests_casr/test_casr_js_native_jazzer");
let _ = std::fs::remove_dir_all(&test_dir);

let output = Command::new("cp")
.args(["-r", &work_dir, &test_dir])
.output()
.expect("failed to copy dir");

assert!(
output.status.success(),
"Stdout {}.\n Stderr: {}",
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
);
let _ = std::fs::remove_dir_all(&test_dir);
let _ = copy_dir(work_dir, &test_dir);

let paths = [
abs_path("tests"),
Expand Down Expand Up @@ -5955,7 +5884,7 @@ fn test_casr_afl_csharp_ignore_cmd() {
&format!("{}/test_casr_afl_csharp.csproj", &paths[4]),
])
.output()
.expect("dotnet publish crashed");
.expect("dotnet build crashed");

let bins = Path::new(*EXE_CASR_AFL.read().unwrap()).parent().unwrap();
let mut output = Command::new(*EXE_CASR_AFL.read().unwrap());
Expand All @@ -5979,7 +5908,6 @@ fn test_casr_afl_csharp_ignore_cmd() {
format!("{}:{}", bins.display(), std::env::var("PATH").unwrap()),
);

print!("{:?}", output);
let output = output.output().expect("casr-afl crashed");

assert!(
Expand Down
4 changes: 2 additions & 2 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ Convert reports to SARIF report:

## casr-afl

Triage crashes found by AFL++ (Sharpfuzz)
Triage crashes found by AFL++/Sharpfuzz

Usage: casr-afl [OPTIONS] --input <INPUT_DIR> --output <OUTPUT_DIR> [-- <ARGS>...]

Expand All @@ -455,7 +455,7 @@ Triage crashes found by AFL++ (Sharpfuzz)
-i, --input <INPUT_DIR> AFL++ work directory
-o, --output <OUTPUT_DIR> Output directory with triaged reports
-f, --force-remove Remove output project directory if it exists
--ignore-cmdline Force <casr-gdb-args> usage to run target instead of searching for cmdline files
--ignore-cmdline Force <ARGS> usage to run target instead of searching for cmdline files
in AFL fuzzing directory
--no-cluster Do not cluster CASR reports
-h, --help Print help
Expand Down

0 comments on commit 90842da

Please sign in to comment.