Skip to content

Commit 1b34075

Browse files
authored
PHD: add pfexec to xtask phd-runner invocation (#647)
Currently, when using `cargo xtask phd run` to run the PHD test suite, ensuring that the runner has the correct permissions requires running `pfexec cargo xtask phd`. This means that the commands run by the xtask to set up the artifact store and temp directories, and to build `phd-runner` and `propolis-server`, are run under the profile specified by `pfexec`, resulting in a bunch of files in the Cargo `target/` directory that the user doesn't actually own. This is annoying if you want to then run `cargo clean` or something. This commit changes `cargo xtask phd run` to just execute the runner command with `pfexec` when compiled for Illumos. This saves the user from having to type it themself, and (more importantly) means that the binaries aren't built with a different owner than the user who builds them.
1 parent d4beb64 commit 1b34075

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

xtask/src/task_phd.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,18 @@ impl Cmd {
350350
}
351351

352352
let phd_runner = build_bin("phd-runner", false)?;
353-
let mut cmd = phd_runner.command();
353+
let mut cmd = if cfg!(target_os = "illumos") {
354+
let mut cmd = Command::new("pfexec");
355+
cmd.arg(phd_runner.path());
356+
cmd
357+
} else {
358+
// If we're not on Illumos, running the tests probably won't
359+
// actually work, because there's almost certainly no Bhyve. But,
360+
// we'll build and run the command anyway, because being able to run
361+
// on other systems may still be useful for PHD development (e.g.
362+
// testing changes to artifact management, etc).
363+
Command::new(phd_runner.path())
364+
};
354365
cmd.arg("run")
355366
.arg("--propolis-server-cmd")
356367
.arg(&propolis_local_path)

0 commit comments

Comments
 (0)