Always compile the fragile wait status test cases, just run them conditionally

Co-authored-by: David Tolnay <dtolnay@gmail.com>
This commit is contained in:
Ian Jackson 2021-03-09 10:53:03 +00:00 committed by GitHub
parent 8e4433ab3e
commit 11ca64401a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -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");
}
}