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:
parent
047e65ec2d
commit
6dfb9460ca
@ -26,6 +26,9 @@
|
|||||||
#include "atf-c/detail/process.h"
|
#include "atf-c/detail/process.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#endif
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/wait.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 "
|
atf_tc_skip("Cannot unlimit the core file size; check limits "
|
||||||
"manually");
|
"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);
|
const int rawstatus = fork_and_wait_child(child_sigquit);
|
||||||
atf_process_status_t s;
|
atf_process_status_t s;
|
||||||
RE(atf_process_status_init(&s, rawstatus));
|
RE(atf_process_status_init(&s, rawstatus));
|
||||||
|
@ -31,6 +31,10 @@
|
|||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__RCSID("$NetBSD: t_wait.c,v 1.8 2017/01/13 19:28:55 christos Exp $");
|
__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/wait.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
@ -147,6 +151,14 @@ ATF_TC_BODY(wait6_coredumped, tc)
|
|||||||
pid_t pid;
|
pid_t pid;
|
||||||
static const struct rlimit rl = { RLIM_INFINITY, RLIM_INFINITY };
|
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()) {
|
switch (pid = fork()) {
|
||||||
case 0:
|
case 0:
|
||||||
ATF_REQUIRE(setrlimit(RLIMIT_CORE, &rl) == 0);
|
ATF_REQUIRE(setrlimit(RLIMIT_CORE, &rl) == 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user