15
15
// Unfortunately, LLVM has no "disable" option for this, so we have to set
16
16
// "enable" to 0 instead.
17
17
18
- // compile-flags:-g -Cllvm-args=-enable-tail-merge=0
18
+ // compile-flags:-g -Cllvm-args=-enable-tail-merge=0 -Cllvm-args=-opt-bisect-limit=0
19
19
// ignore-pretty issue #37195
20
20
// ignore-cloudabi spawning processes is not supported
21
21
// ignore-emscripten spawning processes is not supported
22
22
23
+ // note that above `-opt-bisect-limit=0` is used to basically disable
24
+ // optimizations
25
+
23
26
use std:: env;
24
27
25
28
#[ path = "backtrace-debuginfo-aux.rs" ] mod aux;
@@ -114,25 +117,34 @@ fn outer(mut counter: i32, main_pos: Pos) {
114
117
inner_inlined ( & mut counter, main_pos, pos ! ( ) ) ;
115
118
}
116
119
117
- fn check_trace ( output : & str , error : & str ) {
120
+ fn check_trace ( output : & str , error : & str ) -> Result < ( ) , String > {
118
121
// reverse the position list so we can start with the last item (which was the first line)
119
122
let mut remaining: Vec < & str > = output. lines ( ) . map ( |s| s. trim ( ) ) . rev ( ) . collect ( ) ;
120
123
121
- assert ! ( error. contains( "stack backtrace" ) , "no backtrace in the error: {}" , error) ;
124
+ if !error. contains ( "stack backtrace" ) {
125
+ return Err ( format ! ( "no backtrace found in stderr:\n {}" , error) )
126
+ }
122
127
for line in error. lines ( ) {
123
128
if !remaining. is_empty ( ) && line. contains ( remaining. last ( ) . unwrap ( ) ) {
124
129
remaining. pop ( ) ;
125
130
}
126
131
}
127
- assert ! ( remaining. is_empty( ) ,
128
- "trace does not match position list: {}\n ---\n {}" , error, output) ;
132
+ if !remaining. is_empty ( ) {
133
+ return Err ( format ! ( "trace does not match position list\n \
134
+ still need to find {:?}\n \n \
135
+ --- stdout\n {}\n \
136
+ --- stderr\n {}",
137
+ remaining, output, error) )
138
+ }
139
+ Ok ( ( ) )
129
140
}
130
141
131
142
fn run_test ( me : & str ) {
132
143
use std:: str;
133
144
use std:: process:: Command ;
134
145
135
146
let mut i = 0 ;
147
+ let mut errors = Vec :: new ( ) ;
136
148
loop {
137
149
let out = Command :: new ( me)
138
150
. env ( "RUST_BACKTRACE" , "full" )
@@ -143,10 +155,20 @@ fn run_test(me: &str) {
143
155
assert ! ( output. contains( "done." ) , "bad output for successful run: {}" , output) ;
144
156
break ;
145
157
} else {
146
- check_trace ( output, error) ;
158
+ if let Err ( e) = check_trace ( output, error) {
159
+ errors. push ( e) ;
160
+ }
147
161
}
148
162
i += 1 ;
149
163
}
164
+ if errors. len ( ) > 0 {
165
+ for error in errors {
166
+ println ! ( "---------------------------------------" ) ;
167
+ println ! ( "{}" , error) ;
168
+ }
169
+
170
+ panic ! ( "found some errors" ) ;
171
+ }
150
172
}
151
173
152
174
#[ inline( never) ]
0 commit comments