mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-18 04:38:09 +00:00
updates related to cargo clippy 1.51.0 (#730)
This commit is contained in:
@ -150,8 +150,7 @@ pub fn get_synced_dirs(
|
|||||||
args: &ArgMatches<'_>,
|
args: &ArgMatches<'_>,
|
||||||
) -> Result<Vec<SyncedDir>> {
|
) -> Result<Vec<SyncedDir>> {
|
||||||
let current_dir = std::env::current_dir()?;
|
let current_dir = std::env::current_dir()?;
|
||||||
let dirs: Result<Vec<SyncedDir>> = args
|
args.values_of_os(name)
|
||||||
.values_of_os(name)
|
|
||||||
.ok_or_else(|| anyhow!("argument '{}' not specified", name))?
|
.ok_or_else(|| anyhow!("argument '{}' not specified", name))?
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(index, remote_path)| {
|
.map(|(index, remote_path)| {
|
||||||
@ -165,8 +164,7 @@ pub fn get_synced_dirs(
|
|||||||
path,
|
path,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.collect();
|
.collect()
|
||||||
Ok(dirs?)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn register_cleanup(job_id: Uuid) -> Result<()> {
|
fn register_cleanup(job_id: Uuid) -> Result<()> {
|
||||||
|
@ -93,7 +93,7 @@ pub async fn spawn(config: Arc<Config>) -> Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn process_message(config: Arc<Config>, input_url: &Url, tmp_dir: &PathBuf) -> Result<()> {
|
async fn process_message(config: Arc<Config>, input_url: &Url, tmp_dir: &Path) -> Result<()> {
|
||||||
let input_path = utils::download_input(input_url.clone(), &config.unique_inputs.path).await?;
|
let input_path = utils::download_input(input_url.clone(), &config.unique_inputs.path).await?;
|
||||||
info!("downloaded input to {}", input_path.display());
|
info!("downloaded input to {}", input_path.display());
|
||||||
|
|
||||||
@ -101,11 +101,11 @@ async fn process_message(config: Arc<Config>, input_url: &Url, tmp_dir: &PathBuf
|
|||||||
match merge(&config, tmp_dir).await {
|
match merge(&config, tmp_dir).await {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
// remove the 'queue' folder
|
// remove the 'queue' folder
|
||||||
let mut queue_dir = tmp_dir.clone();
|
let mut queue_dir = tmp_dir.to_path_buf();
|
||||||
queue_dir.push("queue");
|
queue_dir.push("queue");
|
||||||
let _delete_output = tokio::fs::remove_dir_all(queue_dir).await;
|
let _delete_output = tokio::fs::remove_dir_all(queue_dir).await;
|
||||||
let synced_dir = SyncedDir {
|
let synced_dir = SyncedDir {
|
||||||
path: tmp_dir.clone(),
|
path: tmp_dir.to_path_buf(),
|
||||||
url: config.unique_inputs.url.clone(),
|
url: config.unique_inputs.url.clone(),
|
||||||
};
|
};
|
||||||
synced_dir.sync_push().await?
|
synced_dir.sync_push().await?
|
||||||
|
@ -8,9 +8,11 @@ use onefuzz_telemetry::Event::runtime_stats;
|
|||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
pub const STATS_DELAY: std::time::Duration = std::time::Duration::from_secs(30);
|
pub const STATS_DELAY: std::time::Duration = std::time::Duration::from_secs(30);
|
||||||
|
|
||||||
|
// TODO - remove unkonwn_lints once GitHub build agents are at 1.51.0 or later
|
||||||
#[derive(Debug, Deserialize, Clone)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
pub enum StatsFormat {
|
pub enum StatsFormat {
|
||||||
AFL,
|
#[serde(alias = "AFL")]
|
||||||
|
Afl,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn monitor_stats(path: Option<String>, format: Option<StatsFormat>) -> Result<(), Error> {
|
pub async fn monitor_stats(path: Option<String>, format: Option<StatsFormat>) -> Result<(), Error> {
|
||||||
@ -18,7 +20,7 @@ pub async fn monitor_stats(path: Option<String>, format: Option<StatsFormat>) ->
|
|||||||
if let Some(format) = format {
|
if let Some(format) = format {
|
||||||
loop {
|
loop {
|
||||||
let stats = match format {
|
let stats = match format {
|
||||||
StatsFormat::AFL => afl::read_stats(&path).await,
|
StatsFormat::Afl => afl::read_stats(&path).await,
|
||||||
};
|
};
|
||||||
if let Ok(stats) = stats {
|
if let Ok(stats) = stats {
|
||||||
log_events!(runtime_stats; stats);
|
log_events!(runtime_stats; stats);
|
||||||
|
@ -8,6 +8,7 @@ use std::path::PathBuf;
|
|||||||
pub const PATH: &str = "PATH";
|
pub const PATH: &str = "PATH";
|
||||||
pub const LD_LIBRARY_PATH: &str = "LD_LIBRARY_PATH";
|
pub const LD_LIBRARY_PATH: &str = "LD_LIBRARY_PATH";
|
||||||
|
|
||||||
|
#[allow(clippy::ptr_arg)]
|
||||||
pub fn update_path(path: OsString, to_add: &PathBuf) -> Result<OsString> {
|
pub fn update_path(path: OsString, to_add: &PathBuf) -> Result<OsString> {
|
||||||
let mut paths: Vec<_> = std::env::split_paths(&path).collect();
|
let mut paths: Vec<_> = std::env::split_paths(&path).collect();
|
||||||
if !paths.contains(to_add) {
|
if !paths.contains(to_add) {
|
||||||
@ -16,6 +17,7 @@ pub fn update_path(path: OsString, to_add: &PathBuf) -> Result<OsString> {
|
|||||||
Ok(std::env::join_paths(paths)?)
|
Ok(std::env::join_paths(paths)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::ptr_arg)]
|
||||||
pub fn get_path_with_directory(variable: &str, to_add: &PathBuf) -> Result<OsString> {
|
pub fn get_path_with_directory(variable: &str, to_add: &PathBuf) -> Result<OsString> {
|
||||||
match std::env::var_os(variable) {
|
match std::env::var_os(variable) {
|
||||||
Some(path) => update_path(path, to_add),
|
Some(path) => update_path(path, to_add),
|
||||||
|
Reference in New Issue
Block a user