mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-18 12:48:07 +00:00
fixing input marker expansion in the supervisor task (#87)
This commit is contained in:
@ -120,7 +120,7 @@ pub async fn run_tool(input: impl AsRef<Path>, config: &Config) -> Result<()> {
|
|||||||
let mut tool_args = Expand::new();
|
let mut tool_args = Expand::new();
|
||||||
|
|
||||||
tool_args
|
tool_args
|
||||||
.input(&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)
|
||||||
|
@ -192,7 +192,7 @@ async fn start_supervisor(
|
|||||||
.input_corpus(inputs_dir);
|
.input_corpus(inputs_dir);
|
||||||
|
|
||||||
if let Some(input_marker) = supervisor_input_marker {
|
if let Some(input_marker) = supervisor_input_marker {
|
||||||
expand.input(input_marker);
|
expand.input_marker(input_marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
let args = expand.evaluate(supervisor_options)?;
|
let args = expand.evaluate(supervisor_options)?;
|
||||||
|
@ -132,7 +132,7 @@ async fn merge(config: &Config, output_dir: impl AsRef<Path>) -> Result<()> {
|
|||||||
let mut supervisor_args = Expand::new();
|
let mut supervisor_args = Expand::new();
|
||||||
|
|
||||||
supervisor_args
|
supervisor_args
|
||||||
.input(&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)
|
||||||
.supervisor_exe(&config.supervisor_exe)
|
.supervisor_exe(&config.supervisor_exe)
|
||||||
|
@ -127,13 +127,18 @@ impl<'a> Expand<'a> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn input(&mut self, arg: impl AsRef<Path>) -> &mut Self {
|
pub fn input_path(&mut self, arg: impl AsRef<Path>) -> &mut Self {
|
||||||
let arg = arg.as_ref();
|
let arg = arg.as_ref();
|
||||||
let path = String::from(arg.to_string_lossy());
|
let path = String::from(arg.to_string_lossy());
|
||||||
self.set_value(PlaceHolder::Input, ExpandedValue::Path(path));
|
self.set_value(PlaceHolder::Input, ExpandedValue::Path(path));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn input_marker(&mut self, arg: &str) -> &mut Self {
|
||||||
|
self.set_value(PlaceHolder::Input, ExpandedValue::Scalar(String::from(arg)));
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn input_corpus(&mut self, arg: impl AsRef<Path>) -> &mut Self {
|
pub fn input_corpus(&mut self, arg: impl AsRef<Path>) -> &mut Self {
|
||||||
let arg = arg.as_ref();
|
let arg = arg.as_ref();
|
||||||
let path = String::from(arg.to_string_lossy());
|
let path = String::from(arg.to_string_lossy());
|
||||||
@ -311,7 +316,7 @@ mod tests {
|
|||||||
.input_corpus(Path::new(input_corpus_dir))
|
.input_corpus(Path::new(input_corpus_dir))
|
||||||
.generated_inputs(Path::new(generated_inputs_dir))
|
.generated_inputs(Path::new(generated_inputs_dir))
|
||||||
.target_options(&my_options)
|
.target_options(&my_options)
|
||||||
.input(input_path)
|
.input_path(input_path)
|
||||||
.evaluate(&my_args)?;
|
.evaluate(&my_args)?;
|
||||||
|
|
||||||
let input_corpus_path = dunce::canonicalize(input_corpus_dir)?;
|
let input_corpus_path = dunce::canonicalize(input_corpus_dir)?;
|
||||||
|
@ -186,7 +186,7 @@ impl<'a> Tester<'a> {
|
|||||||
let (argv, env) = {
|
let (argv, env) = {
|
||||||
let mut expand = Expand::new();
|
let mut expand = Expand::new();
|
||||||
expand
|
expand
|
||||||
.input(input_file)
|
.input_path(input_file)
|
||||||
.target_exe(&self.exe_path)
|
.target_exe(&self.exe_path)
|
||||||
.target_options(&self.arguments);
|
.target_options(&self.arguments);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user