]> git.lizzy.rs Git - rust.git/commitdiff
Make tests build on CloudABI.
authorEd Schouten <ed@nuxi.nl>
Thu, 11 Jan 2018 10:20:50 +0000 (11:20 +0100)
committerEd Schouten <ed@nuxi.nl>
Thu, 11 Jan 2018 10:28:34 +0000 (11:28 +0100)
There are some tests that need to be disabled on CloudABI specifically,
due to the fact that the shims cannot be built in combination with
unix::ext or windows::ext. Also improve the scoping of some imports to
suppress compiler warnings.

src/libstd/env.rs
src/libstd/fs.rs
src/libstd/net/tcp.rs
src/libstd/net/udp.rs
src/libstd/process.rs

index ed34c1204b3a1bd21e4c220c11cdf300b8eac0c4..27bf326631fb0416cf74082a6315bbf931e46a75 100644 (file)
@@ -956,8 +956,7 @@ mod arch {
 mod tests {
     use super::*;
 
-    use ffi::OsStr;
-    use path::{Path, PathBuf};
+    use path::Path;
 
     #[test]
     #[cfg_attr(target_os = "emscripten", ignore)]
@@ -980,6 +979,8 @@ fn test() {
     #[test]
     #[cfg(windows)]
     fn split_paths_windows() {
+        use path::PathBuf;
+
         fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
             split_paths(unparsed).collect::<Vec<_>>() ==
                 parsed.iter().map(|s| PathBuf::from(*s)).collect::<Vec<_>>()
@@ -1000,6 +1001,8 @@ fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
     #[test]
     #[cfg(unix)]
     fn split_paths_unix() {
+        use path::PathBuf;
+
         fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
             split_paths(unparsed).collect::<Vec<_>>() ==
                 parsed.iter().map(|s| PathBuf::from(*s)).collect::<Vec<_>>()
@@ -1015,6 +1018,8 @@ fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
     #[test]
     #[cfg(unix)]
     fn join_paths_unix() {
+        use ffi::OsStr;
+
         fn test_eq(input: &[&str], output: &str) -> bool {
             &*join_paths(input.iter().cloned()).unwrap() ==
                 OsStr::new(output)
@@ -1031,6 +1036,8 @@ fn test_eq(input: &[&str], output: &str) -> bool {
     #[test]
     #[cfg(windows)]
     fn join_paths_windows() {
+        use ffi::OsStr;
+
         fn test_eq(input: &[&str], output: &str) -> bool {
             &*join_paths(input.iter().cloned()).unwrap() ==
                 OsStr::new(output)
index f40aed2478a17845c0920c9c55f3859b3f9f9fb1..82ba1a8774caa394c9a1c9bce64e2e967364493e 100644 (file)
@@ -1981,7 +1981,7 @@ fn as_inner_mut(&mut self) -> &mut fs_imp::DirBuilder {
     }
 }
 
-#[cfg(all(test, not(target_os = "emscripten")))]
+#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
 mod tests {
     use io::prelude::*;
 
index 539ff1df1876f052bb00188edce8504c289e52e3..78235ea1b4b5f31b886d7fb95deb7a1f4b2a5215 100644 (file)
@@ -885,7 +885,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-#[cfg(all(test, not(target_os = "emscripten")))]
+#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
 mod tests {
     use io::ErrorKind;
     use io::prelude::*;
index 84ceaa659510f0790bed3217c0c95dc4806d94e8..fc7f9205d06ff6f72d57e6289b8d4dd9a4cfccde 100644 (file)
@@ -786,7 +786,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-#[cfg(all(test, not(target_os = "emscripten")))]
+#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
 mod tests {
     use io::ErrorKind;
     use net::*;
index 33e8a87a0b62c801d87b8ac0db569463e50269a0..5c66ac6ddded8efc2049c03fd12e8a766f8ca745 100644 (file)
@@ -1392,7 +1392,7 @@ pub fn id() -> u32 {
     ::sys::os::getpid()
 }
 
-#[cfg(all(test, not(target_os = "emscripten")))]
+#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
 mod tests {
     use io::prelude::*;