Skip to content

Commit 02bcfe9

Browse files
authored
Merge pull request #78 from Alexendoo/ice-status-code
Include compiler crashes in ICE defintion
2 parents a5f5034 + a3891cd commit 02bcfe9

File tree

1 file changed

+36
-43
lines changed

1 file changed

+36
-43
lines changed

src/main.rs

+36-43
Original file line numberDiff line numberDiff line change
@@ -239,39 +239,33 @@ impl Config {
239239
status, stdout_utf8, stderr_utf8
240240
);
241241

242-
let saw_ice = || -> bool { stderr_utf8.contains("error: internal compiler error") };
242+
// for commit message:
243+
// no text but 101 https://github.com/rust-lang/rust/issues/21599
244+
// no text, signal https://github.com/rust-lang/rust/issues/13368
243245

244-
let input = (self.output_processing_mode(), status.success());
246+
const SUCCESS: Option<i32> = Some(0);
247+
const ICE: Option<i32> = Some(101);
248+
249+
let input = (self.output_processing_mode(), status.code());
245250
let result = match input {
246-
(OutputProcessingMode::RegressOnErrorStatus, true) => TestOutcome::Baseline,
247-
(OutputProcessingMode::RegressOnErrorStatus, false) => TestOutcome::Regressed,
251+
(OutputProcessingMode::RegressOnErrorStatus, SUCCESS) => TestOutcome::Baseline,
252+
(OutputProcessingMode::RegressOnErrorStatus, _) => TestOutcome::Regressed,
248253

249-
(OutputProcessingMode::RegressOnSuccessStatus, true) => TestOutcome::Regressed,
250-
(OutputProcessingMode::RegressOnSuccessStatus, false) => TestOutcome::Baseline,
254+
(OutputProcessingMode::RegressOnSuccessStatus, SUCCESS) => TestOutcome::Regressed,
255+
(OutputProcessingMode::RegressOnSuccessStatus, _) => TestOutcome::Baseline,
251256

252-
(OutputProcessingMode::RegressOnIceAlone, _) => {
253-
if saw_ice() {
254-
TestOutcome::Regressed
255-
} else {
256-
TestOutcome::Baseline
257-
}
258-
}
259-
(OutputProcessingMode::RegressOnNotIce, _) => {
260-
if saw_ice() {
261-
TestOutcome::Baseline
262-
} else {
263-
TestOutcome::Regressed
264-
}
265-
}
257+
(OutputProcessingMode::RegressOnIceAlone, ICE) => TestOutcome::Regressed,
258+
(OutputProcessingMode::RegressOnIceAlone, None) => TestOutcome::Regressed,
259+
(OutputProcessingMode::RegressOnIceAlone, _) => TestOutcome::Baseline,
266260

267-
(OutputProcessingMode::RegressOnNonCleanError, true) => TestOutcome::Regressed,
268-
(OutputProcessingMode::RegressOnNonCleanError, false) => {
269-
if saw_ice() {
270-
TestOutcome::Regressed
271-
} else {
272-
TestOutcome::Baseline
273-
}
274-
}
261+
(OutputProcessingMode::RegressOnNotIce, ICE) => TestOutcome::Baseline,
262+
(OutputProcessingMode::RegressOnNotIce, None) => TestOutcome::Baseline,
263+
(OutputProcessingMode::RegressOnNotIce, _) => TestOutcome::Regressed,
264+
265+
(OutputProcessingMode::RegressOnNonCleanError, SUCCESS) => TestOutcome::Regressed,
266+
(OutputProcessingMode::RegressOnNonCleanError, ICE) => TestOutcome::Regressed,
267+
(OutputProcessingMode::RegressOnNonCleanError, None) => TestOutcome::Regressed,
268+
(OutputProcessingMode::RegressOnNonCleanError, _) => TestOutcome::Baseline,
275269
};
276270
debug!(
277271
"default_outcome_of_output: input: {:?} result: {:?}",
@@ -316,27 +310,27 @@ enum OutputProcessingMode {
316310
RegressOnSuccessStatus,
317311

318312
/// `RegressOnIceAlone`: Marks test outcome as `Regressed` if and only if
319-
/// the `rustc` process issues a diagnostic indicating that an internal
320-
/// compiler error (ICE) occurred. This covers the use case for when you
321-
/// want to bisect to see when an ICE was introduced pon a codebase that is
322-
/// meant to produce a clean error.
313+
/// the `rustc` process crashes or reports an interal compiler error (ICE)
314+
/// has occurred. This covers the use case for when you want to bisect to
315+
/// see when an ICE was introduced pon a codebase that is meant to produce a
316+
/// clean error.
323317
///
324318
/// You explicitly opt into this seting via `--regress=ice`.
325319
RegressOnIceAlone,
326320

327321
/// `RegressOnNotIce`: Marks test outcome as `Regressed` if and only if
328-
/// the `rustc` process does not issue a diagnostic indicating that an
329-
/// internal compiler error (ICE) occurred. This covers the use case for
330-
/// when you want to bisect to see when an ICE was fixed.
322+
/// the `rustc` process does not crash or report that an internal compiler
323+
/// error (ICE) has occurred. This covers the use case for when you want to
324+
/// bisect to see when an ICE was fixed.
331325
///
332326
/// You explicitly opt into this setting via `--regress=non-ice`
333327
RegressOnNotIce,
334328

335329
/// `RegressOnNonCleanError`: Marks test outcome as `Baseline` if and only
336-
/// if the `rustc` process reports error status and does not issue any
337-
/// diagnostic indicating that an internal compiler error (ICE) occurred.
338-
/// This is the use case if the regression is a case where an ill-formed
339-
/// program has stopped being properly rejected by the compiler.
330+
/// if the `rustc` process reports error status that is not an internal
331+
/// compiler error (ICE). This is the use case if the regression is a case
332+
/// where an ill-formed program has stopped being properly rejected by the
333+
/// compiler.
340334
///
341335
/// (The main difference between this case and `RegressOnSuccessStatus` is
342336
/// the handling of ICE: `RegressOnSuccessStatus` assumes that ICE should be
@@ -351,11 +345,10 @@ impl OutputProcessingMode {
351345
fn must_process_stderr(&self) -> bool {
352346
match self {
353347
OutputProcessingMode::RegressOnErrorStatus
354-
| OutputProcessingMode::RegressOnSuccessStatus => false,
355-
356-
OutputProcessingMode::RegressOnNonCleanError
348+
| OutputProcessingMode::RegressOnSuccessStatus
349+
| OutputProcessingMode::RegressOnNonCleanError
357350
| OutputProcessingMode::RegressOnIceAlone
358-
| OutputProcessingMode::RegressOnNotIce => true,
351+
| OutputProcessingMode::RegressOnNotIce => false,
359352
}
360353
}
361354
}

0 commit comments

Comments
 (0)