1
1
/* 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
8
10
*/
9
11
10
12
//@ ignore-android FIXME #17520
@@ -45,7 +47,8 @@ use std::env;
45
47
use std:: path:: Path ;
46
48
47
49
fn 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.
49
52
std:: panic:: catch_unwind ( || check_all_panics ( ) ) . unwrap_err ( ) ;
50
53
51
54
// compiletest generates a bunch of files for each revision. make sure they're all the same.
@@ -54,7 +57,8 @@ fn main() {
54
57
for file in std:: fs:: read_dir ( dir) . unwrap ( ) {
55
58
let file = file. unwrap ( ) ;
56
59
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" ) {
58
62
continue ;
59
63
}
60
64
files. insert ( name, std:: fs:: read_to_string ( file. path ( ) ) . unwrap ( ) ) ;
@@ -64,16 +68,19 @@ fn main() {
64
68
let mut first_full = None ;
65
69
66
70
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.
68
73
let target = if name. contains ( ".full." ) || name. contains ( ".limited." ) {
69
74
& mut first_full
70
75
} else {
71
76
& mut first_line_tables
72
77
} ;
73
78
if let Some ( ( target_name, target_contents) ) = target {
74
79
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") ;
77
84
std:: process:: exit ( 0 ) ;
78
85
}
79
86
} else {
@@ -89,7 +96,11 @@ fn main() {
89
96
90
97
fn check_all_panics ( ) {
91
98
// 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 {
93
104
std:: thread:: spawn ( move || func ( ) ) . join ( ) . unwrap_err ( ) ;
94
105
}
95
106
std:: thread:: spawn ( || panic_fmt ( 3 ) ) . join ( ) . unwrap_err ( ) ;
0 commit comments