Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for per-test target runners #1358

Open
sunshowers opened this issue Mar 5, 2024 · 2 comments
Open

Add support for per-test target runners #1358

sunshowers opened this issue Mar 5, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@sunshowers
Copy link
Member

At Oxide we have a use case where we want to be able to run pfexec (sudo equivalent) for some tests on illumos. This is generally possible with target runners on illumos, but using pfexec against every single test is a recipe for a ton of files suddenly being owned by root.

There are hacks around this, but the ideal solution is to support per-test target runners. We should add a way to do that.

This is mostly a matter of adding configuration to nextest.toml, since the general infrastructure for target runners can be reused. I'd estimate it would take 3-4 days for me to get it done, including documentation. So it's just a matter of budgeting time for it.

@sunshowers
Copy link
Member Author

sunshowers commented Mar 11, 2024

Some notes from the debugging session today:

  • When nextest encounters both .cargo/config and .cargo/config.toml, it should loudly warn
  • within nextest's support for target runners, it should be possible to only use them for the run-phase and not the list phase (or even define separate target runners for the list and run phase)
  • the docs should more clearly talk about the non-cross-compile scenario

@sunshowers
Copy link
Member Author

One interesting behavior with Cargo's target runners is that cargo run, even if invoked from within the target runner, also invokes the target runner. We'll want to probably support this use case by setting CARGO_TARGET_<...>_RUNNER, maybe with an optional recurse = true.

andrewjstone added a commit to oxidecomputer/omicron that referenced this issue Mar 26, 2024
This PR allows us to run tests inside falcon VMs via nextest. Due to the
lack of [nextest per-test target
runners](nextest-rs/nextest#1358), we enable
the target runner via environment variable and run a specific test at a
time.

In order to run a test, do the following, where the trailing
`--nocapture` is optional but encouraged at this moment.

```
cd omicron
CARGO_TARGET_X86_64_UNKNOWN_ILLUMOS_RUNNER=./test-utils/src/bin/falcon_runner.sh cargo nextest run -p <package> <test name> --nocapture
```


An example: 
```
CARGO_TARGET_X86_64_UNKNOWN_ILLUMOS_RUNNER=./test-utils/src/bin/falcon_runner.sh cargo nextest run -p omicron-test-utils launch --nocapture
```

A few things remain to be done, although this is safe to merge without
adding them in this PR. See `test-utils/README.md` for details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant