update README and add COMPILETEST_VERBOSE_CRASHES env var which when set print stdout, stderr and exit code of "crashes" tests, useful for debugging or adding new tests
This commit is contained in:
parent
6d9175f98e
commit
37df49059d
@ -364,16 +364,21 @@ impl<'test> TestCx<'test> {
|
||||
fn run_crash_test(&self) {
|
||||
let pm = self.pass_mode();
|
||||
let proc_res = self.compile_test(WillExecute::No, self.should_emit_metadata(pm));
|
||||
/*
|
||||
eprintln!("{}", proc_res.status);
|
||||
eprintln!("{}", proc_res.stdout);
|
||||
eprintln!("{}", proc_res.stderr);
|
||||
eprintln!("{}", proc_res.cmdline);
|
||||
*/
|
||||
|
||||
if std::env::var("COMPILETEST_VERBOSE_CRASHES").is_ok() {
|
||||
eprintln!("{}", proc_res.status);
|
||||
eprintln!("{}", proc_res.stdout);
|
||||
eprintln!("{}", proc_res.stderr);
|
||||
eprintln!("{}", proc_res.cmdline);
|
||||
}
|
||||
|
||||
// if a test does not crash, consider it an error
|
||||
if proc_res.status.success() || matches!(proc_res.status.code(), 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"));
|
||||
self.fatal(&format!(
|
||||
"test no longer crashes/triggers ICE! Please give it a mearningful name, \
|
||||
add a doc-comment to the start of the test explaining why it exists and \
|
||||
move it to tests/ui or wherever you see fit."
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,4 +10,7 @@ When adding crashes from https://github.com/rust-lang/rust/issues, the
|
||||
issue number should be noted in the file name (12345.rs should suffice)
|
||||
and perhaps also inside the file via `//@ known-bug #4321`
|
||||
|
||||
If you happen to fix one of the crashes, please move it to `tests/ui`! :)
|
||||
If you happen to fix one of the crashes, please move it to a fitting
|
||||
subdirectory in `tests/ui` and give it a meaningful name.
|
||||
Also please add a doc comment at the top of the file explaining why
|
||||
this test exists. :)
|
||||
|
Loading…
x
Reference in New Issue
Block a user