Handle a reply from the async threads.
(&mut self, reply: Reply)
| 253 | |
| 254 | /// Handle a reply from the async threads. |
| 255 | fn handle_reply(&mut self, reply: Reply) { |
| 256 | match reply { |
| 257 | Reply::Starting { jobid, .. } => { |
| 258 | assert!(matches!(self.tests[jobid].state, State::Queued)); |
| 259 | self.tests[jobid].state = State::Running; |
| 260 | } |
| 261 | Reply::Done { jobid, result } => { |
| 262 | self.ticks_since_progress = 0; |
| 263 | self.finish_job(jobid, result) |
| 264 | } |
| 265 | Reply::Tick => { |
| 266 | self.ticks_since_progress += 1; |
| 267 | if self.ticks_since_progress == TIMEOUT_SLOW { |
| 268 | println!( |
| 269 | "STALLED for {} seconds with {}/{} tests finished", |
| 270 | self.ticks_since_progress, |
| 271 | self.reported_tests, |
| 272 | self.tests.len() |
| 273 | ); |
| 274 | for jobid in self.reported_tests..self.tests.len() { |
| 275 | if let State::Running = self.tests[jobid].state { |
| 276 | println!("slow: {}", self.tests[jobid]); |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | if self.ticks_since_progress >= TIMEOUT_PANIC { |
| 281 | panic!( |
| 282 | "worker threads stalled for {} seconds.", |
| 283 | self.ticks_since_progress |
| 284 | ); |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | /// Drain the async jobs and shut down the threads. |
| 291 | fn drain_threads(&mut self) { |
no test coverage detected