Skip to content

Commit 7c4c79a

Browse files
committed
compiletest: switch crash detection logic for run_crash_test around
previously we would explicitly look for exit code 101 and call it a crash, however in case of stack overflows for example, exit code could differ due to the process being killed by a signal which is not easy to detect on none-unix. So now we reject everything that exits with 0 (no error) or 1 (compiler failed to compile code) and "accept" everyhing else as an internal compiler error.
1 parent 2e99221 commit 7c4c79a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/tools/compiletest/src/runtest.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ impl<'test> TestCx<'test> {
354354
if self.props.should_ice {
355355
match proc_res.status.code() {
356356
Some(101) => (),
357-
_ => self.fatal("test no longer crashes/triggers ICE! Please annotate it and add it as test to tests/ui or wherever you see fit"),
357+
_ => self.fatal("expected ICE"),
358358
}
359359
}
360360

@@ -366,10 +366,11 @@ impl<'test> TestCx<'test> {
366366
let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm));
367367

368368
// if a test does not crash, consider it an error
369-
match proc_res.status.code() {
370-
Some(101) => (),
371-
Some(other) => self.fatal(&format!("expected exit code 101, got: {}", other)),
372-
e => self.fatal(&format!("expected ICE, got '{:?}'", e)),
369+
if !proc_res.status.success() {
370+
match proc_res.status.code() {
371+
Some(1 | 0) => self.fatal(&format!("test no longer crashes/triggers ICE! Please annotate it and add it as test to tests/ui or wherever you see fit")),
372+
_ => (),
373+
}
373374
}
374375
}
375376

0 commit comments

Comments
 (0)