Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Nov 2015 08:30:45 +0000 (UTC)
From:      Peter Holm <pho@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r291473 - user/pho/stress2/misc
Message-ID:  <201511300830.tAU8Ujcx034125@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pho
Date: Mon Nov 30 08:30:45 2015
New Revision: 291473
URL: https://svnweb.freebsd.org/changeset/base/291473

Log:
  Limit run time.
  
  Sponsored by:	EMC / Isilon storage division

Modified:
  user/pho/stress2/misc/alternativeFlushPath.sh

Modified: user/pho/stress2/misc/alternativeFlushPath.sh
==============================================================================
--- user/pho/stress2/misc/alternativeFlushPath.sh	Mon Nov 30 08:02:52 2015	(r291472)
+++ user/pho/stress2/misc/alternativeFlushPath.sh	Mon Nov 30 08:30:45 2015	(r291473)
@@ -48,7 +48,8 @@ rm -rf $dir
 mkdir -p $dir
 cd $dir
 sed '1,/^EOF/d' < $odir/$0 > $dir/alternativeFlushPath.c
-mycc -o /tmp/alternativeFlushPath -Wall -Wextra alternativeFlushPath.c
+mycc -o /tmp/alternativeFlushPath -Wall -Wextra alternativeFlushPath.c ||
+    exit 1
 rm -f alternativeFlushPath.c
 
 for j in `jot 10`; do
@@ -72,6 +73,8 @@ EOF
 #include <sys/resource.h>
 #include <err.h>
 
+#define MAXNOFILE 500000	/* To limit runtime */
+
 static volatile sig_atomic_t more;
 
 static void
@@ -90,6 +93,8 @@ test(void)
 
         if (getrlimit(RLIMIT_NOFILE, &rlp) == -1)
                 err(1, "getrlimit(RLIMIT_NOFILE)");
+	if (rlp.rlim_cur > MAXNOFILE)
+		rlp.rlim_cur = MAXNOFILE;
 	rlp.rlim_cur /= 10;
         mypid = getpid();
         fd = malloc(rlp.rlim_cur * sizeof(int));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511300830.tAU8Ujcx034125>