@@ -1071,8 +1071,12 @@ pub fn run_tests<F>(opts: &TestOpts, tests: Vec<TestDescAndFn>, mut callback: F)
10711071where
10721072 F : FnMut ( TestEvent ) -> io:: Result < ( ) > ,
10731073{
1074- use std:: collections:: HashMap ;
1074+ use std:: collections:: { self , HashMap } ;
1075+ use std:: hash:: BuildHasherDefault ;
10751076 use std:: sync:: mpsc:: RecvTimeoutError ;
1077+ // Use a deterministic hasher
1078+ type TestMap =
1079+ HashMap < TestDesc , Instant , BuildHasherDefault < collections:: hash_map:: DefaultHasher > > ;
10761080
10771081 let tests_len = tests. len ( ) ;
10781082
@@ -1111,9 +1115,9 @@ where
11111115
11121116 let ( tx, rx) = channel :: < MonitorMsg > ( ) ;
11131117
1114- let mut running_tests: HashMap < TestDesc , Instant > = HashMap :: new ( ) ;
1118+ let mut running_tests: TestMap = HashMap :: default ( ) ;
11151119
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 > {
11171121 let now = Instant :: now ( ) ;
11181122 let timed_out = running_tests
11191123 . iter ( )
@@ -1131,7 +1135,7 @@ where
11311135 timed_out
11321136 } ;
11331137
1134- fn calc_timeout ( running_tests : & HashMap < TestDesc , Instant > ) -> Option < Duration > {
1138+ fn calc_timeout ( running_tests : & TestMap ) -> Option < Duration > {
11351139 running_tests. values ( ) . min ( ) . map ( |next_timeout| {
11361140 let now = Instant :: now ( ) ;
11371141 if * next_timeout >= now {
0 commit comments