@@ -52,11 +52,14 @@ pub(crate) fn try_run_tests(
52
52
}
53
53
}
54
54
55
+ // NOTE: note that here, we consistently output all messages to stdout, because that's where
56
+ // compiletest + libtest output is going to be forwarded to. If we interleave stderr/stdout output,
57
+ // they will be combined in terminals then produce garbled interleavings.
55
58
fn run_tests ( builder : & Builder < ' _ > , cmd : & mut BootstrapCommand , stream : bool ) -> bool {
56
59
let cmd = cmd. as_command_mut ( ) ;
57
60
cmd. stdout ( Stdio :: piped ( ) ) ;
58
61
59
- builder. verbose ( || eprintln ! ( "running: {cmd:?}" ) ) ;
62
+ builder. verbose ( || println ! ( "running: {cmd:?}" ) ) ;
60
63
61
64
let mut process = cmd. spawn ( ) . unwrap ( ) ;
62
65
@@ -71,7 +74,7 @@ fn run_tests(builder: &Builder<'_>, cmd: &mut BootstrapCommand, stream: bool) ->
71
74
72
75
let result = process. wait_with_output ( ) . unwrap ( ) ;
73
76
if !result. status . success ( ) && builder. is_verbose ( ) {
74
- eprintln ! (
77
+ println ! (
75
78
"\n \n command did not execute successfully: {cmd:?}\n \
76
79
expected success, got: {}",
77
80
result. status
@@ -135,9 +138,7 @@ impl<'a> Renderer<'a> {
135
138
if self . up_to_date_tests > 0 {
136
139
let n = self . up_to_date_tests ;
137
140
let s = if n > 1 { "s" } else { "" } ;
138
- eprintln ! (
139
- "help: ignored {n} up-to-date test{s}; use `--force-rerun` to prevent this\n "
140
- ) ;
141
+ println ! ( "help: ignored {n} up-to-date test{s}; use `--force-rerun` to prevent this\n " ) ;
141
142
}
142
143
}
143
144
@@ -187,22 +188,22 @@ impl<'a> Renderer<'a> {
187
188
}
188
189
189
190
fn render_test_outcome_verbose ( & self , outcome : Outcome < ' _ > , test : & TestOutcome ) {
190
- eprint ! ( "test {} ... " , test. name) ;
191
+ print ! ( "test {} ... " , test. name) ;
191
192
self . builder . colored_stderr ( |stdout| outcome. write_long ( stdout) ) . unwrap ( ) ;
192
193
if let Some ( exec_time) = test. exec_time {
193
- eprint ! ( " ({exec_time:.2?})" ) ;
194
+ print ! ( " ({exec_time:.2?})" ) ;
194
195
}
195
- eprintln ! ( ) ;
196
+ println ! ( ) ;
196
197
}
197
198
198
199
fn render_test_outcome_terse ( & mut self , outcome : Outcome < ' _ > , test : & TestOutcome ) {
199
200
if self . terse_tests_in_line != 0 && self . terse_tests_in_line % TERSE_TESTS_PER_LINE == 0 {
200
201
if let Some ( total) = self . tests_count {
201
202
let total = total. to_string ( ) ;
202
203
let executed = format ! ( "{:>width$}" , self . executed_tests - 1 , width = total. len( ) ) ;
203
- eprint ! ( " {executed}/{total}" ) ;
204
+ print ! ( " {executed}/{total}" ) ;
204
205
}
205
- eprintln ! ( ) ;
206
+ println ! ( ) ;
206
207
self . terse_tests_in_line = 0 ;
207
208
}
208
209
@@ -214,31 +215,31 @@ impl<'a> Renderer<'a> {
214
215
fn render_suite_outcome ( & self , outcome : Outcome < ' _ > , suite : & SuiteOutcome ) {
215
216
// The terse output doesn't end with a newline, so we need to add it ourselves.
216
217
if !self . builder . config . verbose_tests {
217
- eprintln ! ( ) ;
218
+ println ! ( ) ;
218
219
}
219
220
220
221
if !self . failures . is_empty ( ) {
221
- eprintln ! ( "\n failures:\n " ) ;
222
+ println ! ( "\n failures:\n " ) ;
222
223
for failure in & self . failures {
223
224
if failure. stdout . is_some ( ) || failure. message . is_some ( ) {
224
- eprintln ! ( "---- {} stdout ----" , failure. name) ;
225
+ println ! ( "---- {} stdout ----" , failure. name) ;
225
226
if let Some ( stdout) = & failure. stdout {
226
- eprintln ! ( "{stdout}" ) ;
227
+ println ! ( "{stdout}" ) ;
227
228
}
228
229
if let Some ( message) = & failure. message {
229
- eprintln ! ( "NOTE: {message}" ) ;
230
+ println ! ( "NOTE: {message}" ) ;
230
231
}
231
232
}
232
233
}
233
234
234
- eprintln ! ( "\n failures:" ) ;
235
+ println ! ( "\n failures:" ) ;
235
236
for failure in & self . failures {
236
- eprintln ! ( " {}" , failure. name) ;
237
+ println ! ( " {}" , failure. name) ;
237
238
}
238
239
}
239
240
240
241
if !self . benches . is_empty ( ) {
241
- eprintln ! ( "\n benchmarks:" ) ;
242
+ println ! ( "\n benchmarks:" ) ;
242
243
243
244
let mut rows = Vec :: new ( ) ;
244
245
for bench in & self . benches {
@@ -253,13 +254,13 @@ impl<'a> Renderer<'a> {
253
254
let max_1 = rows. iter ( ) . map ( |r| r. 1 . len ( ) ) . max ( ) . unwrap_or ( 0 ) ;
254
255
let max_2 = rows. iter ( ) . map ( |r| r. 2 . len ( ) ) . max ( ) . unwrap_or ( 0 ) ;
255
256
for row in & rows {
256
- eprintln ! ( " {:<max_0$} {:>max_1$} {:>max_2$}" , row. 0 , row. 1 , row. 2 ) ;
257
+ println ! ( " {:<max_0$} {:>max_1$} {:>max_2$}" , row. 0 , row. 1 , row. 2 ) ;
257
258
}
258
259
}
259
260
260
- eprint ! ( "\n test result: " ) ;
261
+ print ! ( "\n test result: " ) ;
261
262
self . builder . colored_stderr ( |stdout| outcome. write_long ( stdout) ) . unwrap ( ) ;
262
- eprintln ! (
263
+ println ! (
263
264
". {} passed; {} failed; {} ignored; {} measured; {} filtered out{time}\n " ,
264
265
suite. passed,
265
266
suite. failed,
@@ -276,7 +277,7 @@ impl<'a> Renderer<'a> {
276
277
fn render_message ( & mut self , message : Message ) {
277
278
match message {
278
279
Message :: Suite ( SuiteMessage :: Started { test_count } ) => {
279
- eprintln ! ( "\n running {test_count} tests" ) ;
280
+ println ! ( "\n running {test_count} tests" ) ;
280
281
self . executed_tests = 0 ;
281
282
self . terse_tests_in_line = 0 ;
282
283
self . tests_count = Some ( test_count) ;
@@ -316,7 +317,7 @@ impl<'a> Renderer<'a> {
316
317
self . failures . push ( outcome) ;
317
318
}
318
319
Message :: Test ( TestMessage :: Timeout { name } ) => {
319
- eprintln ! ( "test {name} has been running for a long time" ) ;
320
+ println ! ( "test {name} has been running for a long time" ) ;
320
321
}
321
322
Message :: Test ( TestMessage :: Started ) => { } // Not useful
322
323
}
0 commit comments