From owner-svn-src-user@freebsd.org Sat Jun 10 06:28:42 2017 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 E111DD86225 for ; Sat, 10 Jun 2017 06:28:42 +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 ACF3868AF4; Sat, 10 Jun 2017 06:28:42 +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 v5A6SfZK014788; Sat, 10 Jun 2017 06:28:41 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5A6SfZI014787; Sat, 10 Jun 2017 06:28:41 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201706100628.v5A6SfZI014787@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Sat, 10 Jun 2017 06:28:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r319770 - 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.23 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: Sat, 10 Jun 2017 06:28:43 -0000 Author: pho Date: Sat Jun 10 06:28:41 2017 New Revision: 319770 URL: https://svnweb.freebsd.org/changeset/base/319770 Log: Added timeout and fixed style while here. Sponsored by: Dell EMC Isilon Modified: user/pho/stress2/misc/linger.sh Modified: user/pho/stress2/misc/linger.sh ============================================================================== --- user/pho/stress2/misc/linger.sh Sat Jun 10 06:13:52 2017 (r319769) +++ user/pho/stress2/misc/linger.sh Sat Jun 10 06:28:41 2017 (r319770) @@ -52,7 +52,7 @@ newfs $opt md${mdstart}$part > /dev/null mount /dev/md${mdstart}$part $mntpoint chmod 777 $mntpoint -if ! su ${testuser} -c "cd $mntpoint; /tmp/linger $size"; then +if ! su $testuser -c "cd $mntpoint; /tmp/linger $size"; then min=2 [ -r $mntpoint/.sujournal ] && min=3 r=`df -hi $mntpoint | head -1` @@ -73,22 +73,25 @@ mdconfig -d -u $mdstart rm -f /tmp/linger exit EOF +#include +#include +#include +#include + #include #include #include #include #include #include -#include -#include -#include -#include +#include #include #define PARALLEL 10 +#define TIMEOUT 1200 static int size = 6552; /* 10 free inodes */ -int +static int test(void) { int fd, i, j; @@ -128,12 +131,14 @@ test(void) int main(void) { + time_t start; int error = 0, fd, i, j, status; umask(0); if ((fd = open("continue", O_CREAT, 0644)) == -1) err(1, "open()"); close(fd); + start = time(NULL); for (i = 0; i < 100; i++) { for (j = 0; j < PARALLEL; j++) { if (fork() == 0) { @@ -152,8 +157,10 @@ main(void) } unlink("rendezvous"); - if (access("continue", R_OK) == -1) { - fprintf(stderr, "Loop #%d\n", i + 1); + if (access("continue", R_OK) == -1) + break; + if (time(NULL) - start > TIMEOUT) { + fprintf(stderr, "FAIL Timeout\n"); break; } }