Skip to content

Commit

Permalink
Make tests build on CloudABI.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
EdSchouten committed Jan 11, 2018
1 parent d882bb5 commit d9d97c9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
11 changes: 9 additions & 2 deletions src/libstd/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -980,6 +979,8 @@ mod tests {
#[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<_>>()
Expand All @@ -1000,6 +1001,8 @@ mod tests {
#[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<_>>()
Expand All @@ -1015,6 +1018,8 @@ mod tests {
#[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)
Expand All @@ -1031,6 +1036,8 @@ mod tests {
#[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)
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1981,7 +1981,7 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
}
}

#[cfg(all(test, not(target_os = "emscripten")))]
#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
mod tests {
use io::prelude::*;

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ impl fmt::Debug for TcpListener {
}
}

#[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::*;
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ impl fmt::Debug for UdpSocket {
}
}

#[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::*;
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down

0 comments on commit d9d97c9

Please sign in to comment.