Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jul 2013 11:54:45 +0000 (UTC)
From:      Peter Holm <pho@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r253390 - user/pho/stress2/lib
Message-ID:  <201307161154.r6GBsj7w025526@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pho
Date: Tue Jul 16 11:54:44 2013
New Revision: 253390
URL: http://svnweb.freebsd.org/changeset/base/253390

Log:
  Check if test scenario terminate before time.
  
  Sponsored by:	EMC / Isilon storage division

Modified:
  user/pho/stress2/lib/main.c

Modified: user/pho/stress2/lib/main.c
==============================================================================
--- user/pho/stress2/lib/main.c	Tue Jul 16 11:54:25 2013	(r253389)
+++ user/pho/stress2/lib/main.c	Tue Jul 16 11:54:44 2013	(r253390)
@@ -165,8 +165,11 @@ run_test(void)
 	if (p < 0)
 		err(1, "fork() in %s:%d", __FILE__, __LINE__);
 	while (done_testing != 1 &&
-			(time(NULL) - start) < op->run_time)
+			(time(NULL) - start) < op->run_time) {
 		sleep(1);
+		if (waitpid(p, &status, WNOHANG) == p)
+			return (status);
+	}
 	if (kill(p, SIGHUP) == -1)
 		warn("kill(%d, SIGHUP), %s:%d", p, __FILE__, __LINE__);
 



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