fixing input marker expansion in the supervisor task (#87)

This commit is contained in:
Cheick Keita
2020-10-02 11:34:31 -07:00
committed by GitHub
parent 93be26bc94
commit 2bb6dcbaca
5 changed files with 11 additions and 6 deletions

View File

@ -120,7 +120,7 @@ pub async fn run_tool(input: impl AsRef<Path>, config: &Config) -> Result<()> {
let mut tool_args = Expand::new();
tool_args
.input(&input)
.input_path(&input)
.target_exe(&config.target_exe)
.target_options(&config.target_options)
.analyzer_exe(&config.analyzer_exe)

View File

@ -192,7 +192,7 @@ async fn start_supervisor(
.input_corpus(inputs_dir);
if let Some(input_marker) = supervisor_input_marker {
expand.input(input_marker);
expand.input_marker(input_marker);
}
let args = expand.evaluate(supervisor_options)?;

View File

@ -132,7 +132,7 @@ async fn merge(config: &Config, output_dir: impl AsRef<Path>) -> Result<()> {
let mut supervisor_args = Expand::new();
supervisor_args
.input(&config.supervisor_input_marker)
.input_marker(&config.supervisor_input_marker)
.input_corpus(&config.unique_inputs.path)
.target_options(&config.target_options)
.supervisor_exe(&config.supervisor_exe)

View File

@ -127,13 +127,18 @@ impl<'a> Expand<'a> {
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 path = String::from(arg.to_string_lossy());
self.set_value(PlaceHolder::Input, ExpandedValue::Path(path));
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 {
let arg = arg.as_ref();
let path = String::from(arg.to_string_lossy());
@ -311,7 +316,7 @@ mod tests {
.input_corpus(Path::new(input_corpus_dir))
.generated_inputs(Path::new(generated_inputs_dir))
.target_options(&my_options)
.input(input_path)
.input_path(input_path)
.evaluate(&my_args)?;
let input_corpus_path = dunce::canonicalize(input_corpus_dir)?;

View File

@ -186,7 +186,7 @@ impl<'a> Tester<'a> {
let (argv, env) = {
let mut expand = Expand::new();
expand
.input(input_file)
.input_path(input_file)
.target_exe(&self.exe_path)
.target_options(&self.arguments);