Skip to content

Commit d41d29a

Browse files
committed
Disable core dumps in tests/stack_overflow_crash.rs
1 parent 9063280 commit d41d29a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

rayon-core/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ crossbeam-queue = "0.1.2"
2424
rand = "0.6"
2525
rand_xorshift = "0.1"
2626

27+
[target.'cfg(unix)'.dev-dependencies]
28+
libc = "0.2"
29+
2730
[[test]]
2831
name = "stack_overflow_crash"
2932
path = "tests/stack_overflow_crash.rs"

rayon-core/tests/stack_overflow_crash.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[cfg(unix)]
2+
extern crate libc;
13
extern crate rayon_core;
24

35
use rayon_core::ThreadPoolBuilder;
@@ -15,6 +17,19 @@ fn force_stack_overflow(depth: u32) {
1517
}
1618
}
1719

20+
#[cfg(unix)]
21+
fn disable_core() {
22+
unsafe {
23+
libc::setrlimit(
24+
libc::RLIMIT_CORE,
25+
&libc::rlimit {
26+
rlim_cur: 0,
27+
rlim_max: 0,
28+
},
29+
);
30+
}
31+
}
32+
1833
#[cfg(unix)]
1934
fn overflow_code() -> Option<i32> {
2035
None
@@ -63,6 +78,8 @@ fn main() {
6378
.build()
6479
.unwrap();
6580
pool.install(|| {
81+
#[cfg(unix)]
82+
disable_core();
6683
force_stack_overflow(32);
6784
});
6885
}

0 commit comments

Comments
 (0)