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

[nextest-runner] handle SIGINFO and SIGUSR1 to dump info to screen #1938

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

sunshowers
Copy link
Member

@sunshowers sunshowers commented Dec 3, 2024

Part 1 of work to perform interactive queries.

With this change, if nextest receives either SIGINFO (where available) or SIGUSR1, it will print a list of all currently running tests with their states. The full test state machine is modeled in the event responses, along with possible sources of errors.

I tried making Ctrl-Break on Windows do the same thing, but unfortunately that doesn't quite work in practice. That's because Ctrl-Break is received by all processes connected to the console, not just by the equivalent of the "foreground process group". The printing out of info works, but running tests are immediately aborted as well. So remove this. (In interactive terminals we'll support an alternative -- pressing i -- which should work for most use cases on Windows.)

There is also an undocumented environment variable __NEXTEST_SIGQUIT_AS_INFO which allows SIGQUIT (Ctrl-\) to perform an info query. Quite useful for testing on Linux, where SIGINFO is sadly unavailable.

Note: illumos does support SIGINFO, but that is blocked on an upstream issue: tokio-rs/tokio#6995

Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 74.36941% with 315 lines in your changes missing coverage. Please review.

Project coverage is 80.27%. Comparing base (e2af307) to head (939bdd5).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
nextest-runner/src/runner.rs 31.26% 222 Missing ⚠️
nextest-runner/src/reporter/displayer.rs 94.95% 41 Missing ⚠️
nextest-runner/src/test_command/imp.rs 0.00% 20 Missing ⚠️
nextest-runner/src/helpers.rs 0.00% 15 Missing ⚠️
nextest-runner/src/reporter/events.rs 62.50% 9 Missing ⚠️
nextest-runner/src/signal.rs 68.42% 6 Missing ⚠️
nextest-runner/src/reporter/aggregator.rs 0.00% 1 Missing ⚠️
nextest-runner/src/test_output.rs 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1938      +/-   ##
==========================================
+ Coverage   80.11%   80.27%   +0.16%     
==========================================
  Files          83       83              
  Lines       21251    22078     +827     
==========================================
+ Hits        17026    17724     +698     
- Misses       4225     4354     +129     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sunshowers sunshowers changed the title [nextest-runner] handle SIGINFO, SIGUSR1 and Ctrl-Break to dump info to screen [nextest-runner] handle SIGINFO and SIGUSR1 to dump info to screen Dec 4, 2024
@sunshowers sunshowers merged commit bb5159a into nextest-rs:main Dec 4, 2024
19 checks passed
@sunshowers sunshowers deleted the siginfo-sigusr1 branch December 4, 2024 20:36
sunshowers added a commit that referenced this pull request Dec 5, 2024
In prior work (#1938) we enabled the `SIGUSR1` and `SIGINFO` handlers to
dump internal state to standard output.

However, those handlers aren't present on all platforms.

* `SIGINFO` doesn't exist on Linux. `SIGUSR1` exists but is hard to send
signals over (have to use `kill`, nothing like `^T`).
* Windows' very basic signal handling mechanism isn't really up to the
task.

As an alternative, allow these platforms to specify `t` to dump current
test information to the interactive terminal.

It would also be interesting to support a Unix domain socket as a way to
query current state in the future, and have a separate instance of
nextest be able to connect to the socket -- this work naturally builds
towards that kind of model.
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

Successfully merging this pull request may close these issues.

1 participant