]> git.lizzy.rs Git - rust.git/commitdiff
Remove all use of librustuv
authorAaron Turon <aturon@mozilla.com>
Wed, 1 Oct 2014 04:09:29 +0000 (21:09 -0700)
committerAaron Turon <aturon@mozilla.com>
Wed, 1 Oct 2014 17:33:11 +0000 (10:33 -0700)
26 files changed:
src/compiletest/compiletest.rs
src/doc/guide-runtime.md
src/libgreen/lib.rs
src/libgreen/sched.rs
src/libgreen/task.rs
src/libstd/lib.rs
src/test/bench/rt-spawn-rate.rs
src/test/bench/shootout-chameneos-redux.rs
src/test/bench/shootout-meteor.rs
src/test/bench/shootout-spectralnorm.rs
src/test/bench/shootout-threadring.rs
src/test/bench/silly-test-spawn.rs
src/test/run-make/bootstrap-from-c-with-green/Makefile [deleted file]
src/test/run-make/bootstrap-from-c-with-green/lib.rs [deleted file]
src/test/run-make/bootstrap-from-c-with-green/main.c [deleted file]
src/test/run-pass/core-run-destroy.rs
src/test/run-pass/issue-12684.rs
src/test/run-pass/issue-13304.rs
src/test/run-pass/issue-13494.rs
src/test/run-pass/issue-14456.rs
src/test/run-pass/issue-15149.rs
src/test/run-pass/issue-16272.rs
src/test/run-pass/process-detach.rs
src/test/run-pass/tcp-accept-stress.rs
src/test/run-pass/tcp-connect-timeouts.rs
src/test/run-pass/tcp-stress.rs

index 8188cb17b27c805e8a7cf5a50dd7b5eee75ff04a..0a486ef03055606620796c1317764a08dec24cfe 100644 (file)
 #![crate_type = "bin"]
 #![feature(phase)]
 
-// we use our own (green) start below; do not link in libnative; issue #13247.
-#![no_start]
-
 #![deny(warnings)]
 
 extern crate test;
 extern crate getopts;
-extern crate green;
-extern crate rustuv;
 #[phase(plugin, link)] extern crate log;
 
 extern crate regex;
 pub mod common;
 pub mod errors;
 
-#[start]
-fn start(argc: int, argv: *const *const u8) -> int {
-    green::start(argc, argv, rustuv::event_loop, main)
-}
-
 pub fn main() {
     let args = os::args();
     let config = parse_config(args);
index 24b5834ef7c085fc6ffdf8f667b799063e783a2c..66a1e46c82acba20320d1ecef03acc9115f4aad2 100644 (file)
@@ -240,7 +240,7 @@ To create a pool of green tasks which have no I/O support, you may shed the
 `rustuv::event_loop`. All tasks will have no I/O support, but they will still be
 able to deschedule/reschedule (use channels, locks, etc).
 
-~~~{.rust}
+~~~{.ignore}
 extern crate green;
 extern crate rustuv;
 
index b5da4dc24bb5bf788e34491bbb54d2a48c494ca4..7c67a3840b0572be12345a08e89c5e65361ca3b8 100644 (file)
 //! > **Note**: This `main` function in this example does *not* have I/O
 //! >           support. The basic event loop does not provide any support
 //!
-//! # Starting with I/O support in libgreen
-//!
-//! ```rust
-//! extern crate green;
-//! extern crate rustuv;
-//!
-//! #[start]
-//! fn start(argc: int, argv: *const *const u8) -> int {
-//!     green::start(argc, argv, rustuv::event_loop, main)
-//! }
-//!
-//! fn main() {
-//!     // this code is running in a pool of schedulers all powered by libuv
-//! }
-//! ```
-//!
-//! The above code can also be shortened with a macro from libgreen.
-//!
-//! ```
-//! #![feature(phase)]
-//! #[phase(plugin)] extern crate green;
-//!
-//! green_start!(main)
-//!
-//! fn main() {
-//!     // run inside of a green pool
-//! }
-//! ```
-//!
 //! # Using a scheduler pool
 //!
 //! This library adds a `GreenTaskBuilder` trait that extends the methods
 //!
 //! ```rust
 //! extern crate green;
-//! extern crate rustuv;
 //!
 //! # fn main() {
 //! use std::task::TaskBuilder;
 //!
 //! let mut config = PoolConfig::new();
 //!
-//! // Optional: Set the event loop to be rustuv's to allow I/O to work
-//! config.event_loop_factory = rustuv::event_loop;
-//!
 //! let mut pool = SchedPool::new(config);
 //!
 //! // Spawn tasks into the pool of schedulers
 #![allow(deprecated)]
 
 #[cfg(test)] #[phase(plugin, link)] extern crate log;
-#[cfg(test)] extern crate rustuv;
 extern crate libc;
 extern crate alloc;
 
 pub mod stack;
 pub mod task;
 
-/// A helper macro for booting a program with libgreen
-///
-/// # Example
-///
-/// ```
-/// #![feature(phase)]
-/// #[phase(plugin)] extern crate green;
-///
-/// green_start!(main)
-///
-/// fn main() {
-///     // running with libgreen
-/// }
-/// ```
-#[macro_export]
-macro_rules! green_start( ($f:ident) => (
-    mod __start {
-        extern crate green;
-        extern crate rustuv;
-
-        #[start]
-        fn start(argc: int, argv: *const *const u8) -> int {
-            green::start(argc, argv, rustuv::event_loop, super::$f)
-        }
-    }
-) )
-
 /// Set up a default runtime configuration, given compiler-supplied arguments.
 ///
 /// This function will block until the entire pool of M:N schedulers have
index 1075466d099f977de7375898b1e13298814f4d9e..feb381e4a21b4bc381b99f057b2586fe902d5963 100644 (file)
@@ -1024,8 +1024,6 @@ fn new_sched_rng() -> XorShiftRng {
 
 #[cfg(test)]
 mod test {
-    use rustuv;
-
     use std::rt::task::TaskOpts;
     use std::rt::task::Task;
     use std::rt::local::Local;
@@ -1277,28 +1275,6 @@ fn run(next: Box<GreenTask>) {
     //    }
     //}
 
-    #[test]
-    fn test_io_callback() {
-        use std::io::timer;
-
-        let mut pool = SchedPool::new(PoolConfig {
-            threads: 2,
-            event_loop_factory: rustuv::event_loop,
-        });
-
-        // This is a regression test that when there are no schedulable tasks in
-        // the work queue, but we are performing I/O, that once we do put
-        // something in the work queue again the scheduler picks it up and
-        // doesn't exit before emptying the work queue
-        pool.spawn(TaskOpts::new(), proc() {
-            spawn(proc() {
-                timer::sleep(Duration::milliseconds(10));
-            });
-        });
-
-        pool.shutdown();
-    }
-
     #[test]
     fn wakeup_across_scheds() {
         let (tx1, rx1) = channel();
index 2d67307431b86806b9e27fca75eb8bcb05db13ed..3b751a5a28d8945bfe9883b1afef394555787ae8 100644 (file)
@@ -506,7 +506,7 @@ mod tests {
     fn spawn_opts(opts: TaskOpts, f: proc():Send) {
         let mut pool = SchedPool::new(PoolConfig {
             threads: 1,
-            event_loop_factory: ::rustuv::event_loop,
+            event_loop_factory: super::super::basic::event_loop,
         });
         pool.spawn(opts, f);
         pool.shutdown();
index 299e41f72191d148504886ec52537afceeb4be2f..7304871cf214c5447389c1166c4015f5a788de90 100644 (file)
 
 #![reexport_test_harness_main = "test_main"]
 
-// When testing libstd, bring in libuv as the I/O backend so tests can print
-// things and all of the std::io tests have an I/O interface to run on top
-// of
-#[cfg(test)] extern crate rustuv;
-#[cfg(test)] extern crate native;
 #[cfg(test)] extern crate green;
 #[cfg(test)] extern crate debug;
 #[cfg(test)] #[phase(plugin, link)] extern crate log;
 
 pub use core_sync::comm;
 
-// Run tests with libgreen instead of libnative.
-#[cfg(test)] #[start]
-fn start(argc: int, argv: *const *const u8) -> int {
-    green::start(argc, argv, rustuv::event_loop, test_main)
-}
-
 /* Exported macros */
 
 pub mod macros;
index 2737c6df533fec71f3b77fe47b0120c06f34fa36..6f02bff9f310e5e4caee9a005a0c96f529db1c8b 100644 (file)
@@ -11,7 +11,6 @@
 #![no_start]
 
 extern crate green;
-extern crate rustuv;
 
 use std::task::spawn;
 use std::os;
@@ -22,7 +21,7 @@
 
 #[start]
 fn start(argc: int, argv: *const *const u8) -> int {
-    green::start(argc, argv, rustuv::event_loop, main)
+    green::start(argc, argv, green::basic::event_loop, main)
 }
 
 fn main() {
index 05ecb9def9b5c10e4dcbfde22012cbb20787cd95..2eddc301a83681e156deba3443e9849b6b6ee6eb 100644 (file)
 
 // no-pretty-expanded
 
-#![feature(phase)]
-#[phase(plugin)] extern crate green;
-
 use std::string::String;
 use std::fmt;
 
-green_start!(main)
-
 fn print_complements() {
     let all = [Blue, Red, Yellow];
     for aa in all.iter() {
index 9542a9a55ee5aa34408a2c6e6b4043d68b2c8d5d..10408dd0ef43d9b087c46ae2b504b96cad97de34 100644 (file)
 
 // no-pretty-expanded FIXME #15189
 
-#![feature(phase)]
-#[phase(plugin)] extern crate green;
-
 use std::sync::Arc;
 
-green_start!(main)
-
 //
 // Utilities.
 //
index 1b53d15c24ce25ab555109c9b48fad11d1c2401c..685e900b37eee52bbf925397f49dd9c9923f83ac 100644 (file)
@@ -40,9 +40,7 @@
 
 // no-pretty-expanded FIXME #15189
 
-#![feature(phase)]
 #![allow(non_snake_case)]
-#[phase(plugin)] extern crate green;
 
 use std::from_str::FromStr;
 use std::iter::count;
@@ -50,8 +48,6 @@
 use std::os;
 use std::sync::{Arc, RWLock};
 
-green_start!(main)
-
 fn A(i: uint, j: uint) -> f64 {
     ((i + j) * (i + j + 1) / 2 + i + 1) as f64
 }
index 33c84705b0625526b27289b758d709d023a17534..cda0feb8b55a312d8eccd92bf576201c78b9daca 100644 (file)
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 // OF THE POSSIBILITY OF SUCH DAMAGE.
 
-#![feature(phase)]
-#[phase(plugin)] extern crate green;
-green_start!(main)
-
 fn start(n_tasks: int, token: int) {
     let (tx, mut rx) = channel();
     tx.send(token);
index 1e5eedfa8a9eae6668cc046f900e51d8ff89924b..bc2723f6d74b3b2900577d78d43f2c66e31025ef 100644 (file)
@@ -9,16 +9,13 @@
 // except according to those terms.
 
 // This is (hopefully) a quick test to get a good idea about spawning
-// performance in libgreen. Note that this uses the rustuv event loop rather
-// than the basic event loop in order to get a better real world idea about the
-// performance of a task spawn.
+// performance in libgreen.
 
 extern crate green;
-extern crate rustuv;
 
 #[start]
 fn start(argc: int, argv: *const *const u8) -> int {
-    green::start(argc, argv, rustuv::event_loop, main)
+    green::start(argc, argv, green::basic::event_loop, main)
 }
 
 fn main() {
diff --git a/src/test/run-make/bootstrap-from-c-with-green/Makefile b/src/test/run-make/bootstrap-from-c-with-green/Makefile
deleted file mode 100644 (file)
index c7753a6..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
--include ../tools.mk
-
-HOST_LIB_DIR=$(TMPDIR)/../../../stage$(RUST_BUILD_STAGE)/lib
-# This overrides the LD_LIBRARY_PATH for RUN
-TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR)
-
-all:
-       $(RUSTC) lib.rs
-       $(CC) main.c -o $(call RUN_BINFILE,main) $(call RPATH_LINK_SEARCH,$(HOST_LIB_DIR)) -lboot
-       $(call RUN,main)
-       $(call REMOVE_DYLIBS,boot)
-       $(call FAIL,main)
diff --git a/src/test/run-make/bootstrap-from-c-with-green/lib.rs b/src/test/run-make/bootstrap-from-c-with-green/lib.rs
deleted file mode 100644 (file)
index 7f17018..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![crate_name="boot"]
-#![crate_type="dylib"]
-
-extern crate rustuv;
-extern crate green;
-
-#[no_mangle] // this needs to get called from C
-pub extern "C" fn foo(argc: int, argv: *const *const u8) -> int {
-    green::start(argc, argv, rustuv::event_loop, proc() {
-        spawn(proc() {
-            println!("hello");
-        });
-    })
-}
diff --git a/src/test/run-make/bootstrap-from-c-with-green/main.c b/src/test/run-make/bootstrap-from-c-with-green/main.c
deleted file mode 100644 (file)
index 1872c1e..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// this is the rust entry point that we're going to call.
-int foo(int argc, char *argv[]);
-
-int main(int argc, char *argv[]) {
-  return foo(argc, argv);
-}
index c7a02a419c0d404c1459b85dc955b4a6cd1ec77c..4bde2712140ef7f98305a756eeb51d6f223fe61e 100644 (file)
 extern crate libc;
 
 extern crate native;
-extern crate green;
-extern crate rustuv;
 
-use std::io::{Process, Command};
+use std::io::{Process, Command, timer};
 use std::time::Duration;
 
+use libc;
+use std::str;
+
 macro_rules! succeed( ($e:expr) => (
     match $e { Ok(..) => {}, Err(e) => fail!("failure: {}", e) }
 ) )
 
-macro_rules! iotest (
-    { fn $name:ident() $b:block $($a:attr)* } => (
-        mod $name {
-            #![allow(unused_imports)]
-
-            use std::io::timer;
-            use libc;
-            use std::str;
-            use std::io::process::Command;
-            use native;
-            use super::{sleeper, test_destroy_actually_kills};
-
-            fn f() $b
-
-            $($a)* #[test] fn green() { f() }
-            $($a)* #[test] fn native() {
-                use native;
-                let (tx, rx) = channel();
-                native::task::spawn(proc() { tx.send(f()) });
-                rx.recv();
-            }
-        }
-    )
-)
-
-#[cfg(test)] #[start]
-fn start(argc: int, argv: *const *const u8) -> int {
-    green::start(argc, argv, rustuv::event_loop, test_main)
-}
-
-iotest!(fn test_destroy_once() {
+fn test_destroy_once() {
     let mut p = sleeper();
     match p.signal_exit() {
         Ok(()) => {}
         Err(e) => fail!("error: {}", e),
     }
-})
+}
 
 #[cfg(unix)]
 pub fn sleeper() -> Process {
@@ -81,11 +52,11 @@ pub fn sleeper() -> Process {
     Command::new("ping").arg("127.0.0.1").arg("-n").arg("1000").spawn().unwrap()
 }
 
-iotest!(fn test_destroy_twice() {
+fn test_destroy_twice() {
     let mut p = sleeper();
     succeed!(p.signal_exit()); // this shouldnt crash...
     let _ = p.signal_exit(); // ...and nor should this (and nor should the destructor)
-})
+}
 
 pub fn test_destroy_actually_kills(force: bool) {
     use std::io::process::{Command, ProcessOutput, ExitStatus, ExitSignal};
@@ -129,10 +100,10 @@ pub fn test_destroy_actually_kills(force: bool) {
     }
 }
 
-iotest!(fn test_unforced_destroy_actually_kills() {
+fn test_unforced_destroy_actually_kills() {
     test_destroy_actually_kills(false);
-})
+}
 
-iotest!(fn test_forced_destroy_actually_kills() {
+fn test_forced_destroy_actually_kills() {
     test_destroy_actually_kills(true);
-})
+}
index e21338746be2c91ff62e99b4d1b129a1cf2776bc..536a72f9cb34eb08dd63587f87cb257f908e4885 100644 (file)
@@ -8,18 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-extern crate native;
-extern crate green;
-extern crate rustuv;
-
 use std::time::Duration;
 
-#[start]
-fn start(argc: int, argv: *const *const u8) -> int {
-    green::start(argc, argv, rustuv::event_loop, main)
-}
-
 fn main() {
     native::task::spawn(proc() customtask());
 }
index 6ca605742efa9fe799b8fb01354e784e68528c4d..c868189197e0a5c60738c11076ecb039ad84b6d5 100644 (file)
 
 // ignore-fast
 
-extern crate green;
-extern crate rustuv;
-extern crate native;
-
 use std::os;
 use std::io;
 use std::str;
 
-#[start]
-fn start(argc: int, argv: *const *const u8) -> int {
-    green::start(argc, argv, rustuv::event_loop, main)
-}
-
 fn main() {
     let args = os::args();
     let args = args.as_slice();
     if args.len() > 1 && args[1].as_slice() == "child" {
-        if args[2].as_slice() == "green" {
-            child();
-        } else {
-            let (tx, rx) = channel();
-            native::task::spawn(proc() { tx.send(child()); });
-            rx.recv();
-        }
+        child();
     } else {
-        parent("green".to_string());
-        parent("native".to_string());
-        let (tx, rx) = channel();
-        native::task::spawn(proc() {
-            parent("green".to_string());
-            parent("native".to_string());
-            tx.send(());
-        });
-        rx.recv();
+        parent();
     }
 }
 
-fn parent(flavor: String) {
+fn parent() {
     let args = os::args();
     let args = args.as_slice();
     let mut p = io::process::Command::new(args[0].as_slice())
-                                     .arg("child").arg(flavor).spawn().unwrap();
+                                     .arg("child").spawn().unwrap();
     p.stdin.get_mut_ref().write_str("test1\ntest2\ntest3").unwrap();
     let out = p.wait_with_output().unwrap();
     assert!(out.status.success());
index d8f8b979ad06366156df960e8ab4711b3aacd13e..9fe41f7e0243e9796ce56e719f4518df081a9efb 100644 (file)
 // This test may not always fail, but it can be flaky if the race it used to
 // expose is still present.
 
-extern crate green;
-extern crate rustuv;
-extern crate native;
-
-#[start]
-fn start(argc: int, argv: *const *const u8) -> int {
-    green::start(argc, argv, rustuv::event_loop, main)
-}
-
 fn helper(rx: Receiver<Sender<()>>) {
     for tx in rx.iter() {
         let _ = tx.send_opt(());
     }
 }
 
-fn test() {
+fn main() {
     let (tx, rx) = channel();
     spawn(proc() { helper(rx) });
     let (snd, rcv) = channel::<int>();
@@ -40,17 +31,3 @@ fn test() {
         }
     }
 }
-
-fn main() {
-    let (tx, rx) = channel();
-    spawn(proc() {
-        tx.send(test());
-    });
-    rx.recv();
-
-    let (tx, rx) = channel();
-    native::task::spawn(proc() {
-        tx.send(test());
-    });
-    rx.recv();
-}
index 96290386ccc11e4911d802513016464eb3362890..bee4baf68a03d9483bd6ae54c7f7aaaca814f5ff 100644 (file)
@@ -8,19 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(phase)]
-
-#[phase(plugin, link)]
-extern crate green;
-extern crate native;
 
 use std::io::process;
 use std::io::Command;
 use std::io;
 use std::os;
 
-green_start!(main)
-
 fn main() {
     let args = os::args();
     if args.len() > 1 && args.get(1).as_slice() == "child" {
@@ -29,12 +22,6 @@ fn main() {
 
     test();
 
-    let (tx, rx) = channel();
-    native::task::spawn(proc() {
-        tx.send(test());
-    });
-    rx.recv();
-
 }
 
 fn child() {
@@ -52,4 +39,3 @@ fn test() {
                                      .spawn().unwrap();
     assert!(p.wait().unwrap().success());
 }
-
index cb4410cc1aad98414506431af29d9a67f5809f1d..cc80232691d1d3206b4ed8f9f9d730fb3000bf85 100644 (file)
@@ -8,18 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(phase)]
-extern crate native;
-#[phase(plugin)]
-extern crate green;
-
-use native::NativeTaskBuilder;
 use std::io::{TempDir, Command, fs};
 use std::os;
 use std::task::TaskBuilder;
 
-green_start!(main)
-
 fn main() {
     // If we're the child, make sure we were invoked correctly
     let args = os::args();
@@ -28,11 +20,6 @@ fn main() {
     }
 
     test();
-    let (tx, rx) = channel();
-    TaskBuilder::new().native().spawn(proc() {
-        tx.send(test());
-    });
-    rx.recv();
 }
 
 fn test() {
index 86427f5e9ddf62b6e41534601aaed96c6f149b52..8c3d765b5eebbd08c89a8b24b55a75094dd68165 100644 (file)
@@ -8,28 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(phase)]
-#[phase(plugin)]
-extern crate green;
-extern crate native;
-
-use native::NativeTaskBuilder;
 use std::io::{process, Command};
 use std::os;
-use std::task::TaskBuilder;
-
-green_start!(main)
 
 fn main() {
     let len = os::args().len();
 
     if len == 1 {
         test();
-        let (tx, rx) = channel();
-        TaskBuilder::new().native().spawn(proc() {
-            tx.send(test());
-        });
-        rx.recv();
     } else {
         assert_eq!(len, 3);
     }
index 9d6cab42b5c907e331a7ac2ef888408e17daef79..f4ba9901560b89c22ada7eceba6204dd79ac5c29 100644 (file)
 // Note that the first thing we do is put ourselves in our own process group so
 // we don't interfere with other running tests.
 
-extern crate green;
-extern crate rustuv;
 extern crate libc;
 
 use std::io::process;
 use std::io::process::Command;
 use std::io::signal::{Listener, Interrupt};
 
-#[start]
-fn start(argc: int, argv: *const *const u8) -> int {
-    green::start(argc, argv, rustuv::event_loop, main)
-}
-
 fn main() {
     unsafe { libc::setsid(); }
 
index 1d69568e2b891a9b97b17400a664342f25e503fe..fe882937ca0189fbae6d41ad094b9b682a7e6729 100644 (file)
 //              quite quickly and it takes a few seconds for the sockets to get
 //              recycled.
 
-#![feature(phase)]
-
-#[phase(plugin)]
-extern crate green;
-extern crate native;
-
 use std::io::{TcpListener, Listener, Acceptor, EndOfFile, TcpStream};
 use std::sync::{atomic, Arc};
-use std::task::TaskBuilder;
-use native::NativeTaskBuilder;
 
 static N: uint = 8;
 static M: uint = 20;
 
-green_start!(main)
-
 fn main() {
     test();
-
-    let (tx, rx) = channel();
-    TaskBuilder::new().native().spawn(proc() {
-        tx.send(test());
-    });
-    rx.recv();
 }
 
 fn test() {
@@ -98,4 +82,3 @@ fn test() {
     // Everything should have been accepted.
     assert_eq!(cnt.load(atomic::SeqCst), N * M);
 }
-
index 00906004dbfb0cc06cb27d85ef1037ee511f7dc4..167e89ffd30701c56eee4cd2bd302ee13a1622df 100644 (file)
 #![allow(experimental)]
 #![reexport_test_harness_main = "test_main"]
 
-extern crate native;
-extern crate green;
-extern crate rustuv;
+#![allow(unused_imports)]
 
-#[cfg(test)] #[start]
-fn start(argc: int, argv: *const *const u8) -> int {
-    green::start(argc, argv, rustuv::event_loop, test_main)
-}
-
-macro_rules! iotest (
-    { fn $name:ident() $b:block $(#[$a:meta])* } => (
-        mod $name {
-            #![allow(unused_imports)]
-
-            use std::io::*;
-            use std::io::net::tcp::*;
-            use std::io::test::*;
-            use std::io;
-            use std::time::Duration;
-
-            fn f() $b
+use std::io::*;
+use std::io::net::tcp::*;
+use std::io::test::*;
+use std::io;
+use std::time::Duration;
 
-            $(#[$a])* #[test] fn green() { f() }
-            $(#[$a])* #[test] fn native() {
-                use native;
-                let (tx, rx) = channel();
-                native::task::spawn(proc() { tx.send(f()) });
-                rx.recv();
-            }
-        }
-    )
-)
-
-iotest!(fn eventual_timeout() {
+#[cfg_attr(target_os = "freebsd", ignore)]
+fn eventual_timeout() {
     use native;
     let addr = next_test_ip4();
     let host = addr.ip.to_string();
@@ -80,30 +56,29 @@ fn f() $b
         }
     }
     fail!("never timed out!");
-} #[cfg_attr(target_os = "freebsd", ignore)])
+}
 
-iotest!(fn timeout_success() {
+fn timeout_success() {
     let addr = next_test_ip4();
     let host = addr.ip.to_string();
     let port = addr.port;
     let _l = TcpListener::bind(host.as_slice(), port).unwrap().listen();
 
     assert!(TcpStream::connect_timeout(addr, Duration::milliseconds(1000)).is_ok());
-})
+}
 
-iotest!(fn timeout_error() {
+fn timeout_error() {
     let addr = next_test_ip4();
 
     assert!(TcpStream::connect_timeout(addr, Duration::milliseconds(1000)).is_err());
-})
-
-    iotest!(fn connect_timeout_zero() {
-        let addr = next_test_ip4();
-        assert!(TcpStream::connect_timeout(addr, Duration::milliseconds(0)).is_err());
-    })
+}
 
-    iotest!(fn connect_timeout_negative() {
-        let addr = next_test_ip4();
-        assert!(TcpStream::connect_timeout(addr, Duration::milliseconds(-1)).is_err());
-    })
+fn connect_timeout_zero() {
+    let addr = next_test_ip4();
+    assert!(TcpStream::connect_timeout(addr, Duration::milliseconds(0)).is_err());
+}
 
+fn connect_timeout_negative() {
+    let addr = next_test_ip4();
+    assert!(TcpStream::connect_timeout(addr, Duration::milliseconds(-1)).is_err());
+}
index 864d005f37344a710c85e78afc514fcea1d17de5..506e1a9bbe73f1a02140186e71b48c8c8eb4b5e5 100644 (file)
@@ -16,8 +16,6 @@
 #[phase(plugin, link)]
 extern crate log;
 extern crate libc;
-extern crate green;
-extern crate rustuv;
 extern crate debug;
 
 use std::io::net::tcp::{TcpListener, TcpStream};
 use std::task::TaskBuilder;
 use std::time::Duration;
 
-#[start]
-fn start(argc: int, argv: *const *const u8) -> int {
-    green::start(argc, argv, rustuv::event_loop, main)
-}
-
 fn main() {
     // This test has a chance to time out, try to not let it time out
     spawn(proc() {