Date: Sat, 10 Jun 2017 06:28:41 +0000 (UTC) From: Peter Holm <pho@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r319770 - user/pho/stress2/misc Message-ID: <201706100628.v5A6SfZI014787@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <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 <time.h> #include <unistd.h> #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; } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706100628.v5A6SfZI014787>