about summary refs log tree commit diff
diff options
context:
space:
mode:
authorIan Jackson <ijackson+github@slimy.greenend.org.uk>2021-03-09 10:53:03 +0000
committerGitHub <noreply@github.com>2021-03-09 10:53:03 +0000
commit11ca64401a5d562898e8b5f46bd36d6d1c6dc3ef (patch)
tree61bddc912938bcf9e0bd1bf2512f8087473481b3
parent8e4433ab3e6a0fe8cc6f83379b30a48f94da4f33 (diff)
downloadrust-11ca64401a5d562898e8b5f46bd36d6d1c6dc3ef.tar.gz
rust-11ca64401a5d562898e8b5f46bd36d6d1c6dc3ef.zip
Always compile the fragile wait status test cases, just run them conditionally
Co-authored-by: David Tolnay <dtolnay@gmail.com>
-rw-r--r--library/std/src/sys/unix/process/process_unix/tests.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/library/std/src/sys/unix/process/process_unix/tests.rs b/library/std/src/sys/unix/process/process_unix/tests.rs
index 915402970f5..5819d2c2a5a 100644
--- a/library/std/src/sys/unix/process/process_unix/tests.rs
+++ b/library/std/src/sys/unix/process/process_unix/tests.rs
@@ -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");
+    }
 }