diff options
| author | Moritz Ulrich <moritz@tarn-vedra.de> | 2016-07-30 09:01:13 +0200 |
|---|---|---|
| committer | Moritz Ulrich <moritz@tarn-vedra.de> | 2016-07-31 20:28:39 +0200 |
| commit | aaf8a6e108a6080cdd47983909e90a60c1d92aea (patch) | |
| tree | efe8c8c32969be2c5cf5f5aa5ff0b72c51a57a1c | |
| parent | 2ad98a0b42917dbb0914f458829db7511be168d4 (diff) | |
tcp-stress-test: Factor out thread count as constant.
| -rw-r--r-- | src/test/run-pass/tcp-stress.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/test/run-pass/tcp-stress.rs b/src/test/run-pass/tcp-stress.rs index dfc86497c96..e5b418bb733 100644 --- a/src/test/run-pass/tcp-stress.rs +++ b/src/test/run-pass/tcp-stress.rs @@ -21,6 +21,8 @@ use std::sync::mpsc::channel; use std::time::Duration; use std::thread::{self, Builder}; +const TARGET_CNT: usize = 1000; + fn main() { // This test has a chance to time out, try to not let it time out thread::spawn(move|| -> () { @@ -42,8 +44,9 @@ fn main() { }); let (tx, rx) = channel(); + let mut spawned_cnt = 0; - for _ in 0..1000 { + for _ in 0..TARGET_CNT { let tx = tx.clone(); let res = Builder::new().stack_size(64 * 1024).spawn(move|| { match TcpStream::connect(addr) { @@ -66,6 +69,6 @@ fn main() { for _ in 0..spawned_cnt { rx.recv().unwrap(); } - assert_eq!(spawned_cnt, 1000); + assert_eq!(spawned_cnt, TARGET_CNT); process::exit(0); } |
