Skip to content

Commit d9d97c9

Browse files
committed
Make tests build on CloudABI.
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.
1 parent d882bb5 commit d9d97c9

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

src/libstd/env.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -956,8 +956,7 @@ mod arch {
956956
mod tests {
957957
use super::*;
958958

959-
use ffi::OsStr;
960-
use path::{Path, PathBuf};
959+
use path::Path;
961960

962961
#[test]
963962
#[cfg_attr(target_os = "emscripten", ignore)]
@@ -980,6 +979,8 @@ mod tests {
980979
#[test]
981980
#[cfg(windows)]
982981
fn split_paths_windows() {
982+
use path::PathBuf;
983+
983984
fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
984985
split_paths(unparsed).collect::<Vec<_>>() ==
985986
parsed.iter().map(|s| PathBuf::from(*s)).collect::<Vec<_>>()
@@ -1000,6 +1001,8 @@ mod tests {
10001001
#[test]
10011002
#[cfg(unix)]
10021003
fn split_paths_unix() {
1004+
use path::PathBuf;
1005+
10031006
fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
10041007
split_paths(unparsed).collect::<Vec<_>>() ==
10051008
parsed.iter().map(|s| PathBuf::from(*s)).collect::<Vec<_>>()
@@ -1015,6 +1018,8 @@ mod tests {
10151018
#[test]
10161019
#[cfg(unix)]
10171020
fn join_paths_unix() {
1021+
use ffi::OsStr;
1022+
10181023
fn test_eq(input: &[&str], output: &str) -> bool {
10191024
&*join_paths(input.iter().cloned()).unwrap() ==
10201025
OsStr::new(output)
@@ -1031,6 +1036,8 @@ mod tests {
10311036
#[test]
10321037
#[cfg(windows)]
10331038
fn join_paths_windows() {
1039+
use ffi::OsStr;
1040+
10341041
fn test_eq(input: &[&str], output: &str) -> bool {
10351042
&*join_paths(input.iter().cloned()).unwrap() ==
10361043
OsStr::new(output)

src/libstd/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1981,7 +1981,7 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
19811981
}
19821982
}
19831983

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

src/libstd/net/tcp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ impl fmt::Debug for TcpListener {
885885
}
886886
}
887887

888-
#[cfg(all(test, not(target_os = "emscripten")))]
888+
#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
889889
mod tests {
890890
use io::ErrorKind;
891891
use io::prelude::*;

src/libstd/net/udp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ impl fmt::Debug for UdpSocket {
786786
}
787787
}
788788

789-
#[cfg(all(test, not(target_os = "emscripten")))]
789+
#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
790790
mod tests {
791791
use io::ErrorKind;
792792
use net::*;

src/libstd/process.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ pub fn id() -> u32 {
13921392
::sys::os::getpid()
13931393
}
13941394

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

0 commit comments

Comments
 (0)