]> git.lizzy.rs Git - rust.git/commitdiff
test: Make a test less flaky
authorAlex Crichton <alex@alexcrichton.com>
Wed, 25 Mar 2015 22:26:39 +0000 (15:26 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 25 Mar 2015 22:26:39 +0000 (15:26 -0700)
It's considered an error to access stdout while a process is being shut down, so
tweak this test a bit to actually wait for the child thread to exit.

src/test/run-pass/extern-call-deep2.rs

index 7bbed563a99fe9dde207298ed904a2546da2008d..198745f5b19fe7a11a96e5949d447057c920e124 100644 (file)
@@ -8,10 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(std_misc, libc)]
+#![feature(libc)]
 
 extern crate libc;
-use std::thread::Thread;
+use std::thread;
 
 mod rustrt {
     extern crate libc;
@@ -42,9 +42,9 @@ fn count(n: libc::uintptr_t) -> libc::uintptr_t {
 pub fn main() {
     // Make sure we're on a task with small Rust stacks (main currently
     // has a large stack)
-    let _t = Thread::spawn(move|| {
+    thread::scoped(move|| {
         let result = count(1000);
         println!("result = {}", result);
         assert_eq!(result, 1000);
-    });
+    }).join();
 }