Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

niner
Copy link
Contributor

@niner niner commented Feb 6, 2022

The test intentionally triggers a segfault. Especially on developer's systems, this will create a core dump that will be listed by e.g. coredumpctl list which makes it harder to notice actual bug-related segfaults. We can avoid this by disabling core dumps for the process. Unfortunately there doesn't seem to be a portable way to do this. The only way to do this without changing the nature of the test (by e.g. running the process through a shell) is to use NativeCall again to call setrlimit On the bright side, if the setrlimit call fails (because e.g. it's not available on Windows), we do not need to care, as worst case we revert to the previous behaviour.

@MasterDuke17
Copy link
Contributor

This does prevent the actual core file from being created, but there is still an entry in coredumpctl list. But what about faking the segfault entirely? E.g.,

my $p = Proc.new;
use nqp;
nqp::bindattr(nqp::decont($p), Proc, q|$!exitcode|, 0); nqp::bindattr(nqp::decont($p), Proc, q|$!signal|, 11);
use Test;
throws-like { sink $p }, X::Proc::Unsuccessful;

This passes for me.

@niner
Copy link
Contributor Author

niner commented Feb 15, 2022

I think I tried that and it still created a coredump

@MasterDuke17
Copy link
Contributor

I think I tried that and it still created a coredump

Huh, doesn't for me (using arch linux).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants