about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-08-30 23:43:20 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-08-30 23:43:20 -0700
commit4ddbb0d4b1edb6f8f1fedf34e4bdc96710402800 (patch)
tree19a45685371362d369ef9b399aef5a7bb07c12a2
parentc2564540de933c2dfe48cc72f947b29853ab2803 (diff)
downloadrust-4ddbb0d4b1edb6f8f1fedf34e4bdc96710402800.tar.gz
rust-4ddbb0d4b1edb6f8f1fedf34e4bdc96710402800.zip
test: Fix the tcp-accept-stress test
It was previously asserted that each thread received at least one connection,
but this is not guaranteed to always be the case due to scheduling. This test
also deadlocked on failure due to a lingering reference to the sending half of
the channel, so that reference is now also eagerly dropped so the test can fail
properly if something bad happens.

Closes #16872
-rw-r--r--src/test/run-pass/tcp-accept-stress.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/test/run-pass/tcp-accept-stress.rs b/src/test/run-pass/tcp-accept-stress.rs
index 19097c8e26c..372f6a473b2 100644
--- a/src/test/run-pass/tcp-accept-stress.rs
+++ b/src/test/run-pass/tcp-accept-stress.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-macos #16872 spurious deadlock
-
 #![feature(phase)]
 
 #[phase(plugin)]
@@ -49,11 +47,9 @@ fn test() {
         let tx = tx.clone();
         spawn(proc() {
             let mut a = a;
-            let mut mycnt = 0u;
             loop {
                 match a.accept() {
                     Ok(..) => {
-                        mycnt += 1;
                         if cnt.fetch_add(1, atomic::SeqCst) == N * M - 1 {
                             break
                         }
@@ -62,7 +58,6 @@ fn test() {
                     Err(e) => fail!("{}", e),
                 }
             }
-            assert!(mycnt > 0);
             tx.send(());
         });
     }
@@ -77,6 +72,7 @@ fn test() {
             tx.send(());
         });
     }
+    drop(tx);
 
     // wait for senders
     assert_eq!(rx.iter().take(N).count(), N);