Skip to content

Commit

Permalink
Always compile the fragile wait status test cases, just run them cond…
Browse files Browse the repository at this point in the history
…itionally

Co-authored-by: David Tolnay <dtolnay@gmail.com>
  • Loading branch information
ijackson and dtolnay authored Mar 9, 2021
1 parent 8e4433a commit 11ca644
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions library/std/src/sys/unix/process/process_unix/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ fn exitstatus_display_tests() {
// https://github.com/rust-lang/rust/pull/82749#issuecomment-790525956
// The purpose of this test is to test our string formatting, not our understanding of the wait
// status magic numbers. So restrict these to Linux.
#[cfg(target_os = "linux")]
t(0x0137f, "stopped (not terminated) by signal: 19");
#[cfg(target_os = "linux")]
t(0x0ffff, "continued (WIFCONTINUED)");
if cfg!(target_os = "linux") {
t(0x0137f, "stopped (not terminated) by signal: 19");
t(0x0ffff, "continued (WIFCONTINUED)");
}

// Testing "unrecognised wait status" is hard because the wait.h macros typically
// assume that the value came from wait and isn't mad. With the glibc I have here
// this works:
#[cfg(all(target_os = "linux", target_env = "gnu"))]
t(0x000ff, "unrecognised wait status: 255 0xff");
if cfg!(all(target_os = "linux", target_env = "gnu")) {
t(0x000ff, "unrecognised wait status: 255 0xff");
}
}

0 comments on commit 11ca644

Please sign in to comment.