@@ -123,11 +123,22 @@ pub fn run_tests(mut config: Config) -> Result<()> {
123
123
drop ( submit) ;
124
124
} ) ;
125
125
126
+ // A channel for the messages emitted by the individual test threads.
127
+ let ( finish_file, finished_files) = crossbeam:: channel:: unbounded ( ) ;
128
+
129
+ s. spawn ( |_| {
130
+ for msg in finished_files {
131
+ eprintln ! ( "{msg}" ) ;
132
+ }
133
+ } ) ;
134
+
126
135
let mut threads = vec ! [ ] ;
127
136
128
137
// Create N worker threads that receive files to test.
129
138
for _ in 0 ..std:: thread:: available_parallelism ( ) . unwrap ( ) . get ( ) {
139
+ let finish_file = finish_file. clone ( ) ;
130
140
threads. push ( s. spawn ( |_| -> Result < ( ) > {
141
+ let finish_file = finish_file;
131
142
for path in & receive {
132
143
if !config. path_filter . is_empty ( ) {
133
144
let path_display = path. display ( ) . to_string ( ) ;
@@ -140,11 +151,12 @@ pub fn run_tests(mut config: Config) -> Result<()> {
140
151
// Ignore file if only/ignore rules do (not) apply
141
152
if !test_file_conditions ( & comments, & target, & config) {
142
153
ignored. fetch_add ( 1 , Ordering :: Relaxed ) ;
143
- eprintln ! (
154
+ let msg = format ! (
144
155
"{} ... {}" ,
145
156
path. display( ) ,
146
157
"ignored (in-test comment)" . yellow( )
147
158
) ;
159
+ finish_file. send ( msg) ?;
148
160
continue ;
149
161
}
150
162
// Run the test for all revisions
@@ -161,10 +173,10 @@ pub fn run_tests(mut config: Config) -> Result<()> {
161
173
}
162
174
write ! ( msg, "... " ) . unwrap ( ) ;
163
175
if errors. is_empty ( ) {
164
- eprintln ! ( "{msg}{} ", "ok" . green( ) ) ;
176
+ write ! ( msg , "{} ", "ok" . green( ) ) . unwrap ( ) ;
165
177
succeeded. fetch_add ( 1 , Ordering :: Relaxed ) ;
166
178
} else {
167
- eprintln ! ( "{msg}{} ", "FAILED" . red( ) . bold( ) ) ;
179
+ write ! ( msg , "{} ", "FAILED" . red( ) . bold( ) ) . unwrap ( ) ;
168
180
failures. lock ( ) . unwrap ( ) . push ( (
169
181
path. clone ( ) ,
170
182
m,
@@ -173,11 +185,13 @@ pub fn run_tests(mut config: Config) -> Result<()> {
173
185
stderr,
174
186
) ) ;
175
187
}
188
+ finish_file. send ( msg) ?;
176
189
}
177
190
}
178
191
Ok ( ( ) )
179
192
} ) ) ;
180
193
}
194
+
181
195
for thread in threads {
182
196
thread. join ( ) . unwrap ( ) ?;
183
197
}
0 commit comments