Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 May 2015 09:37:15 +0000 (UTC)
From:      Peter Holm <pho@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r283560 - user/pho/stress2/misc
Message-ID:  <201505260937.t4Q9bFbE035848@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pho
Date: Tue May 26 09:37:14 2015
New Revision: 283560
URL: https://svnweb.freebsd.org/changeset/base/283560

Log:
  Limit runtime. Cleanup code.

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

Modified: user/pho/stress2/misc/pfl.sh
==============================================================================
--- user/pho/stress2/misc/pfl.sh	Tue May 26 09:36:27 2015	(r283559)
+++ user/pho/stress2/misc/pfl.sh	Tue May 26 09:37:14 2015	(r283560)
@@ -73,7 +73,16 @@ chmod 777 $mp2
 
 su ${testuser} -c "cd $mp1; /tmp/pfl" &
 su ${testuser} -c "cd $mp2; /tmp/pfl" &
-wait; wait
+sleep .5
+start=`date '+%s'`
+while pgrep -q pfl; do
+	if [ $((`date '+%s'`- start)) -gt 600 ]; then
+		echo "$0 timed out."
+		pkill -9 pfl
+	fi
+	sleep 10
+done
+wait
 
 while mount | grep "$mp2 " | grep -q /dev/md; do
 	umount $mp2 || sleep 1
@@ -86,16 +95,17 @@ mdconfig -d -u $md1
 exit
 
 EOF
+#include <sys/mount.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
 #include <err.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <sched.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/mount.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
 #include <unistd.h>
 
 #define PARALLEL 10
@@ -104,8 +114,8 @@ static int size = 10000;
 void
 test(void)
 {
-	int fd, i, j;
 	pid_t pid;
+	int fd, i, j;
 	char file[128];
 
 	pid = getpid();



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