From 3021f29751ef75118f4c167c79aaeb97e0844ef4 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Sun, 6 Feb 2022 10:32:59 +0100 Subject: [PATCH] Try to avoid generating a core dump in segfault Proc test --- S29-os/system.t | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/S29-os/system.t b/S29-os/system.t index 06eee5347c..56721afccc 100644 --- a/S29-os/system.t +++ b/S29-os/system.t @@ -206,8 +206,17 @@ subtest 'Proc.pid is set correctly' => { # https://github.com/rakudo/rakudo/issues/3149 { - my $proc = run $*EXECUTABLE, ‘-e’, - ‘use NativeCall; sub strdup(int64) is native(Str) {*}; strdup(0)’; + my $proc = run $*EXECUTABLE, ‘-e’, q:to/CODE/; + use NativeCall; + + # try to avoid generating a core dump: + sub setrlimit(int32 $resource, blob8 $rlp) is native(Str) { * } + try setrlimit(4, blob8.allocate(4096, 0)); + + # trigger an intentional segfault: + sub strdup(int64) is native(Str) {*}; + strdup(0) + CODE throws-like { sink $proc }, X::Proc::Unsuccessful, 'Exit with a segfault makes the Proc throw in sink context';