From c0e767b00b325576b4d09b624a47382133db6163 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 24 Feb 2014 09:15:05 -0800 Subject: [PATCH 1/2] Correctly ignore some tests on windows These two tests are notoriously flaky on the windows bots right now, so I'm ignoring them until I can investigate them some more. The truncate_works test has been flaky for quite some time, but it has gotten much worse recently. The test_exists test has been flaky since the recent std::run rewrite landed. Finally, the "unix pipe" test failure is a recent discovery on the try bots. I haven't seen this failing much, but better safe than sorry! cc #12516 --- src/libstd/io/fs.rs | 5 ++--- src/libstd/io/net/unix.rs | 2 +- src/libstd/io/process.rs | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index 58c0caa34026f..ffccb0e8cb152 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -1106,9 +1106,8 @@ mod test { file.fsync().unwrap(); file.datasync().unwrap(); drop(file); - }) + } #[ignore(cfg(windows))]) - #[ignore(cfg(windows))] // FIXME(#11638) iotest!(fn truncate_works() { let tmpdir = tmpdir(); let path = tmpdir.join("in.txt"); @@ -1138,7 +1137,7 @@ mod test { assert_eq!(File::open(&path).read_to_end().unwrap(), (bytes!("fo", 0, 0, 0, 0, "wut")).to_owned()); drop(file); - }) + } #[ignore(cfg(windows))]) // FIXME(#11638) iotest!(fn open_flavors() { let tmpdir = tmpdir(); diff --git a/src/libstd/io/net/unix.rs b/src/libstd/io/net/unix.rs index a1f3cbbe32643..c3e3d72c6721e 100644 --- a/src/libstd/io/net/unix.rs +++ b/src/libstd/io/net/unix.rs @@ -192,7 +192,7 @@ mod tests { }, proc(_client) { // drop the client }) - }) + } #[ignore(cfg(windows))]) // FIXME(#12516) iotest!(fn write_begone() { smalltest(proc(mut server) { diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index b336572646541..b8eaf3bc6480d 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -823,11 +823,10 @@ mod tests { assert!(!p.wait().success()); }) - #[ignore(cfg(windows))] iotest!(fn test_exists() { let mut p = sleeper(); assert!(Process::kill(p.id(), 0).is_ok()); p.signal_kill().unwrap(); assert!(!p.wait().success()); - }) + } #[ignore(cfg(windows))]) // FIXME(#12516) } From 13a8fcd3e9cfc49e8cc1d50d132188ded311f9db Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 24 Feb 2014 10:59:11 -0800 Subject: [PATCH 2/2] windows: Fix the test_exists unit test Turns out the `timeout` command was exiting immediately because it didn't like its output piped. Instead use `ping` repeatedly to get a process that will sleep for awhile. cc #12516 --- src/libstd/io/process.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index b8eaf3bc6480d..b782cf1d21ab7 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -814,7 +814,10 @@ mod tests { } #[cfg(windows)] pub fn sleeper() -> Process { - Process::new("timeout", [~"1000"]).unwrap() + // 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 inbetweeen so we're sure this process is alive for awhile + Process::new("ping", [~"127.0.0.1", ~"-n", ~"1000"]).unwrap() } iotest!(fn test_kill() { @@ -828,5 +831,5 @@ mod tests { assert!(Process::kill(p.id(), 0).is_ok()); p.signal_kill().unwrap(); assert!(!p.wait().success()); - } #[ignore(cfg(windows))]) // FIXME(#12516) + }) }