From owner-svn-src-user@FreeBSD.ORG Mon Jun 1 10:28:37 2015 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 58F20237; Mon, 1 Jun 2015 10:28:37 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 485491833; Mon, 1 Jun 2015 10:28:37 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t51ASb58088375; Mon, 1 Jun 2015 10:28:37 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t51ASb6Q088374; Mon, 1 Jun 2015 10:28:37 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201506011028.t51ASb6Q088374@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 1 Jun 2015 10:28:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r283877 - 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.20 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: Mon, 01 Jun 2015 10:28:37 -0000 Author: pho Date: Mon Jun 1 10:28:36 2015 New Revision: 283877 URL: https://svnweb.freebsd.org/changeset/base/283877 Log: Added timeout to test. Sponsored by: EMC / Isilon storage division Modified: user/pho/stress2/misc/rename.sh Modified: user/pho/stress2/misc/rename.sh ============================================================================== --- user/pho/stress2/misc/rename.sh Mon Jun 1 10:25:53 2015 (r283876) +++ user/pho/stress2/misc/rename.sh Mon Jun 1 10:28:36 2015 (r283877) @@ -40,7 +40,7 @@ here=`pwd` cd /tmp sed '1,/^EOF/d' < $here/$0 > rename.c -mycc -o rename -Wall rename.c +mycc -o rename -Wall rename.c || exit 1 rm -f rename.c rm -rf /tmp/rename.dir.* @@ -64,9 +64,10 @@ EOF #include #include #include +#include #include -#define N 30000 +#define RUNTIME 30 static char dir1[128]; static char dir2[128]; @@ -74,7 +75,8 @@ static char dir2[128]; int main(int argc, char **argv) { - int i, status; + time_t start; + int status; struct stat sb; pid_t p; @@ -88,9 +90,11 @@ main(int argc, char **argv) if ((p = fork()) == -1) err(1, "fork()"); if (p == 0) { + setproctitle("child"); if (chdir("..") == -1) err(1, "chdir(%s)", ".."); - for (i = 0; i < N; i++) { + start = time(NULL); + while (time(NULL) - start < RUNTIME) { if (rename(dir1, dir2) == -1) { warn("rename(%s, %s)", dir1, dir2); stat(dir1, &sb); @@ -110,7 +114,9 @@ main(int argc, char **argv) } _exit(0); } else { - for (i = 0; i < N; i++) { + setproctitle("parent"); + start = time(NULL); + while (time(NULL) - start < RUNTIME) { if (stat("..", &sb) == -1) err(1, "stat(..)"); }