Expand tools_dir accessibility in variable expansion (#480)

Fixes #478
This commit is contained in:
bmc-msft
2021-01-29 06:33:23 -05:00
committed by GitHub
parent bcf42485eb
commit 9c7eb33149
2 changed files with 14 additions and 20 deletions

View File

@ -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<()> {
let mut tool_args = Expand::new();
let mut expand = Expand::new();
tool_args
expand
.input_path(&input)
.target_exe(&config.target_exe)
.target_options(&config.target_options)
.analyzer_exe(&config.analyzer_exe)
.analyzer_options(&config.analyzer_options)
.output_dir(&config.analysis.path)
.tools_dir(&config.tools.path)
.setup_dir(&config.common.setup_dir);
let analyzer_path = Expand::new()
.tools_dir(&config.tools.path)
.evaluate_value(&config.analyzer_exe)?;
let analyzer_path = expand.evaluate_value(&config.analyzer_exe)?;
let mut cmd = Command::new(analyzer_path);
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);
}
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?;

View File

@ -129,9 +129,9 @@ async fn try_delete_blob(input_url: Url) -> 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_corpus(&config.unique_inputs.path)
.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)
.generated_inputs(output_dir)
.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 {
supervisor_args.target_options(&config.target_options);
}
let supervisor_path = Expand::new()
.tools_dir(&config.tools.path)
.evaluate_value(&config.supervisor_exe)?;
let supervisor_path = expand.evaluate_value(&config.supervisor_exe)?;
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());
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);
}
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);
}
}