@@ -94,11 +94,22 @@ pub fn run_tests(config: Config) -> Result<()> {
94
94
drop ( submit) ;
95
95
} ) ;
96
96
97
+ // A channel for the messages emitted by the individual test threads.
98
+ let ( finish_file, finished_files) = crossbeam:: channel:: unbounded ( ) ;
99
+
100
+ s. spawn ( |_| {
101
+ for msg in finished_files {
102
+ eprintln ! ( "{msg}" ) ;
103
+ }
104
+ } ) ;
105
+
97
106
let mut threads = vec ! [ ] ;
98
107
99
108
// Create N worker threads that receive files to test.
100
109
for _ in 0 ..std:: thread:: available_parallelism ( ) . unwrap ( ) . get ( ) {
110
+ let finish_file = finish_file. clone ( ) ;
101
111
threads. push ( s. spawn ( |_| -> Result < ( ) > {
112
+ let finish_file = finish_file;
102
113
for path in & receive {
103
114
if !config. path_filter . is_empty ( ) {
104
115
let path_display = path. display ( ) . to_string ( ) ;
@@ -111,11 +122,12 @@ pub fn run_tests(config: Config) -> Result<()> {
111
122
// Ignore file if only/ignore rules do (not) apply
112
123
if !test_file_conditions ( & comments, & target, & config) {
113
124
ignored. fetch_add ( 1 , Ordering :: Relaxed ) ;
114
- eprintln ! (
125
+ let msg = format ! (
115
126
"{} ... {}" ,
116
127
path. display( ) ,
117
128
"ignored (in-test comment)" . yellow( )
118
129
) ;
130
+ finish_file. send ( msg) ?;
119
131
continue ;
120
132
}
121
133
// Run the test for all revisions
@@ -132,10 +144,10 @@ pub fn run_tests(config: Config) -> Result<()> {
132
144
}
133
145
write ! ( msg, "... " ) . unwrap ( ) ;
134
146
if errors. is_empty ( ) {
135
- eprintln ! ( "{msg}{} ", "ok" . green( ) ) ;
147
+ write ! ( msg , "{} ", "ok" . green( ) ) . unwrap ( ) ;
136
148
succeeded. fetch_add ( 1 , Ordering :: Relaxed ) ;
137
149
} else {
138
- eprintln ! ( "{msg}{} ", "FAILED" . red( ) . bold( ) ) ;
150
+ write ! ( msg , "{} ", "FAILED" . red( ) . bold( ) ) . unwrap ( ) ;
139
151
failures. lock ( ) . unwrap ( ) . push ( (
140
152
path. clone ( ) ,
141
153
m,
@@ -144,11 +156,13 @@ pub fn run_tests(config: Config) -> Result<()> {
144
156
stderr,
145
157
) ) ;
146
158
}
159
+ finish_file. send ( msg) ?;
147
160
}
148
161
}
149
162
Ok ( ( ) )
150
163
} ) ) ;
151
164
}
165
+
152
166
for thread in threads {
153
167
thread. join ( ) . unwrap ( ) ?;
154
168
}
0 commit comments