mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-18 04:38:09 +00:00
@ -114,30 +114,29 @@ async fn poll_inputs(config: &Config, tmp_dir: OwnedDir) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn run_tool(input: impl AsRef<Path>, config: &Config) -> Result<()> {
|
pub async fn run_tool(input: impl AsRef<Path>, config: &Config) -> Result<()> {
|
||||||
let mut tool_args = Expand::new();
|
let mut expand = Expand::new();
|
||||||
|
|
||||||
tool_args
|
expand
|
||||||
.input_path(&input)
|
.input_path(&input)
|
||||||
.target_exe(&config.target_exe)
|
.target_exe(&config.target_exe)
|
||||||
.target_options(&config.target_options)
|
.target_options(&config.target_options)
|
||||||
.analyzer_exe(&config.analyzer_exe)
|
.analyzer_exe(&config.analyzer_exe)
|
||||||
.analyzer_options(&config.analyzer_options)
|
.analyzer_options(&config.analyzer_options)
|
||||||
.output_dir(&config.analysis.path)
|
.output_dir(&config.analysis.path)
|
||||||
|
.tools_dir(&config.tools.path)
|
||||||
.setup_dir(&config.common.setup_dir);
|
.setup_dir(&config.common.setup_dir);
|
||||||
|
|
||||||
let analyzer_path = Expand::new()
|
let analyzer_path = expand.evaluate_value(&config.analyzer_exe)?;
|
||||||
.tools_dir(&config.tools.path)
|
|
||||||
.evaluate_value(&config.analyzer_exe)?;
|
|
||||||
|
|
||||||
let mut cmd = Command::new(analyzer_path);
|
let mut cmd = Command::new(analyzer_path);
|
||||||
cmd.kill_on_drop(true).env_remove("RUST_LOG");
|
cmd.kill_on_drop(true).env_remove("RUST_LOG");
|
||||||
|
|
||||||
for arg in tool_args.evaluate(&config.analyzer_options)? {
|
for arg in expand.evaluate(&config.analyzer_options)? {
|
||||||
cmd.arg(arg);
|
cmd.arg(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (k, v) in &config.analyzer_env {
|
for (k, v) in &config.analyzer_env {
|
||||||
cmd.env(k, tool_args.evaluate_value(v)?);
|
cmd.env(k, expand.evaluate_value(v)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.output().await?;
|
cmd.output().await?;
|
||||||
|
@ -129,9 +129,9 @@ async fn try_delete_blob(input_url: Url) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn merge(config: &Config, output_dir: impl AsRef<Path>) -> Result<()> {
|
async fn merge(config: &Config, output_dir: impl AsRef<Path>) -> Result<()> {
|
||||||
let mut supervisor_args = Expand::new();
|
let mut expand = Expand::new();
|
||||||
|
|
||||||
supervisor_args
|
expand
|
||||||
.input_marker(&config.supervisor_input_marker)
|
.input_marker(&config.supervisor_input_marker)
|
||||||
.input_corpus(&config.unique_inputs.path)
|
.input_corpus(&config.unique_inputs.path)
|
||||||
.target_options(&config.target_options)
|
.target_options(&config.target_options)
|
||||||
@ -139,15 +139,10 @@ async fn merge(config: &Config, output_dir: impl AsRef<Path>) -> Result<()> {
|
|||||||
.supervisor_options(&config.supervisor_options)
|
.supervisor_options(&config.supervisor_options)
|
||||||
.generated_inputs(output_dir)
|
.generated_inputs(output_dir)
|
||||||
.target_exe(&config.target_exe)
|
.target_exe(&config.target_exe)
|
||||||
.setup_dir(&config.common.setup_dir);
|
.setup_dir(&config.common.setup_dir)
|
||||||
|
.tools_dir(&config.tools.path);
|
||||||
|
|
||||||
if config.target_options_merge {
|
let supervisor_path = expand.evaluate_value(&config.supervisor_exe)?;
|
||||||
supervisor_args.target_options(&config.target_options);
|
|
||||||
}
|
|
||||||
|
|
||||||
let supervisor_path = Expand::new()
|
|
||||||
.tools_dir(&config.tools.path)
|
|
||||||
.evaluate_value(&config.supervisor_exe)?;
|
|
||||||
|
|
||||||
let mut cmd = Command::new(supervisor_path);
|
let mut cmd = Command::new(supervisor_path);
|
||||||
|
|
||||||
@ -157,15 +152,15 @@ async fn merge(config: &Config, output_dir: impl AsRef<Path>) -> Result<()> {
|
|||||||
.stderr(Stdio::piped());
|
.stderr(Stdio::piped());
|
||||||
|
|
||||||
for (k, v) in &config.supervisor_env {
|
for (k, v) in &config.supervisor_env {
|
||||||
cmd.env(k, v);
|
cmd.env(k, expand.evaluate_value(v)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
for arg in supervisor_args.evaluate(&config.supervisor_options)? {
|
for arg in expand.evaluate(&config.supervisor_options)? {
|
||||||
cmd.arg(arg);
|
cmd.arg(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !config.target_options_merge {
|
if !config.target_options_merge {
|
||||||
for arg in supervisor_args.evaluate(&config.target_options)? {
|
for arg in expand.evaluate(&config.target_options)? {
|
||||||
cmd.arg(arg);
|
cmd.arg(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user