From owner-svn-src-user@freebsd.org Tue May 16 11:27:20 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 20674D6F0E1 for ; Tue, 16 May 2017 11:27:20 +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 CE0FAA56; Tue, 16 May 2017 11:27:19 +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 v4GBRIMR080223; Tue, 16 May 2017 11:27:18 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4GBRITq080222; Tue, 16 May 2017 11:27:18 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201705161127.v4GBRITq080222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Tue, 16 May 2017 11:27:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r318349 - 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: Tue, 16 May 2017 11:27:20 -0000 Author: pho Date: Tue May 16 11:27:18 2017 New Revision: 318349 URL: https://svnweb.freebsd.org/changeset/base/318349 Log: Do not hard code the working directory to /tmp. Style and runtime fixes. Sponsored by: Dell EMC Isilon Modified: user/pho/stress2/misc/rot.sh Modified: user/pho/stress2/misc/rot.sh ============================================================================== --- user/pho/stress2/misc/rot.sh Tue May 16 11:24:05 2017 (r318348) +++ user/pho/stress2/misc/rot.sh Tue May 16 11:27:18 2017 (r318349) @@ -54,14 +54,14 @@ mount /dev/md${mdstart}$part $mntpoint chmod 777 $mntpoint (cd $mntpoint; /tmp/rot) -(cd /tmp; /tmp/rot) +(cd `dirname $diskimage`; /tmp/rot) while mount | grep $mntpoint | grep -q /dev/md; do umount $mntpoint || sleep 1 done mdconfig -d -u $mdstart rm -f /tmp/rot -exit +exit 0 EOF #include #include @@ -69,17 +69,19 @@ EOF #include #include #include +#include #include #define N 10240 /* 40 Mb */ #define PARALLEL 20 +#define RUNTIME (60 * 15) int test(void) { + int fd, i, j, s; unsigned char *buf; char path[128]; - int fd, i, j, s; s = getpagesize(); @@ -94,7 +96,8 @@ test(void) err(1, "write error"); for (i = 0; i < N; i++) { - if ((buf = mmap(0, s, PROT_READ | PROT_WRITE, MAP_SHARED, fd, i * s)) == MAP_FAILED) + if ((buf = mmap(0, s, PROT_READ | PROT_WRITE, MAP_SHARED, fd, + i * s)) == MAP_FAILED) err(1, "write map"); for (j = 0; j < s; j++) buf[j] = i % 256; @@ -106,7 +109,8 @@ test(void) if ((fd = open(path, O_RDONLY)) < 0) err(1, "open(%s)", path); for (i = 0; i < N; i++) { - if ((buf = mmap(0, s, PROT_READ, MAP_SHARED, fd, i * s)) == MAP_FAILED) + if ((buf = mmap(0, s, PROT_READ, MAP_SHARED, fd, i * s)) == + MAP_FAILED) err(1, "write map"); for (j = 0; j < s; j++) if (buf[j] != i % 256) @@ -124,9 +128,11 @@ test(void) int main(void) { - int i, j; + time_t start; + int i; - for (j = 0; j < 50; j++) { + start = time(NULL); + while (time(NULL) - start < RUNTIME) { for (i = 0; i < PARALLEL; i++) if (fork() == 0) test();