Convert project config targets into [`BenchmarkTarget`] instances. Exec targets are each converted to a `BenchmarkTarget::Exec`. Entrypoint targets are each converted to a `BenchmarkTarget::Entrypoint`.
(
targets: &[Target],
default_walltime: Option<&WalltimeOptions>,
)
| 44 | /// Exec targets are each converted to a `BenchmarkTarget::Exec`. |
| 45 | /// Entrypoint targets are each converted to a `BenchmarkTarget::Entrypoint`. |
| 46 | pub fn build_benchmark_targets( |
| 47 | targets: &[Target], |
| 48 | default_walltime: Option<&WalltimeOptions>, |
| 49 | ) -> Result<Vec<BenchmarkTarget>> { |
| 50 | targets |
| 51 | .iter() |
| 52 | .map(|target| match &target.command { |
| 53 | TargetCommand::Exec { exec } => { |
| 54 | let command = shell_words::split(exec) |
| 55 | .with_context(|| format!("Failed to parse command: {exec}"))?; |
| 56 | let target_walltime = target.options.as_ref().and_then(|o| o.walltime.as_ref()); |
| 57 | let walltime_args = merge_walltime_options(default_walltime, target_walltime); |
| 58 | Ok(BenchmarkTarget::Exec { |
| 59 | command, |
| 60 | name: target.name.clone(), |
| 61 | walltime_args, |
| 62 | }) |
| 63 | } |
| 64 | TargetCommand::Entrypoint { entrypoint } => Ok(BenchmarkTarget::Entrypoint { |
| 65 | command: entrypoint.clone(), |
| 66 | name: target.name.clone(), |
| 67 | }), |
| 68 | }) |
| 69 | .collect() |
| 70 | } |
| 71 | |
| 72 | /// Build a shell command string that pipes BenchmarkTarget::Exec variants to exec-harness via stdin |
| 73 | pub fn build_exec_targets_pipe_command( |
no test coverage detected