11/* This tests a lot of fiddly platform-specific impl details.
2- It will probably flake a lot for a while. Feel free to split it up into different tests or add more `ignore-` directives.
3- If at all possible, rather than removing the assert that the different
4- revisions behave the same, move only the revisions that are failing into a
5- separate test, so that the rest are still kept the same.
6-
7- TODO: this test is megacursed, either split it into a separate run-make test that looks at the .stderr files or get `compare-mode` working
2+ It will probably flake a lot for a while. Feel free to split it up into
3+ different tests or add more `ignore-` directives. If at all possible, rather
4+ than removing the assert that the different revisions behave the same, move
5+ only the revisions that are failing into a separate test, so that the rest
6+ are still kept the same.
7+
8+ TODO: this test is megacursed, either split it into a separate run-make test
9+ that looks at the .stderr files or get `compare-mode` working
810 */
911
1012//@ ignore-android FIXME #17520
@@ -45,7 +47,8 @@ use std::env;
4547use std:: path:: Path ;
4648
4749fn main ( ) {
48- // Make sure this comes first. Otherwise the error message when the check below fails prevents you from using --bless to see the actual output.
50+ // Make sure this comes first. Otherwise the error message when the check
51+ // below fails prevents you from using --bless to see the actual output.
4952 std:: panic:: catch_unwind ( || check_all_panics ( ) ) . unwrap_err ( ) ;
5053
5154 // compiletest generates a bunch of files for each revision. make sure they're all the same.
@@ -54,7 +57,8 @@ fn main() {
5457 for file in std:: fs:: read_dir ( dir) . unwrap ( ) {
5558 let file = file. unwrap ( ) ;
5659 let name = file. file_name ( ) . into_string ( ) . unwrap ( ) ;
57- if !file. file_type ( ) . unwrap ( ) . is_file ( ) || !name. starts_with ( "std-backtrace-skip-frames." ) || !name. ends_with ( ".run.stderr" ) {
60+ if !file. file_type ( ) . unwrap ( ) . is_file ( ) || !name. starts_with ( "std-backtrace-skip-frames." )
61+ || !name. ends_with ( ".run.stderr" ) {
5862 continue ;
5963 }
6064 files. insert ( name, std:: fs:: read_to_string ( file. path ( ) ) . unwrap ( ) ) ;
@@ -64,16 +68,19 @@ fn main() {
6468 let mut first_full = None ;
6569
6670 for ( name, contents) in & files {
67- // These have different output. Rather than duplicating this whole test, just special-case them here.
71+ // These have different output. Rather than duplicating this whole test,
72+ // just special-case them here.
6873 let target = if name. contains ( ".full." ) || name. contains ( ".limited." ) {
6974 & mut first_full
7075 } else {
7176 & mut first_line_tables
7277 } ;
7378 if let Some ( ( target_name, target_contents) ) = target {
7479 if contents != * target_contents {
75- eprintln ! ( "are you *sure* that you want {name} to have different backtrace output than {target_name}?" ) ;
76- eprintln ! ( "NOTE: this test is stateful; run `rm tests/ui/backtrace/std-backtrace-skip-frames.*.stderr` to reset it" ) ;
80+ eprintln ! ( "are you *sure* that you want {name} to have different backtrace output\
81+ than {target_name}?") ;
82+ eprintln ! ( "NOTE: this test is stateful; run \
83+ `rm tests/ui/backtrace/std-backtrace-skip-frames.*.stderr` to reset it") ;
7784 std:: process:: exit ( 0 ) ;
7885 }
7986 } else {
@@ -89,7 +96,11 @@ fn main() {
8996
9097fn check_all_panics ( ) {
9198 // Spawn a bunch of threads and make sure all of them hide panic details we don't care about.
92- for func in [ unwrap_result, expect_result, unwrap_option, expect_option, explicit_panic, literal_panic, /*panic_nounwind*/ ] {
99+ let tests = [
100+ unwrap_result, expect_result, unwrap_option, expect_option, explicit_panic, literal_panic,
101+ /*panic_nounwind*/
102+ ] ;
103+ for func in tests {
93104 std:: thread:: spawn ( move || func ( ) ) . join ( ) . unwrap_err ( ) ;
94105 }
95106 std:: thread:: spawn ( || panic_fmt ( 3 ) ) . join ( ) . unwrap_err ( ) ;
0 commit comments