about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-09-30 01:21:55 +0000
committerbors <bors@rust-lang.org>2015-09-30 01:21:55 +0000
commit15db6ec5714dffab7b36db44de9ece5e76301e04 (patch)
treeac0cc52e908ae5dcd6677ed836d8048862633f85 /src/test
parent65d5c083377645a115c4ac23a620d3581b9562b6 (diff)
parent27dd6dd3dbe92debaac7d54c8405a3d3af1c4daf (diff)
Auto merge of #28500 - alexcrichton:docker-travis, r=brson
Travis CI has new infrastructure using the Google Compute Engine which has both
faster CPUs and more memory, and we've been encouraged to switch as it should
help our build times! The only downside currently, however, is that IPv6 is
disabled, causing a number of standard library tests to fail.

Consequently this commit tweaks our travis config in a few ways:

* ccache is disabled as it's not working on GCE just yet
* Docker is used to run tests inside which reportedly will get IPv6 working
* A system LLVM installation is used instead of building LLVM itself. This is
  primarily done to reduce build times, but we want automation for this sort of
  behavior anyway and we can extend this in the future with building from source
  as well if needed.
* gcc-specific logic is removed as the docker image for Ubuntu gives us a
  recent-enough gcc by default.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/core-run-destroy.rs36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/test/run-pass/core-run-destroy.rs b/src/test/run-pass/core-run-destroy.rs
index 83ce0db365f..d6b6d673ca5 100644
--- a/src/test/run-pass/core-run-destroy.rs
+++ b/src/test/run-pass/core-run-destroy.rs
@@ -30,26 +30,25 @@ macro_rules! t {
     ($e:expr) => (match $e { Ok(e) => e, Err(e) => panic!("error: {}", e) })
 }
 
+#[test]
 fn test_destroy_once() {
     let mut p = sleeper();
-    match p.kill() {
-        Ok(()) => {}
-        Err(e) => panic!("error: {}", e),
-    }
+    t!(p.kill());
 }
 
 #[cfg(unix)]
 pub fn sleeper() -> Child {
-    Command::new("sleep").arg("1000").spawn().unwrap()
+    t!(Command::new("sleep").arg("1000").spawn())
 }
 #[cfg(windows)]
 pub fn sleeper() -> Child {
     // There's a `timeout` command on windows, but it doesn't like having
     // its output piped, so instead just ping ourselves a few times with
     // gaps in between so we're sure this process is alive for awhile
-    Command::new("ping").arg("127.0.0.1").arg("-n").arg("1000").spawn().unwrap()
+    t!(Command::new("ping").arg("127.0.0.1").arg("-n").arg("1000").spawn())
 }
 
+#[test]
 fn test_destroy_twice() {
     let mut p = sleeper();
     t!(p.kill()); // this shouldn't crash...
@@ -58,21 +57,20 @@ fn test_destroy_twice() {
 
 #[test]
 fn test_destroy_actually_kills() {
-    #[cfg(all(unix,not(target_os="android")))]
-    static BLOCK_COMMAND: &'static str = "cat";
-
-    #[cfg(all(unix,target_os="android"))]
-    static BLOCK_COMMAND: &'static str = "/system/bin/cat";
-
-    #[cfg(windows)]
-    static BLOCK_COMMAND: &'static str = "cmd";
+    let cmd = if cfg!(windows) {
+        "cmd"
+    } else if cfg!(target_os = "android") {
+        "/system/bin/cat"
+    } else {
+        "cat"
+    };
 
     // this process will stay alive indefinitely trying to read from stdin
-    let mut p = Command::new(BLOCK_COMMAND)
-                        .stdin(Stdio::piped())
-                        .spawn().unwrap();
+    let mut p = t!(Command::new(cmd)
+                           .stdin(Stdio::piped())
+                           .spawn());
 
-    p.kill().unwrap();
+    t!(p.kill());
 
     // Don't let this test time out, this should be quick
     let (tx, rx) = channel();
@@ -82,7 +80,7 @@ fn test_destroy_actually_kills() {
             process::exit(1);
         }
     });
-    let code = p.wait().unwrap().code();
+    let code = t!(p.wait()).code();
     if cfg!(windows) {
         assert!(code.is_some());
     } else {