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

expose input_blob fields needed to generate crash reports #551

Merged
merged 3 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/agent/onefuzz-agent/src/tasks/analysis/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,16 @@ pub async fn run_tool(input: impl AsRef<Path>, config: &Config) -> Result<()> {
.tools_dir(&config.tools.path)
.setup_dir(&config.common.setup_dir)
.job_id(&config.common.job_id)
.task_id(&config.common.task_id);
.task_id(&config.common.task_id)
.set_optional_ref(&config.crashes, |tester, crashes| {
if let Some(url) = &crashes.url {
tester
.crashes_account(&url.account())
.crashes_container(&url.container())
} else {
tester
}
});

let analyzer_path = expand.evaluate_value(&config.analyzer_exe)?;

Expand Down
5 changes: 5 additions & 0 deletions src/agent/onefuzz-agent/src/tasks/fuzz/supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ async fn start_supervisor(
})
.set_optional_ref(&config.target_options, |expand, target_options| {
expand.target_options(target_options)
})
.set_optional_ref(&config.crashes.url, |tester, url| {
tester
.crashes_account(&url.account())
.crashes_container(&url.container())
});

let supervisor_path = expand.evaluate_value(&config.supervisor_exe)?;
Expand Down
18 changes: 18 additions & 0 deletions src/agent/onefuzz/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ pub enum PlaceHolder {
ReportsDir,
JobId,
TaskId,
CrashesContainer,
CrashesAccount,
}

impl PlaceHolder {
Expand All @@ -64,6 +66,8 @@ impl PlaceHolder {
Self::ReportsDir => "{reports_dir}",
Self::JobId => "{job_id}",
Self::TaskId => "{task_id}",
Self::CrashesContainer => "{crashes_container}",
Self::CrashesAccount => "{crashes_account}",
}
.to_string()
}
Expand Down Expand Up @@ -251,6 +255,20 @@ impl<'a> Expand<'a> {
self.set_value(PlaceHolder::JobId, ExpandedValue::Scalar(value))
}

pub fn crashes_account(self, arg: &str) -> Self {
self.set_value(
PlaceHolder::CrashesAccount,
ExpandedValue::Scalar(String::from(arg)),
)
}

pub fn crashes_container(self, arg: &str) -> Self {
self.set_value(
PlaceHolder::CrashesContainer,
ExpandedValue::Scalar(String::from(arg)),
)
}

fn replace_value(
&self,
fmtstr: &str,
Expand Down