about summary refs log tree commit diff
path: root/pkgs/development/compilers/rust/patches/tcp-stress-test-run-a-smaller-number-of-threads.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/rust/patches/tcp-stress-test-run-a-smaller-number-of-threads.patch')
-rw-r--r--pkgs/development/compilers/rust/patches/tcp-stress-test-run-a-smaller-number-of-threads.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/pkgs/development/compilers/rust/patches/tcp-stress-test-run-a-smaller-number-of-threads.patch b/pkgs/development/compilers/rust/patches/tcp-stress-test-run-a-smaller-number-of-threads.patch
new file mode 100644
index 000000000000..1b1d62160f65
--- /dev/null
+++ b/pkgs/development/compilers/rust/patches/tcp-stress-test-run-a-smaller-number-of-threads.patch
@@ -0,0 +1,44 @@
+From b6202b5d602ca8216febe8ce9078581faa32955e Mon Sep 17 00:00:00 2001
+From: Moritz Ulrich <moritz@tarn-vedra.de>
+Date: Sat, 30 Jul 2016 09:01:13 +0200
+Subject: [PATCH] tcp-stress-test: Run a smaller number of threads.
+
+---
+ src/test/run-pass/tcp-stress.rs | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/test/run-pass/tcp-stress.rs b/src/test/run-pass/tcp-stress.rs
+index dfc8649..df8cdc9 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 = 256;
++
+ 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);
+ }
+-- 
+2.9.1
+