Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 May 2016 17:06:45 +0000 (UTC)
From:      Peter Holm <pho@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r299956 - user/pho/stress2/misc
Message-ID:  <201605161706.u4GH6jaU060466@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pho
Date: Mon May 16 17:06:44 2016
New Revision: 299956
URL: https://svnweb.freebsd.org/changeset/base/299956

Log:
  Extend runtime for tests, based on experience from testing r299788.
  Cleanup tests while here.
  
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  user/pho/stress2/misc/mmap6.sh
  user/pho/stress2/misc/msync2.sh
  user/pho/stress2/misc/wire_no_page.sh

Modified: user/pho/stress2/misc/mmap6.sh
==============================================================================
--- user/pho/stress2/misc/mmap6.sh	Mon May 16 16:44:34 2016	(r299955)
+++ user/pho/stress2/misc/mmap6.sh	Mon May 16 17:06:44 2016	(r299956)
@@ -42,7 +42,7 @@ rm -f wire_no_page.c
 cd $odir
 
 cp /tmp/mmap6  /tmp/mmap6.inputfile
-(cd ../testcases/swap; ./swap -t 1m -i 2) &
+(cd ../testcases/swap; ./swap -t 5m -i 2) &
 cp /tmp/mmap6 /tmp/mmap6.inputfile
 /tmp/mmap6  /tmp/mmap6.inputfile
 while killall -9 swap; do
@@ -50,20 +50,23 @@ while killall -9 swap; do
 done > /dev/null 2>&1
 wait
 rm -f /tmp/mmap6  /tmp/mmap6.inputfile
-exit
+exit 0
 
 EOF
-#include <err.h>
-#include <errno.h>
-#include <stdlib.h>
+#include <sys/param.h>
 #include <sys/fcntl.h>
 #include <sys/mman.h>
-#include <sys/param.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 #include <sys/wait.h>
+
+#include <err.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <time.h>
 #include <unistd.h>
 
+#define RUNTIME 300
+
 const char *file;
 char c;
 
@@ -110,9 +113,11 @@ wr(void)
 	if ((error = fstat(fd, &st)) == -1)
 		err(1, "stat(%s)", file);
 	len = round_page(st.st_size);
-	if ((p1 = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED)
+	if ((p1 = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) ==
+	    MAP_FAILED)
 		err(1, "mmap");
-	if ((p2 = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED)
+	if ((p2 = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) ==
+		    MAP_FAILED)
 		err(1, "mmap");
 	p1[arc4random() % len] = 1;
 	p2[arc4random() % len] = 1;
@@ -159,13 +164,14 @@ test(void)
 int
 main(int argc, char *argv[])
 {
-	int i;
+	time_t start;
 
 	if (argc != 2)
 		errx(1, "Usage: %s <file>", argv[0]);
 	file = argv[1];
 
-	for (i = 0; i < 30000; i++) {
+	start = time(NULL);
+	while (time(NULL) - start < RUNTIME) {
 		if (fork() == 0)
 			test();
 		wait(NULL);

Modified: user/pho/stress2/misc/msync2.sh
==============================================================================
--- user/pho/stress2/misc/msync2.sh	Mon May 16 16:44:34 2016	(r299955)
+++ user/pho/stress2/misc/msync2.sh	Mon May 16 17:06:44 2016	(r299956)
@@ -48,17 +48,20 @@ rm -f /tmp/msync2  /tmp/msync2.inputfile
 exit
 
 EOF
-#include <err.h>
-#include <errno.h>
-#include <stdlib.h>
+#include <sys/param.h>
 #include <sys/fcntl.h>
 #include <sys/mman.h>
-#include <sys/param.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 #include <sys/wait.h>
+
+#include <err.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <time.h>
 #include <unistd.h>
 
+#define RUNTIME 300
+
 const char *file;
 char c;
 
@@ -75,7 +78,8 @@ wr(void)
 	if ((error = fstat(fd, &st)) == -1)
 		err(1, "stat(%s)", file);
 	len = round_page(st.st_size);
-	if ((p1 = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED)
+	if ((p1 = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) ==
+	    MAP_FAILED)
 		err(1, "mmap");
 //	p1[len - 1] = 1;		/* No panic with this */
 	p1[arc4random() % len] = 1;	/* Need this for the panic */
@@ -112,13 +116,14 @@ test(void)
 int
 main(int argc, char *argv[])
 {
-	int i;
+	time_t start;
 
 	if (argc != 2)
 		errx(1, "Usage: %s <file>", argv[0]);
 	file = argv[1];
 
-	for (i = 0; i < 30000; i++) {
+	start = time(NULL);
+	while (time(NULL) - start < RUNTIME) {
 		if (fork() == 0)
 			test();
 		wait(NULL);

Modified: user/pho/stress2/misc/wire_no_page.sh
==============================================================================
--- user/pho/stress2/misc/wire_no_page.sh	Mon May 16 16:44:34 2016	(r299955)
+++ user/pho/stress2/misc/wire_no_page.sh	Mon May 16 17:06:44 2016	(r299956)
@@ -45,13 +45,12 @@ rm -f wire_no_page.c
 cd $odir
 
 cp /tmp/wire_no_page /tmp/wire_no_page2
-for i in `jot 100`; do
-	for j in `jot 50`; do
+start=`date '+%s'`
+while [ $((`date '+%s'` - start)) -lt 300 ]; do
+	for i in `jot 50`; do
 		/tmp/wire_no_page /tmp/wire_no_page2 &
 	done
-	for j in `jot 50`; do
-		wait
-	done
+	wait
 done
 
 rm -f /tmp/wire_no_page /tmp/wire_no_page2



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