Skip to content

Commit

Permalink
Remove unused logging dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
louismerlin committed Nov 13, 2024
1 parent 368f950 commit d441787
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 114 deletions.
75 changes: 0 additions & 75 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ anyhow = { version = "1.0.83", optional = true }
cargo_metadata = { version = "0.18.1", optional = true }
clap = { version = "4.5.4", features = ["cargo", "derive", "env"], optional = true }
console = { version = "0.15.8", optional = true }
env_logger = { version = "0.11.3", optional = true }
fork = { version = "0.1.23", optional = true }
glob = { version = "0.3.1", optional = true }
honggfuzz = { version = "0.5.56", optional = true }
libc = { version = "0.2.153", optional = true }
log = { version = "0.4.21", optional = true }
semver = { version = "1.0.23", optional = true }
strip-ansi-escapes = { version = "0.2.0", optional = true }
time-humanize = { version = "0.1.3", optional = true }
Expand All @@ -38,8 +36,6 @@ cli = [
"glob",
"semver",
"anyhow",
"log",
"env_logger",
"strip-ansi-escapes",
"libc",
"time-humanize",
Expand Down
4 changes: 0 additions & 4 deletions src/bin/cargo-ziggy/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ impl Build {

// The cargo executable
let cargo = env::var("CARGO").unwrap_or_else(|_| String::from("cargo"));
info!("Starting build command");

if !self.no_afl {
eprintln!(" {} afl", style("Building").red().bold());
Expand All @@ -33,7 +32,6 @@ impl Build {
if self.release {
assert!(!self.release, "cannot use --release for ASAN builds");
afl_args.push("--release");
info!("Building in release mode");
}

let opt_level = env::var("AFL_OPT_LEVEL").unwrap_or("0".to_string());
Expand All @@ -43,7 +41,6 @@ impl Build {
let opt_level_str = format!("-Copt-level={opt_level}");

if self.asan {
info!("Building with ASAN");
assert_eq!(opt_level, "0", "AFL_OPT_LEVEL must be 0 for ASAN builds");
afl_args.push(&asan_target_str);
afl_args.extend(["-Z", "build-std"]);
Expand Down Expand Up @@ -87,7 +84,6 @@ impl Build {
// Add the --release argument if self.release is true
if self.release {
hfuzz_args.push("--release");
info!("Building in release mode");
}

// Second fuzzer we build: Honggfuzz
Expand Down
2 changes: 0 additions & 2 deletions src/bin/cargo-ziggy/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ impl Cover {
.as_str(),
);

info!("Corpus directory is {}", shared_corpus.display());

let _ = process::Command::new(format!("./target/coverage/debug/{}", &self.target))
.arg(format!("{}", shared_corpus.display()))
.spawn()
Expand Down
12 changes: 0 additions & 12 deletions src/bin/cargo-ziggy/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ impl Fuzz {
build.build().context("Failed to build the fuzzers")?;
}

info!("Running fuzzer");

self.target = if self.fuzz_binary() {
self.binary
.as_ref()
Expand Down Expand Up @@ -165,9 +163,7 @@ impl Fuzz {

// We prepare builds for the coverage worker
if self.coverage_worker {
info!("cleaning old coverage files");
Cover::clean_old_cov()?;
info!("building coverage worker");
Cover::build_runner()?;
}
let cov_start_time = Arc::new(Mutex::new(None));
Expand Down Expand Up @@ -333,7 +329,6 @@ impl Fuzz {
.all(|p| p.try_wait().unwrap_or(None).is_some())
{
stop_fuzzers(&mut processes)?;
warn!("Fuzzers stopped, check for errors!");
return Ok(());
}
}
Expand All @@ -348,8 +343,6 @@ impl Fuzz {
));
}

info!("Spawning new fuzzers");

let mut fuzzer_handles = vec![];

// The cargo executable
Expand Down Expand Up @@ -954,7 +947,6 @@ pub fn kill_subprocesses_recursively(pid: &str) -> Result<(), Error> {
.context("Error in kill_subprocesses_recursively for pid {pid}")?;
}

info!("Killing pid {pid}");
unsafe {
libc::kill(pid.parse::<i32>().unwrap(), libc::SIGTERM);
}
Expand All @@ -963,12 +955,8 @@ pub fn kill_subprocesses_recursively(pid: &str) -> Result<(), Error> {

// Stop all fuzzer processes
pub fn stop_fuzzers(processes: &mut Vec<process::Child>) -> Result<(), Error> {
info!("Stopping fuzzer processes");

for process in processes {
kill_subprocesses_recursively(&process.id().to_string())?;
info!("Process kill: {:?}", process.kill());
info!("Process wait: {:?}", process.wait());
}
Ok(())
}
Expand Down
12 changes: 0 additions & 12 deletions src/bin/cargo-ziggy/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ use clap::{Args, Parser, Subcommand, ValueEnum};
#[cfg(feature = "cli")]
use std::{fs, path::PathBuf};

#[cfg(feature = "cli")]
#[macro_use]
extern crate log;

pub const DEFAULT_UNMODIFIED_TARGET: &str = "automatically guessed";

#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
Expand Down Expand Up @@ -349,7 +345,6 @@ pub struct AddSeeds {

#[cfg(feature = "cli")]
fn main() -> Result<(), anyhow::Error> {
env_logger::init();
let Cargo::Ziggy(command) = Cargo::parse();
match command {
Ziggy::Build(args) => args.build().context("Failed to build the fuzzers"),
Expand All @@ -370,18 +365,11 @@ fn main() -> Result<(), anyhow::Error> {
pub fn find_target(target: &String) -> Result<String, anyhow::Error> {
// If the target is already set, we're done here
if target != DEFAULT_UNMODIFIED_TARGET {
info!(" Using given target {target}");
return Ok(target.into());
}

info!("Guessing target");

let new_target_result = guess_target();

if let Ok(ref new_target) = new_target_result {
info!(" Using target {new_target}");
}

new_target_result.context("Target is not obvious")
}

Expand Down
2 changes: 0 additions & 2 deletions src/bin/cargo-ziggy/minimize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ impl Minimize {
self.target =
find_target(&self.target).context("⚠️ couldn't find target when minimizing")?;

info!("Minimizing corpus");

let entries = fs::read_dir(self.input_corpus())?;
let original_count = entries.filter_map(|entry| entry.ok()).count();
println!("Running minimization on a corpus of {original_count} files");
Expand Down
3 changes: 0 additions & 3 deletions src/bin/cargo-ziggy/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ impl Run {
let mut rust_doc_flags = env::var("RUSTDOCFLAGS").unwrap_or_default();

if self.asan {
info!("Building runner with ASAN");
args.push(&asan_target_str);
args.extend(["-Z", "build-std"]);
rust_flags.push_str(" -Zsanitizer=address ");
Expand Down Expand Up @@ -51,7 +50,6 @@ impl Run {
eprintln!(" {} runner", style("Finished").cyan().bold());

if self.recursive {
info!("Finding nested input directories recursively...");
let mut all_dirs = HashSet::new();
for input in &self.inputs {
all_dirs.insert(input.clone());
Expand All @@ -64,7 +62,6 @@ impl Run {
}
}

info!("Running inputs");
let run_args: Vec<String> = self
.inputs
.iter()
Expand Down

0 comments on commit d441787

Please sign in to comment.