Skip to content

Commit 700194f

Browse files
committed
Add support for selecting a package within a workspace
1 parent af87430 commit 700194f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

collector/src/compile/benchmark/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ pub struct BenchmarkConfig {
7878
excluded_scenarios: HashSet<Scenario>,
7979

8080
artifact: ArtifactType,
81+
82+
/// Which package from a workspace should be compiled
83+
#[serde(default)]
84+
package: Option<String>,
8185
}
8286

8387
impl BenchmarkConfig {
@@ -224,6 +228,7 @@ impl Benchmark {
224228
touch_file: self.config.touch_file.clone(),
225229
jobserver: None,
226230
target,
231+
workspace_package: self.config.package.clone(),
227232
}
228233
}
229234

collector/src/compile/execute/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ pub struct CargoProcess<'a> {
131131
pub touch_file: Option<String>,
132132
pub jobserver: Option<jobserver::Client>,
133133
pub target: Target,
134+
pub workspace_package: Option<String>,
134135
}
135136
/// Returns an optional list of Performance CPU cores, if the system has P and E cores.
136137
/// This list *should* be in a format suitable for the `taskset` command.
@@ -258,6 +259,10 @@ impl<'a> CargoProcess<'a> {
258259

259260
fn get_pkgid(&self, cwd: &Path) -> anyhow::Result<String> {
260261
let mut pkgid_cmd = self.base_command(cwd, "pkgid");
262+
if let Some(package) = &self.workspace_package {
263+
pkgid_cmd.arg("-p").arg(package);
264+
}
265+
261266
let out = command_output(&mut pkgid_cmd)
262267
.with_context(|| format!("failed to obtain pkgid in '{:?}'", cwd))?
263268
.stdout;

0 commit comments

Comments
 (0)