Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion library/std/src/fs/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ fn recursive_mkdir_failure() {
}

#[test]
#[cfg_attr(target_os = "vxworks", ignore)]
fn concurrent_recursive_mkdir() {
for _ in 0..100 {
let dir = tmpdir();
Expand Down Expand Up @@ -801,8 +802,10 @@ fn recursive_rmdir_of_file_fails() {
let canary = tmpdir.join("do_not_delete");
check!(check!(File::create(&canary)).write(b"foo"));
let result = fs::remove_dir_all(&canary);
#[cfg(unix)]
#[cfg(all(not(target_os = "vxworks"),unix))]
error!(result, "Not a directory");
#[cfg(target_os = "vxworks")]
error!(result, "not a directory");
Comment on lines +805 to +808
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cleaner as a cfg_select!, e.g.

Suggested change
#[cfg(all(not(target_os = "vxworks"),unix))]
error!(result, "Not a directory");
#[cfg(target_os = "vxworks")]
error!(result, "not a directory");
cfg_select! {
target_os = "vxworks" => {
error!(result, "not a directory");
}
unix => {
error!(result, "Not a directory");
}
windows => {
error!(result, 267); // ERROR_DIRECTORY - The directory name is invalid.
}
_ => {
// all good.
}
}

#[cfg(windows)]
error!(result, 267); // ERROR_DIRECTORY - The directory name is invalid.
assert!(result.is_err());
Expand Down
36 changes: 20 additions & 16 deletions library/std/src/os/unix/net/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ macro_rules! or_panic {
}

#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make these look like this, with some reasoning for why this test is ignored on vxworks (is there a fundamental reason, is it just not implemented yet, etc)?

Suggested change
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
#[cfg_attr(target_os = "android", ignore = "Android SELinux rules prevent creating Unix sockets")]
#[cfg_attr(target_os = "vxworks", ignore = "...")]

fn basic() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
Expand Down Expand Up @@ -49,6 +49,7 @@ fn basic() {
}

#[test]
#[cfg_attr(target_os = "vxworks", ignore)]
fn vectored() {
let (mut s1, mut s2) = or_panic!(UnixStream::pair());

Expand All @@ -69,6 +70,7 @@ fn vectored() {
}

#[test]
#[cfg_attr(target_os = "vxworks", ignore)]
fn pair() {
let msg1 = b"hello";
let msg2 = b"world!";
Expand All @@ -92,7 +94,7 @@ fn pair() {
}

#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn try_clone() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
Expand All @@ -119,7 +121,7 @@ fn try_clone() {
}

#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn iter() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
Expand All @@ -142,6 +144,7 @@ fn iter() {
}

#[test]
#[cfg_attr(target_os = "vxworks", ignore)]
fn long_path() {
let dir = tmpdir();
let socket_path = dir.path().join(
Expand Down Expand Up @@ -169,7 +172,7 @@ fn long_path() {

#[test]
#[cfg(not(target_os = "nto"))]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn timeouts() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
Expand Down Expand Up @@ -197,7 +200,7 @@ fn timeouts() {
}

#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn test_read_timeout() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
Expand All @@ -217,7 +220,7 @@ fn test_read_timeout() {
}

#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn test_read_with_timeout() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
Expand Down Expand Up @@ -245,7 +248,7 @@ fn test_read_with_timeout() {
// Ensure the `set_read_timeout` and `set_write_timeout` calls return errors
// when passed zero Durations
#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn test_unix_stream_timeout_zero_duration() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
Expand All @@ -265,7 +268,7 @@ fn test_unix_stream_timeout_zero_duration() {
}

#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn test_unix_datagram() {
let dir = tmpdir();
let path1 = dir.path().join("sock1");
Expand All @@ -282,7 +285,7 @@ fn test_unix_datagram() {
}

#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn test_unnamed_unix_datagram() {
let dir = tmpdir();
let path1 = dir.path().join("sock1");
Expand All @@ -300,7 +303,7 @@ fn test_unnamed_unix_datagram() {
}

#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn test_unix_datagram_connect_to_recv_addr() {
let dir = tmpdir();
let path1 = dir.path().join("sock1");
Expand All @@ -325,7 +328,7 @@ fn test_unix_datagram_connect_to_recv_addr() {
}

#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn test_connect_unix_datagram() {
let dir = tmpdir();
let path1 = dir.path().join("sock1");
Expand All @@ -352,7 +355,7 @@ fn test_connect_unix_datagram() {
}

#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn test_unix_datagram_recv() {
let dir = tmpdir();
let path1 = dir.path().join("sock1");
Expand All @@ -370,6 +373,7 @@ fn test_unix_datagram_recv() {
}

#[test]
#[cfg_attr(target_os = "vxworks", ignore)]
fn datagram_pair() {
let msg1 = b"hello";
let msg2 = b"world!";
Expand All @@ -395,7 +399,7 @@ fn datagram_pair() {
// Ensure the `set_read_timeout` and `set_write_timeout` calls return errors
// when passed zero Durations
#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn test_unix_datagram_timeout_zero_duration() {
let dir = tmpdir();
let path = dir.path().join("sock");
Expand Down Expand Up @@ -549,7 +553,7 @@ fn test_abstract_no_pathname_and_not_unnamed() {
}

#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn test_unix_stream_peek() {
let (txdone, rxdone) = crate::sync::mpsc::channel();

Expand Down Expand Up @@ -582,7 +586,7 @@ fn test_unix_stream_peek() {
}

#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn test_unix_datagram_peek() {
let dir = tmpdir();
let path1 = dir.path().join("sock");
Expand All @@ -607,7 +611,7 @@ fn test_unix_datagram_peek() {
}

#[test]
#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets
#[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)]
fn test_unix_datagram_peek_from() {
let dir = tmpdir();
let path1 = dir.path().join("sock");
Expand Down
Loading