@@ -1071,8 +1071,12 @@ pub fn run_tests<F>(opts: &TestOpts, tests: Vec<TestDescAndFn>, mut callback: F)
1071
1071
where
1072
1072
F : FnMut ( TestEvent ) -> io:: Result < ( ) > ,
1073
1073
{
1074
- use std:: collections:: HashMap ;
1074
+ use std:: collections:: { self , HashMap } ;
1075
+ use std:: hash:: BuildHasherDefault ;
1075
1076
use std:: sync:: mpsc:: RecvTimeoutError ;
1077
+ // Use a deterministic hasher
1078
+ type TestMap =
1079
+ HashMap < TestDesc , Instant , BuildHasherDefault < collections:: hash_map:: DefaultHasher > > ;
1076
1080
1077
1081
let tests_len = tests. len ( ) ;
1078
1082
@@ -1111,9 +1115,9 @@ where
1111
1115
1112
1116
let ( tx, rx) = channel :: < MonitorMsg > ( ) ;
1113
1117
1114
- let mut running_tests: HashMap < TestDesc , Instant > = HashMap :: new ( ) ;
1118
+ let mut running_tests: TestMap = HashMap :: default ( ) ;
1115
1119
1116
- fn get_timed_out_tests ( running_tests : & mut HashMap < TestDesc , Instant > ) -> Vec < TestDesc > {
1120
+ fn get_timed_out_tests ( running_tests : & mut TestMap ) -> Vec < TestDesc > {
1117
1121
let now = Instant :: now ( ) ;
1118
1122
let timed_out = running_tests
1119
1123
. iter ( )
@@ -1131,7 +1135,7 @@ where
1131
1135
timed_out
1132
1136
} ;
1133
1137
1134
- fn calc_timeout ( running_tests : & HashMap < TestDesc , Instant > ) -> Option < Duration > {
1138
+ fn calc_timeout ( running_tests : & TestMap ) -> Option < Duration > {
1135
1139
running_tests. values ( ) . min ( ) . map ( |next_timeout| {
1136
1140
let now = Instant :: now ( ) ;
1137
1141
if * next_timeout >= now {
0 commit comments