Skip to content

Commit

Permalink
Try to avoid generating a core dump in segfault Proc test
Browse files Browse the repository at this point in the history
  • Loading branch information
niner committed Feb 6, 2022
1 parent 8e55c5c commit 3021f29
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions S29-os/system.t
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 3021f29

Please sign in to comment.