From owner-svn-src-user@freebsd.org Sun Mar 27 18:27:00 2016 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59933ADFD8F for ; Sun, 27 Mar 2016 18:27:00 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 190EA1704; Sun, 27 Mar 2016 18:27:00 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2RIQxfw030036; Sun, 27 Mar 2016 18:26:59 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2RIQxp3030035; Sun, 27 Mar 2016 18:26:59 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201603271826.u2RIQxp3030035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Sun, 27 Mar 2016 18:26:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r297318 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Mar 2016 18:27:00 -0000 Author: pho Date: Sun Mar 27 18:26:59 2016 New Revision: 297318 URL: https://svnweb.freebsd.org/changeset/base/297318 Log: Limit run time and return error status on timeout. Sponsored by: EMC / Isilon Storage Division Modified: user/pho/stress2/misc/procfs4.sh Modified: user/pho/stress2/misc/procfs4.sh ============================================================================== --- user/pho/stress2/misc/procfs4.sh Sun Mar 27 18:20:53 2016 (r297317) +++ user/pho/stress2/misc/procfs4.sh Sun Mar 27 18:26:59 2016 (r297318) @@ -40,16 +40,22 @@ mount | grep -q procfs || mount -t procf here=`pwd` cd /tmp sed '1,/^EOF/d' < $here/$0 > procfs4.c -mycc -o procfs4 -Wall -Wextra -O2 procfs4.c +mycc -o procfs4 -Wall -Wextra -O2 procfs4.c || exit 1 rm -f procfs4.c cd $here su $testuser -c /tmp/procfs4 +e=$? rm -f /tmp/procfs4 -exit 0 +exit $e EOF #include +#include +#include +#include +#include + #include #include #include @@ -57,14 +63,12 @@ EOF #include #include #include -#include -#include -#include -#include +#include #include -#define PARALLEL 10 #define LOOPS 1000 +#define MAXRUN 600 +#define PARALLEL 10 char *files[] = { "cmdline", @@ -129,8 +133,11 @@ test(void) int main(void) { - int i, j; + time_t start; + int e, i, j; + e = 0; + start = time(NULL); for (i = 0; i < LOOPS; i++) { for (j = 0; j < PARALLEL; j++) { if (fork() == 0) @@ -140,7 +147,12 @@ main(void) for (j = 0; j < PARALLEL; j++) wait(NULL); usleep(10000); + if (time(NULL) - start > MAXRUN) { + fprintf(stderr, "FAIL Timeout\n"); + e = 1; + break; + } } - return (0); + return (e); }