File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
src/tools/miri/tests/pass Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -44,11 +44,15 @@ fn check_all_outcomes<T: Eq + std::hash::Hash + std::fmt::Display>(
4444 let expected: HashSet < T > = HashSet :: from_iter ( expected) ;
4545 let mut seen = HashSet :: new ( ) ;
4646 // Let's give it N times as many tries as we are expecting values.
47- let tries = expected. len ( ) * 8 ;
48- for _ in 0 ..tries {
47+ let tries = expected. len ( ) * 12 ;
48+ for i in 0 ..tries {
4949 let val = generate ( ) ;
5050 assert ! ( expected. contains( & val) , "got an unexpected value: {val}" ) ;
5151 seen. insert ( val) ;
52+ if i > tries / 2 && expected. len ( ) == seen. len ( ) {
53+ // We saw everything and we did quite a few tries, let's avoid wasting time.
54+ return ;
55+ }
5256 }
5357 // Let's see if we saw them all.
5458 for val in expected {
Original file line number Diff line number Diff line change @@ -38,10 +38,14 @@ fn check_all_outcomes<T: Eq + std::hash::Hash + fmt::Display>(
3838 let mut seen = HashSet :: new ( ) ;
3939 // Let's give it N times as many tries as we are expecting values.
4040 let tries = expected. len ( ) * 12 ;
41- for _ in 0 ..tries {
41+ for i in 0 ..tries {
4242 let val = generate ( ) ;
4343 assert ! ( expected. contains( & val) , "got an unexpected value: {val}" ) ;
4444 seen. insert ( val) ;
45+ if i > tries / 2 && expected. len ( ) == seen. len ( ) {
46+ // We saw everything and we did quite a few tries, let's avoid wasting time.
47+ return ;
48+ }
4549 }
4650 // Let's see if we saw them all.
4751 for val in expected {
You can’t perform that action at this time.
0 commit comments