@@ -113,23 +113,25 @@ fn chan_gone_concurrent() {
113113
114114#[ test]
115115fn stress ( ) {
116+ let count = if cfg ! ( miri) { 100 } else { 10000 } ;
116117 let ( tx, rx) = sync_channel :: < i32 > ( 0 ) ;
117118 thread:: spawn ( move || {
118- for _ in 0 ..10000 {
119+ for _ in 0 ..count {
119120 tx. send ( 1 ) . unwrap ( ) ;
120121 }
121122 } ) ;
122- for _ in 0 ..10000 {
123+ for _ in 0 ..count {
123124 assert_eq ! ( rx. recv( ) . unwrap( ) , 1 ) ;
124125 }
125126}
126127
127128#[ test]
128129fn stress_recv_timeout_two_threads ( ) {
130+ let count = if cfg ! ( miri) { 100 } else { 10000 } ;
129131 let ( tx, rx) = sync_channel :: < i32 > ( 0 ) ;
130132
131133 thread:: spawn ( move || {
132- for _ in 0 ..10000 {
134+ for _ in 0 ..count {
133135 tx. send ( 1 ) . unwrap ( ) ;
134136 }
135137 } ) ;
@@ -146,12 +148,12 @@ fn stress_recv_timeout_two_threads() {
146148 }
147149 }
148150
149- assert_eq ! ( recv_count, 10000 ) ;
151+ assert_eq ! ( recv_count, count ) ;
150152}
151153
152154#[ test]
153155fn stress_recv_timeout_shared ( ) {
154- const AMT : u32 = 1000 ;
156+ const AMT : u32 = if cfg ! ( miri ) { 100 } else { 1000 } ;
155157 const NTHREADS : u32 = 8 ;
156158 let ( tx, rx) = sync_channel :: < i32 > ( 0 ) ;
157159 let ( dtx, drx) = sync_channel :: < ( ) > ( 0 ) ;
@@ -191,7 +193,7 @@ fn stress_recv_timeout_shared() {
191193
192194#[ test]
193195fn stress_shared ( ) {
194- const AMT : u32 = 1000 ;
196+ const AMT : u32 = if cfg ! ( miri ) { 100 } else { 1000 } ;
195197 const NTHREADS : u32 = 8 ;
196198 let ( tx, rx) = sync_channel :: < i32 > ( 0 ) ;
197199 let ( dtx, drx) = sync_channel :: < ( ) > ( 0 ) ;
@@ -438,12 +440,13 @@ fn stream_send_recv_stress() {
438440
439441#[ test]
440442fn recv_a_lot ( ) {
443+ let count = if cfg ! ( miri) { 1000 } else { 10000 } ;
441444 // Regression test that we don't run out of stack in scheduler context
442- let ( tx, rx) = sync_channel ( 10000 ) ;
443- for _ in 0 ..10000 {
445+ let ( tx, rx) = sync_channel ( count ) ;
446+ for _ in 0 ..count {
444447 tx. send ( ( ) ) . unwrap ( ) ;
445448 }
446- for _ in 0 ..10000 {
449+ for _ in 0 ..count {
447450 rx. recv ( ) . unwrap ( ) ;
448451 }
449452}
0 commit comments