@@ -123,11 +123,22 @@ pub fn run_tests(mut config: Config) -> Result<()> {
123123 drop ( submit) ;
124124 } ) ;
125125
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+
126135 let mut threads = vec ! [ ] ;
127136
128137 // Create N worker threads that receive files to test.
129138 for _ in 0 ..std:: thread:: available_parallelism ( ) . unwrap ( ) . get ( ) {
139+ let finish_file = finish_file. clone ( ) ;
130140 threads. push ( s. spawn ( |_| -> Result < ( ) > {
141+ let finish_file = finish_file;
131142 for path in & receive {
132143 if !config. path_filter . is_empty ( ) {
133144 let path_display = path. display ( ) . to_string ( ) ;
@@ -140,11 +151,12 @@ pub fn run_tests(mut config: Config) -> Result<()> {
140151 // Ignore file if only/ignore rules do (not) apply
141152 if !test_file_conditions ( & comments, & target, & config) {
142153 ignored. fetch_add ( 1 , Ordering :: Relaxed ) ;
143- eprintln ! (
154+ let msg = format ! (
144155 "{} ... {}" ,
145156 path. display( ) ,
146157 "ignored (in-test comment)" . yellow( )
147158 ) ;
159+ finish_file. send ( msg) ?;
148160 continue ;
149161 }
150162 // Run the test for all revisions
@@ -161,10 +173,10 @@ pub fn run_tests(mut config: Config) -> Result<()> {
161173 }
162174 write ! ( msg, "... " ) . unwrap ( ) ;
163175 if errors. is_empty ( ) {
164- eprintln ! ( "{msg}{} ", "ok" . green( ) ) ;
176+ write ! ( msg , "{} ", "ok" . green( ) ) . unwrap ( ) ;
165177 succeeded. fetch_add ( 1 , Ordering :: Relaxed ) ;
166178 } else {
167- eprintln ! ( "{msg}{} ", "FAILED" . red( ) . bold( ) ) ;
179+ write ! ( msg , "{} ", "FAILED" . red( ) . bold( ) ) . unwrap ( ) ;
168180 failures. lock ( ) . unwrap ( ) . push ( (
169181 path. clone ( ) ,
170182 m,
@@ -173,11 +185,13 @@ pub fn run_tests(mut config: Config) -> Result<()> {
173185 stderr,
174186 ) ) ;
175187 }
188+ finish_file. send ( msg) ?;
176189 }
177190 }
178191 Ok ( ( ) )
179192 } ) ) ;
180193 }
194+
181195 for thread in threads {
182196 thread. join ( ) . unwrap ( ) ?;
183197 }
0 commit comments