Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Merge branch 'main' into unused-telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
ranweiler authored Feb 20, 2023
2 parents 816671d + 9d3321b commit 3f20618
Show file tree
Hide file tree
Showing 42 changed files with 723 additions and 959 deletions.
388 changes: 54 additions & 334 deletions src/agent/Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/agent/coverage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cobertura = { path = "../cobertura" }
debuggable-module = { path = "../debuggable-module" }
iced-x86 = "1.17"
log = "0.4.17"
regex = "1.0"
regex = "1.7"
symbolic = { version = "10.1", features = [
"debuginfo",
"demangle",
Expand Down
2 changes: 1 addition & 1 deletion src/agent/debuggable-module/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ goblin = "0.6.0"
iced-x86 = "1.17"
log = "0.4.17"
pdb = "0.8.0"
regex = "1.0"
regex = "1.7"
symbolic = { version = "10.1", features = ["debuginfo", "demangle", "symcache"] }
thiserror = "1.0"

Expand Down
4 changes: 2 additions & 2 deletions src/agent/dynamic-library/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ license = "MIT"

[dependencies]
anyhow = "1.0"
clap = { version = "4.1.6", features = ["derive"] }
lazy_static = "1.4"
regex = "1.6"
structopt = "0.3"
regex = "1.7"
thiserror = "1.0"

[target.'cfg(windows)'.dependencies]
Expand Down
12 changes: 6 additions & 6 deletions src/agent/dynamic-library/src/bin/dynamic-library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
use std::process::{Command, Stdio};

use anyhow::Result;
use structopt::StructOpt;
use clap::Parser;

#[derive(Debug, StructOpt)]
#[derive(Parser, Debug)]
struct Opt {
#[structopt(min_values = 1)]
#[arg(required = true, num_args = 1..)]
argv: Vec<String>,

#[structopt(short, long)]
#[arg(short, long)]
quiet: bool,

#[structopt(short, long)]
#[arg(short, long)]
ld_library_path: Option<String>,
}

fn main() -> Result<()> {
let opt = Opt::from_args();
let opt = Opt::parse();

let exe = &opt.argv[0];
let mut cmd = Command::new(exe);
Expand Down
2 changes: 1 addition & 1 deletion src/agent/libclusterfuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ description = "Minimal porting of features from libclusterfuzz"

[dependencies]
anyhow = "1.0"
regex = "1.6.0"
regex = "1.7.1"
lazy_static = "1.4"
3 changes: 1 addition & 2 deletions src/agent/libclusterfuzz/src/generated.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Rust generated by Microsoft, code originally from:
// https://github.com/google/clusterfuzz/blob/master/src/
// python/lib/clusterfuzz/stacktraces/constants.py
// https://github.com/google/clusterfuzz/blob/master/src/clusterfuzz/stacktraces/constants.py#:~:text=stack_frame_ignore_regexes
//
// Original Copyright:
//
Expand Down
4 changes: 2 additions & 2 deletions src/agent/onefuzz-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "MIT"
anyhow = { version = "1.0", features = ["backtrace"] }
async-trait = "0.1"
downcast-rs = "1.2"
env_logger = "0.9"
env_logger = "0.10"
futures = "0.3"
log = "0.4"
onefuzz = { path = "../onefuzz" }
Expand All @@ -25,7 +25,7 @@ storage-queue = { path = "../storage-queue" }
tokio = { version = "1.24", features = ["full"] }
url = { version = "2.3", features = ["serde"] }
uuid = { version = "0.8", features = ["serde", "v4"] }
clap = { version = "3.2.4", features = ["derive", "cargo"] }
clap = { version = "4", features = ["derive", "cargo"] }
reqwest-retry = { path = "../reqwest-retry" }
onefuzz-telemetry = { path = "../onefuzz-telemetry" }
backtrace = "0.3"
Expand Down
11 changes: 6 additions & 5 deletions src/agent/onefuzz-agent/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,21 @@ enum Opt {

#[derive(Parser, Debug)]
struct RunOpt {
#[clap(short, long = "--config", parse(from_os_str))]
#[arg(short, long = "config")]
config_path: Option<PathBuf>,

/// re-executes as a child process, recording stdout/stderr to files in
/// the specified directory
#[clap(short, long = "--redirect-output", parse(from_os_str))]
#[arg(short, long = "redirect-output")]
redirect_output: Option<PathBuf>,

#[clap(long = "--machine_id")]
#[arg(long = "machine_id")]
machine_id: Option<Uuid>,

#[clap(long = "--machine_name")]
#[arg(long = "machine_name")]
machine_name: Option<String>,

#[clap(long = "--reset_lock", takes_value = false, action = ArgAction::SetTrue )]
#[arg(long = "reset_lock", action = ArgAction::SetTrue )]
reset_node_lock: bool,
}

Expand Down
10 changes: 5 additions & 5 deletions src/agent/onefuzz-task/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ arraydeque = "0.5"
async-trait = "0.1"
atexit = { path = "../atexit" }
backoff = { version = "0.4", features = ["tokio"] }
clap = "2.34"
clap = { version = "4", features = ["cargo", "string"] }
cobertura = { path = "../cobertura" }
coverage = { path = "../coverage" }
crossterm = "0.22"
env_logger = "0.9"
crossterm = "0.25"
env_logger = "0.10"
flume = "0.10"
futures = "0.3"
hex = "0.4"
lazy_static = "1.4"
log = "0.4"
num_cpus = "1.15"
onefuzz-file-format = { path = "../onefuzz-file-format" }
regex = "1.6.0"
regex = "1.7.1"
reqwest = { version = "0.11", features = [
"json",
"stream",
Expand All @@ -49,7 +49,7 @@ thiserror = "1.0"
tokio = { version = "1.24", features = ["full"] }
tokio-util = { version = "0.7", features = ["full"] }
tokio-stream = "0.1"
tui = { version = "0.18", default-features = false, features = ['crossterm'] }
tui = { version = "0.19", default-features = false, features = ['crossterm'] }
url = { version = "2.3", features = ["serde"] }
uuid = { version = "0.8", features = ["serde", "v4"] }
chrono = { version = "0.4", default-features = false, features = [
Expand Down
39 changes: 22 additions & 17 deletions src/agent/onefuzz-task/src/local/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::local::{
libfuzzer_test_input, radamsa, test_input, tui::TerminalUi,
};
use anyhow::{Context, Result};
use clap::{App, Arg, SubCommand};
use clap::{Arg, ArgAction, Command};
use std::str::FromStr;
use std::time::Duration;
use strum::IntoEnumIterator;
Expand Down Expand Up @@ -37,17 +37,22 @@ enum Commands {
const TIMEOUT: &str = "timeout";
const TUI: &str = "tui";

pub async fn run(args: clap::ArgMatches<'static>) -> Result<()> {
let running_duration = value_t!(args, TIMEOUT, u64).ok();
let start_ui = args.is_present(TUI);
pub async fn run(args: clap::ArgMatches) -> Result<()> {
let running_duration = args.get_one::<u64>(TIMEOUT).copied();

let (cmd, sub_args) = args.subcommand();
let command =
Commands::from_str(cmd).with_context(|| format!("unexpected subcommand: {cmd}"))?;
let start_ui = args.get_flag(TUI);

let sub_args = sub_args
.ok_or_else(|| anyhow!("missing subcommand arguments"))?
.to_owned();
let (cmd, sub_args) = args.subcommand().ok_or_else(|| {
format_err!(
"Expected subcommand for 'local'. Use 'local help' to see available subcommands."
)
})?;

let command = Commands::from_str(cmd).with_context(|| {
format!("Unexpected subcommand: {cmd}. Use 'local help' to see available subcommands.")
})?;

let sub_args = sub_args.clone();

let terminal = if start_ui {
Some(TerminalUi::init()?)
Expand Down Expand Up @@ -104,20 +109,20 @@ pub async fn run(args: clap::ArgMatches<'static>) -> Result<()> {
}
}

pub fn args(name: &str) -> App<'static, 'static> {
let mut cmd = SubCommand::with_name(name)
pub fn args(name: &'static str) -> Command {
let mut cmd = Command::new(name)
.about("pre-release local fuzzing")
.arg(
Arg::with_name(TIMEOUT)
Arg::new(TIMEOUT)
.long(TIMEOUT)
.help("The maximum running time in seconds")
.takes_value(true),
.value_parser(value_parser!(u64))
.help("The maximum running time in seconds"),
)
.arg(
Arg::with_name(TUI)
Arg::new(TUI)
.long(TUI)
.help("Enable the terminal UI")
.takes_value(false),
.action(ArgAction::SetTrue),
);

for subcommand in Commands::iter() {
Expand Down
Loading

0 comments on commit 3f20618

Please sign in to comment.