summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests/lib/libc/gen/t_assert.c
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2015-12-29 01:05:48 +0000
committerngie <ngie@FreeBSD.org>2015-12-29 01:05:48 +0000
commit1afba7abbc9faeab77bb817b6aa853997479ee09 (patch)
tree3be9a87d634b7441b6101bb4c8cc57f4a7d36f1c /contrib/netbsd-tests/lib/libc/gen/t_assert.c
parent8dfa514cac3d4d5ea56e3fdb2f700bfd6750b8a6 (diff)
downloadFreeBSD-src-1afba7abbc9faeab77bb817b6aa853997479ee09.zip
FreeBSD-src-1afba7abbc9faeab77bb817b6aa853997479ee09.tar.gz
MFC r292578:
Don't dump core files with lib/libc/ssp/ssp_test and lib/libc/gen/assert_test The default `sysctl kern.corefile` value is compatible with `kyua test` (FreeBSD will dump to the current directory). If it's set to an absolute path however, `kyua test` will not be able to clean up the corefiles after the fact The corefiles have little value when testing the behavior of feature behavior, so just disable corefile generation Obtained from: Isilon OneFS (^/onefs/head@r511419) Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'contrib/netbsd-tests/lib/libc/gen/t_assert.c')
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_assert.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_assert.c b/contrib/netbsd-tests/lib/libc/gen/t_assert.c
index 140417a..a09c130 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_assert.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_assert.c
@@ -40,6 +40,23 @@ __RCSID("$NetBSD: t_assert.c,v 1.2 2011/06/14 05:28:00 jruoho Exp $");
#include <string.h>
#include <unistd.h>
+#ifdef __FreeBSD__
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+static void
+disable_corefile(void)
+{
+ struct rlimit limits;
+
+ limits.rlim_cur = 0;
+ limits.rlim_max = 0;
+
+ ATF_REQUIRE(setrlimit(RLIMIT_CORE, &limits) == 0);
+}
+#endif
+
static void handler(int);
static void
@@ -65,6 +82,9 @@ ATF_TC_BODY(assert_false, tc)
if (pid == 0) {
+#ifdef __FreeBSD__
+ disable_corefile();
+#endif
(void)closefrom(0);
(void)memset(&sa, 0, sizeof(struct sigaction));
@@ -102,6 +122,9 @@ ATF_TC_BODY(assert_true, tc)
if (pid == 0) {
+#ifdef __FreeBSD__
+ disable_corefile();
+#endif
(void)closefrom(0);
(void)memset(&sa, 0, sizeof(struct sigaction));
OpenPOWER on IntegriCloud