Skip to content

Commit 1ebb640

Browse files
authored
Unrolled build for #146335
Rollup merge of #146335 - arielb1:dont-dump-core, r=nnethercote disable core dumps for panic-uninitialized-zeroed That test causes a large amount of crashes. If a system has a /proc/sys/kernel/core_pattern that uploads core dumps enabled, it will take a long time to complete. Set dumpable to 0 to avoid that. Before: ``` $ time ./panic-uninitialized-zeroed real 0m47.457s user 0m0.023s sys 0m0.021s ``` After: ``` $ ./panic-uninitialized-zeroed real 0m0.029s user 0m0.019s sys 0m0.010s ```
2 parents 5e33838 + ef95c63 commit 1ebb640

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/ui/intrinsics/panic-uninitialized-zeroed.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@
55
//@ [strict]compile-flags: -Zstrict-init-checks
66
//@ needs-subprocess
77
//@ ignore-backends: gcc
8+
//@ edition:2024
89

910
#![allow(deprecated, invalid_value)]
10-
#![feature(never_type)]
11+
#![feature(never_type, rustc_private)]
1112

1213
use std::{
1314
mem::{self, MaybeUninit, ManuallyDrop},
1415
ptr::NonNull,
1516
num,
1617
};
1718

19+
#[cfg(target_os = "linux")]
20+
extern crate libc;
21+
1822
#[allow(dead_code)]
1923
struct Foo {
2024
x: u8,
@@ -108,6 +112,17 @@ fn test_panic_msg_only_if_strict<T>(op: impl (FnOnce() -> T) + 'static, msg: &st
108112

109113
fn main() {
110114
unsafe {
115+
#[cfg(target_os = "linux")]
116+
{
117+
// This test causes a large amount of crashes. If a system
118+
// has a /proc/sys/kernel/core_pattern that uploads core dumps enabled,
119+
// it will take a long time to complete. Set dumpable to 0 to avoid that.
120+
if libc::prctl(libc::PR_SET_DUMPABLE, 0) < 0 {
121+
let err = std::io::Error::last_os_error();
122+
panic!("failed to disable core dumps {err:?}");
123+
}
124+
}
125+
111126
// Uninhabited types
112127
test_panic_msg(
113128
|| mem::uninitialized::<!>(),

0 commit comments

Comments
 (0)