Skip to content

Commit 6760375

Browse files
committed
[nextest-runner] handle SIGINFO and SIGUSR1 to dump info to screen
1 parent 97d5ab4 commit 6760375

File tree

13 files changed

+2138
-239
lines changed

13 files changed

+2138
-239
lines changed

nextest-runner/src/errors.rs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
use crate::{
77
cargo_config::{TargetTriple, TargetTripleSource},
88
config::{ConfigExperimental, CustomTestGroup, ScriptId, TestGroup},
9-
helpers::{dylib_path_envvar, extract_abort_status},
9+
helpers::{display_exit_status, dylib_path_envvar},
1010
redact::Redactor,
1111
reuse_build::{ArchiveFormat, ArchiveStep},
12-
runner::AbortStatus,
1312
target_runner::PlatformRunnerSource,
1413
};
1514
use camino::{FromPathBufError, Utf8Path, Utf8PathBuf};
@@ -958,30 +957,6 @@ impl CreateTestListError {
958957
}
959958
}
960959

961-
fn display_exit_status(exit_status: ExitStatus) -> String {
962-
match extract_abort_status(exit_status) {
963-
#[cfg(unix)]
964-
Some(AbortStatus::UnixSignal(sig)) => match crate::helpers::signal_str(sig) {
965-
Some(s) => {
966-
format!("signal {sig} (SIG{s})")
967-
}
968-
None => {
969-
format!("signal {sig}")
970-
}
971-
},
972-
#[cfg(windows)]
973-
Some(AbortStatus::WindowsNtStatus(nt_status)) => {
974-
format!("code {}", crate::helpers::display_nt_status(nt_status))
975-
}
976-
None => match exit_status.code() {
977-
Some(code) => {
978-
format!("code {code}")
979-
}
980-
None => "an unknown error".to_owned(),
981-
},
982-
}
983-
}
984-
985960
/// An error that occurs while writing list output.
986961
#[derive(Debug, Error)]
987962
#[non_exhaustive]

nextest-runner/src/helpers.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,35 @@ pub(crate) fn extract_abort_status(exit_status: ExitStatus) -> Option<AbortStatu
313313
}
314314
}
315315

316+
pub(crate) fn display_exit_status(exit_status: ExitStatus) -> String {
317+
match extract_abort_status(exit_status) {
318+
Some(abort_status) => display_abort_status(abort_status),
319+
None => match exit_status.code() {
320+
Some(code) => format!("exit code {}", code),
321+
None => "an unknown error".to_owned(),
322+
},
323+
}
324+
}
325+
326+
/// Display the abort status.
327+
pub(crate) fn display_abort_status(abort_status: AbortStatus) -> String {
328+
match abort_status {
329+
#[cfg(unix)]
330+
AbortStatus::UnixSignal(sig) => match crate::helpers::signal_str(sig) {
331+
Some(s) => {
332+
format!("signal {sig} (SIG{s})")
333+
}
334+
None => {
335+
format!("signal {sig}")
336+
}
337+
},
338+
#[cfg(windows)]
339+
AbortStatus::WindowsNtStatus(nt_status) => {
340+
format!("code {}", crate::helpers::display_nt_status(nt_status))
341+
}
342+
}
343+
}
344+
316345
#[cfg(unix)]
317346
pub(crate) fn signal_str(signal: i32) -> Option<&'static str> {
318347
// These signal numbers are the same on at least Linux, macOS, FreeBSD and illumos.

nextest-runner/src/list/test_list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ impl<'a> TestInstance<'a> {
990990
/// Return an identifier for test instances, including being able to sort
991991
/// them.
992992
#[inline]
993-
pub(crate) fn id(&self) -> TestInstanceId<'a> {
993+
pub fn id(&self) -> TestInstanceId<'a> {
994994
TestInstanceId {
995995
binary_id: &self.suite_info.binary_id,
996996
test_name: self.name,
@@ -1060,7 +1060,7 @@ impl<'a> TestInstance<'a> {
10601060
///
10611061
/// Returned by [`TestInstance::id`].
10621062
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
1063-
pub(crate) struct TestInstanceId<'a> {
1063+
pub struct TestInstanceId<'a> {
10641064
/// The binary ID.
10651065
pub binary_id: &'a RustBinaryId,
10661066

nextest-runner/src/reporter/aggregator.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ impl<'cfg> MetadataJunit<'cfg> {
6565
| TestEventKind::RunContinued { .. } => {}
6666
TestEventKind::SetupScriptStarted { .. }
6767
| TestEventKind::SetupScriptSlow { .. }
68-
| TestEventKind::SetupScriptFinished { .. } => {}
68+
| TestEventKind::SetupScriptFinished { .. }
69+
| TestEventKind::InfoStarted { .. }
70+
| TestEventKind::InfoResponse { .. }
71+
| TestEventKind::InfoFinished { .. } => {}
6972
TestEventKind::TestStarted { .. } => {}
7073
TestEventKind::TestSlow { .. } => {}
7174
TestEventKind::TestAttemptFailedWillRetry { .. }

0 commit comments

Comments
 (0)