Skip tests depending on coredumps if coredumps are disabled via kern.coredump.

The kern.coredump sysctl can be set to 0 to disable coredumps.  Skip the
'status_coredump' and 'wait6_coredumped' tests if this sysctl is set to 0
rather than reporting a failure.

Submitted by:	brooks
Reviewed by:	ngie
Obtained from:	CheriBSD
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D10665
This commit is contained in:
John Baldwin 2017-05-16 18:42:44 +00:00
parent 047e65ec2d
commit 6dfb9460ca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=318363
2 changed files with 23 additions and 0 deletions

View file

@ -26,6 +26,9 @@
#include "atf-c/detail/process.h"
#include <sys/types.h>
#ifdef __FreeBSD__
#include <sys/sysctl.h>
#endif
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
@ -667,6 +670,14 @@ ATF_TC_BODY(status_coredump, tc)
atf_tc_skip("Cannot unlimit the core file size; check limits "
"manually");
#ifdef __FreeBSD__
int coredump_enabled;
size_t ce_len = sizeof(coredump_enabled);
if (sysctlbyname("kern.coredump", &coredump_enabled, &ce_len, NULL,
0) == 0 && !coredump_enabled)
atf_tc_skip("Coredumps disabled");
#endif
const int rawstatus = fork_and_wait_child(child_sigquit);
atf_process_status_t s;
RE(atf_process_status_init(&s, rawstatus));

View file

@ -31,6 +31,10 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_wait.c,v 1.8 2017/01/13 19:28:55 christos Exp $");
#ifdef __FreeBSD__
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
#include <sys/wait.h>
#include <sys/resource.h>
@ -147,6 +151,14 @@ ATF_TC_BODY(wait6_coredumped, tc)
pid_t pid;
static const struct rlimit rl = { RLIM_INFINITY, RLIM_INFINITY };
#ifdef __FreeBSD__
int coredump_enabled;
size_t ce_len = sizeof(coredump_enabled);
if (sysctlbyname("kern.coredump", &coredump_enabled, &ce_len, NULL,
0) == 0 && !coredump_enabled)
atf_tc_skip("Coredumps disabled");
#endif
switch (pid = fork()) {
case 0:
ATF_REQUIRE(setrlimit(RLIMIT_CORE, &rl) == 0);