compiletest: Fix deadline bugs in new executor by Zalathar · Pull Request #140031 · rust-lang/rust (original) (raw)
The experimental new executor for compiletest (#139660) was found to have two major bugs in deadline handling for detecting slow tests:
- The comparison between
now
and test deadlines was reversed, causing no timeouts to ever be recognised. - After fixing that bug, it was found that the existing code would issue timeouts for any test that had started more than 60 seconds ago, even if the test had finished long before its deadline was reached.
This PR fixes those bugs.
(The new executor is not yet enabled by default, so this PR has no immediate effect on contributors.)
I noted in #139998 (comment) that I hoped to have some unit tests to accompany these fixes. Unfortunately that turned out to be infeasible, because DeadlineQueue
is tightly coupled to concrete mpsc::Receiver
APIs (in addition to Instant::now
), and trying to mock all of those would make the code much more complicated.
I did, however, add a few assertions that would have caught the failure to remove tests from the queue after their deadline.
r? jieyouxu