Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 873ecba

Browse files
authoredJun 25, 2025··
Auto merge of #143002 - Enselic:tests-ui-run-fail-exit-vs-signal, r=<try>
tests: Require `run-fail` ui tests to have an exit code (`SIGABRT` not ok) Normally a `run-fail` ui test shall not be terminated by a signal like `SIGABRT`. So begin having that as a hard requirement. Some of our current tests do terminate by a signal however. Introduce and use `run-fail-without-exit-code` for those tests. This adds further (cc #142304, #142886) protection against the regression in #123733 since that bug also manifested as `SIGABRT` in `tests/ui/panics/panic-main.rs` (shown as `Aborted (core dumped)` in the logs attached to that issue, and I have also been able to reproduce this locally). ### TODO - [ ] what about on Windows? - [ ] also update docs at https://rustc-dev-guide.rust-lang.org/tests/directives.html#controlling-outcome-expectations - [ ] clean up the code ### Zulip discussion See https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/compiletest.3A.20terminate.20by.20signal.20vs.20exit.20with.20error/with/525611235 try-job: x86_64-msvc-1 try-job: x86_64-msvc-2
2 parents a17780d + 17be091 commit 873ecba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+132
-75
lines changed
 

‎src/tools/compiletest/src/common.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,22 @@ string_enum! {
110110
}
111111
}
112112

113+
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
114+
pub enum RunFailMode {
115+
/// Running the program must exit with an exit code >= 1 && <= 127. If the
116+
/// program is terminated by a signal (or the exit code indicates abnormal
117+
/// exit) the test will fail.
118+
FailureExitCode,
119+
/// The running program must have crashed, e.g. by SIGABRT on Unix or
120+
/// Windows by setting an appropriate NTSTATUS high bit in the exit code.
121+
Crash,
122+
}
123+
113124
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
114125
pub enum FailMode {
115126
Check,
116127
Build,
117-
Run,
128+
Run(RunFailMode),
118129
}
119130

120131
string_enum! {

‎src/tools/compiletest/src/directive-list.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
241241
"regex-error-pattern",
242242
"remap-src-base",
243243
"revisions",
244+
"run-crash",
244245
"run-fail",
245246
"run-flags",
246247
"run-pass",

0 commit comments

Comments
 (0)
Please sign in to comment.