Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/sys Enable the test for PR kern/46457 now tha...



details:   https://anonhg.NetBSD.org/src/rev/e8bb23c60549
branches:  trunk
changeset: 779296:e8bb23c60549
user:      martin <martin%NetBSD.org@localhost>
date:      Wed May 16 09:51:58 2012 +0000

description:
Enable the test for PR kern/46457 now that it does not crash the
kernel any more.

diffstat:

 tests/lib/libc/sys/t_pipe2.c |  20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diffs (48 lines):

diff -r 6b38498f53d7 -r e8bb23c60549 tests/lib/libc/sys/t_pipe2.c
--- a/tests/lib/libc/sys/t_pipe2.c      Wed May 16 09:41:11 2012 +0000
+++ b/tests/lib/libc/sys/t_pipe2.c      Wed May 16 09:51:58 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pipe2.c,v 1.4 2012/05/16 09:06:35 jruoho Exp $ */
+/* $NetBSD: t_pipe2.c,v 1.5 2012/05/16 09:51:58 martin Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -36,13 +36,14 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_pipe2.c,v 1.4 2012/05/16 09:06:35 jruoho Exp $");
+__RCSID("$NetBSD: t_pipe2.c,v 1.5 2012/05/16 09:51:58 martin Exp $");
 
 #include <atf-c.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <sys/resource.h>
 
 static void
 run(int flags)
@@ -107,10 +108,19 @@
 
 ATF_TC_BODY(pipe2_consume, tc)
 {
-       const size_t n = 200;
-       size_t i;
+       struct rlimit rl;
+       size_t i, n;
 
-       atf_tc_skip("The test case causes a panic (PR PR kern/46457)");
+       getrlimit(RLIMIT_NOFILE, &rl);
+       /*
+        * Each pipe2 call will allocate two filedescriptors, make sure we
+        * run into the limit...
+        */
+       n = rl.rlim_cur/2+1;
+
+       /*
+        * atf_tc_skip("The test case causes a panic (PR PR kern/46457)");
+        */
 
        for (i = 0; i < n; i++) {
 



Home | Main Index | Thread Index | Old Index