where
F: FnMut(TestEvent) -> io::Result<()>,
{
- use std::collections::HashMap;
+ use std::collections::{self, HashMap};
+ use std::hash::BuildHasherDefault;
use std::sync::mpsc::RecvTimeoutError;
+ // Use a deterministic hasher
+ type TestMap =
+ HashMap<TestDesc, Instant, BuildHasherDefault<collections::hash_map::DefaultHasher>>;
let tests_len = tests.len();
let (tx, rx) = channel::<MonitorMsg>();
- let mut running_tests: HashMap<TestDesc, Instant> = HashMap::new();
+ let mut running_tests: TestMap = HashMap::default();
- fn get_timed_out_tests(running_tests: &mut HashMap<TestDesc, Instant>) -> Vec<TestDesc> {
+ fn get_timed_out_tests(running_tests: &mut TestMap) -> Vec<TestDesc> {
let now = Instant::now();
let timed_out = running_tests
.iter()
timed_out
};
- fn calc_timeout(running_tests: &HashMap<TestDesc, Instant>) -> Option<Duration> {
+ fn calc_timeout(running_tests: &TestMap) -> Option<Duration> {
running_tests.values().min().map(|next_timeout| {
let now = Instant::now();
if *next_timeout >= now {