Skip to content

Commit 11ca644

Browse files
ijacksondtolnay
andauthored
Always compile the fragile wait status test cases, just run them conditionally
Co-authored-by: David Tolnay <[email protected]>
1 parent 8e4433a commit 11ca644

File tree

1 file changed

+7
-6
lines changed
  • library/std/src/sys/unix/process/process_unix

1 file changed

+7
-6
lines changed

library/std/src/sys/unix/process/process_unix/tests.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ fn exitstatus_display_tests() {
1616
// https://github.com/rust-lang/rust/pull/82749#issuecomment-790525956
1717
// The purpose of this test is to test our string formatting, not our understanding of the wait
1818
// status magic numbers. So restrict these to Linux.
19-
#[cfg(target_os = "linux")]
20-
t(0x0137f, "stopped (not terminated) by signal: 19");
21-
#[cfg(target_os = "linux")]
22-
t(0x0ffff, "continued (WIFCONTINUED)");
19+
if cfg!(target_os = "linux") {
20+
t(0x0137f, "stopped (not terminated) by signal: 19");
21+
t(0x0ffff, "continued (WIFCONTINUED)");
22+
}
2323

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

0 commit comments

Comments
 (0)