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

Define a protocol to communicate between individual tests and nextest #41

Open
sunshowers opened this issue Apr 1, 2021 · 1 comment

Comments

@sunshowers
Copy link
Contributor

sunshowers commented Apr 1, 2021

Right now the only communication channel we have between the testrunner and Rust tests, during execution, is the process exit code. We'd like to have a richer protocol but the Rust test harness is kind of limited so we need to be careful about it. Some ideas for things to communicate:

  • test flakiness
  • test retries
  • test timeouts

Some ideas for the protocol itself:

  • Use lines to stdout (or stderr) that begin with nextest: (similar to cargo: lines in build scripts)
  • Pass in a random string through the environment and ensure that lines begin with that to avoid confusing random test output with nextest control lines.
  • Publish a crate which can be used to output these lines, either as function calls or as a proc macro.
@sunshowers
Copy link
Contributor Author

Another solution pointed out by @yaahc: publish a Unix domain socket through an env var and use that to send control messages. That would work quite well and be a cleaner solution/less icky. Potential issue is that this will probably need to select on reading from the socket and stdout. Solutions would be:

  • do the control channel and process monitoring on separate threads and send messages back and forth
  • introduce unix-specific select code: https://docs.rs/nix/0.20.0/nix/sys/select/fn.select.html
  • switch to tokio, which handles all this complexity for us at the cost of being a nontrivial dep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant