Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jan 2009 16:03:11 +0000 (UTC)
From:      Peter Holm <pho@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r187224 - in projects/stress2: . doc include lib misc testcases testcases/badcode testcases/creat testcases/fts testcases/link testcases/lockf testcases/lockf2 testcases/mkdir testcases...
Message-ID:  <200901141603.n0EG3BP0047461@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pho
Date: Wed Jan 14 16:03:10 2009
New Revision: 187224
URL: http://svn.freebsd.org/changeset/base/187224

Log:
  The Kernel Stress Test Suite has been added to projects.
  
  Approved by:	kib

Added:
  projects/stress2/
  projects/stress2/Makefile   (contents, props changed)
  projects/stress2/Makefile.gnu   (contents, props changed)
  projects/stress2/README   (contents, props changed)
  projects/stress2/all.cfg   (contents, props changed)
  projects/stress2/beaver1.sentex.ca   (contents, props changed)
  projects/stress2/creat.cfg   (contents, props changed)
  projects/stress2/default.cfg   (contents, props changed)
  projects/stress2/df.cfg   (contents, props changed)
  projects/stress2/disk.cfg   (contents, props changed)
  projects/stress2/doc/
  projects/stress2/doc/README   (contents, props changed)
  projects/stress2/doc/linuxforum06.pdf   (contents, props changed)
  projects/stress2/doc/stress.pdf   (contents, props changed)
  projects/stress2/hydra1.netperf.freebsd.org   (contents, props changed)
  projects/stress2/hydra2.netperf.freebsd.org   (contents, props changed)
  projects/stress2/include/
  projects/stress2/include/stress.h   (contents, props changed)
  projects/stress2/io.cfg   (contents, props changed)
  projects/stress2/jeff.cfg   (contents, props changed)
  projects/stress2/lib/
  projects/stress2/lib/Makefile   (contents, props changed)
  projects/stress2/lib/main.c   (contents, props changed)
  projects/stress2/lib/options.c   (contents, props changed)
  projects/stress2/lib/random_int.c   (contents, props changed)
  projects/stress2/lib/resources.c   (contents, props changed)
  projects/stress2/link.cfg   (contents, props changed)
  projects/stress2/load.cfg   (contents, props changed)
  projects/stress2/lockf.cfg   (contents, props changed)
  projects/stress2/misc/
  projects/stress2/misc/README   (contents, props changed)
  projects/stress2/misc/all.sh   (contents, props changed)
  projects/stress2/misc/altbufferflushes.sh   (contents, props changed)
  projects/stress2/misc/alternativeFlushPath.sh   (contents, props changed)
  projects/stress2/misc/backingstore.sh   (contents, props changed)
  projects/stress2/misc/cdevsw.sh   (contents, props changed)
  projects/stress2/misc/cleanup.sh   (contents, props changed)
  projects/stress2/misc/core.sh   (contents, props changed)
  projects/stress2/misc/crossmp.sh   (contents, props changed)
  projects/stress2/misc/crossmp2.sh   (contents, props changed)
  projects/stress2/misc/devfs.sh   (contents, props changed)
  projects/stress2/misc/devfs2.sh   (contents, props changed)
  projects/stress2/misc/extattrctl.sh   (contents, props changed)
  projects/stress2/misc/fdescfs.sh   (contents, props changed)
  projects/stress2/misc/fpclone.sh   (contents, props changed)
  projects/stress2/misc/fpclone2.sh   (contents, props changed)
  projects/stress2/misc/fs.sh   (contents, props changed)
  projects/stress2/misc/fullpath.sh   (contents, props changed)
  projects/stress2/misc/fuzz.sh   (contents, props changed)
  projects/stress2/misc/inversion.sh   (contents, props changed)
  projects/stress2/misc/isofs.sh   (contents, props changed)
  projects/stress2/misc/jail.sh   (contents, props changed)
  projects/stress2/misc/kevent.sh   (contents, props changed)
  projects/stress2/misc/kevent2.sh   (contents, props changed)
  projects/stress2/misc/kevent3.sh   (contents, props changed)
  projects/stress2/misc/kevent4.sh   (contents, props changed)
  projects/stress2/misc/kevent5.sh   (contents, props changed)
  projects/stress2/misc/kinfo.sh   (contents, props changed)
  projects/stress2/misc/kinfo2.sh   (contents, props changed)
  projects/stress2/misc/kinfo3.sh   (contents, props changed)
  projects/stress2/misc/libMicro.sh   (contents, props changed)
  projects/stress2/misc/lockf.sh   (contents, props changed)
  projects/stress2/misc/lookup_shared.sh   (contents, props changed)
  projects/stress2/misc/mac.sh   (contents, props changed)
  projects/stress2/misc/mac_chkexec.sh   (contents, props changed)
  projects/stress2/misc/md.sh   (contents, props changed)
  projects/stress2/misc/md2.sh   (contents, props changed)
  projects/stress2/misc/mmap.sh   (contents, props changed)
  projects/stress2/misc/mount.sh   (contents, props changed)
  projects/stress2/misc/mount2.sh   (contents, props changed)
  projects/stress2/misc/mountro.sh   (contents, props changed)
  projects/stress2/misc/mountro2.sh   (contents, props changed)
  projects/stress2/misc/mountro3.sh   (contents, props changed)
  projects/stress2/misc/msdos.sh   (contents, props changed)
  projects/stress2/misc/newfs.sh   (contents, props changed)
  projects/stress2/misc/newfs2.sh   (contents, props changed)
  projects/stress2/misc/newfs3.sh   (contents, props changed)
  projects/stress2/misc/newfs4.sh   (contents, props changed)
  projects/stress2/misc/nfs.sh   (contents, props changed)
  projects/stress2/misc/nfs2.sh   (contents, props changed)
  projects/stress2/misc/nfs3.sh   (contents, props changed)
  projects/stress2/misc/nfs4.sh   (contents, props changed)
  projects/stress2/misc/nfs5.sh   (contents, props changed)
  projects/stress2/misc/nfs6.sh   (contents, props changed)
  projects/stress2/misc/nfsrename.sh   (contents, props changed)
  projects/stress2/misc/nullfs.sh   (contents, props changed)
  projects/stress2/misc/procfs.sh   (contents, props changed)
  projects/stress2/misc/pthread.sh   (contents, props changed)
  projects/stress2/misc/quota1.sh   (contents, props changed)
  projects/stress2/misc/quota10.sh   (contents, props changed)
  projects/stress2/misc/quota2.sh   (contents, props changed)
  projects/stress2/misc/quota3.sh   (contents, props changed)
  projects/stress2/misc/quota4.sh   (contents, props changed)
  projects/stress2/misc/quota5.sh   (contents, props changed)
  projects/stress2/misc/quota6.sh   (contents, props changed)
  projects/stress2/misc/quota7.sh   (contents, props changed)
  projects/stress2/misc/quota8.sh   (contents, props changed)
  projects/stress2/misc/quota9.sh   (contents, props changed)
  projects/stress2/misc/recursiveflushes.sh   (contents, props changed)
  projects/stress2/misc/revoke.sh   (contents, props changed)
  projects/stress2/misc/sem.sh   (contents, props changed)
  projects/stress2/misc/snap.sh   (contents, props changed)
  projects/stress2/misc/snap2-1.sh   (contents, props changed)
  projects/stress2/misc/snap2.sh   (contents, props changed)
  projects/stress2/misc/snap3.sh   (contents, props changed)
  projects/stress2/misc/snap4.sh   (contents, props changed)
  projects/stress2/misc/snap5-1.sh   (contents, props changed)
  projects/stress2/misc/snap5.sh   (contents, props changed)
  projects/stress2/misc/snap6.sh   (contents, props changed)
  projects/stress2/misc/snap7.sh   (contents, props changed)
  projects/stress2/misc/snapbackup.sh   (contents, props changed)
  projects/stress2/misc/softupdate.sh   (contents, props changed)
  projects/stress2/misc/statfs.sh   (contents, props changed)
  projects/stress2/misc/symlink.sh   (contents, props changed)
  projects/stress2/misc/symlink2.sh   (contents, props changed)
  projects/stress2/misc/syscall.sh   (contents, props changed)
  projects/stress2/misc/syscall2.sh   (contents, props changed)
  projects/stress2/misc/ucom.sh   (contents, props changed)
  projects/stress2/misc/umount.sh   (contents, props changed)
  projects/stress2/misc/umountf.sh   (contents, props changed)
  projects/stress2/misc/umountf2.sh   (contents, props changed)
  projects/stress2/misc/umountf3.sh   (contents, props changed)
  projects/stress2/misc/umountf4.sh   (contents, props changed)
  projects/stress2/misc/unionfs.sh   (contents, props changed)
  projects/stress2/misc/unionfs2.sh   (contents, props changed)
  projects/stress2/misc/unionfs3.sh   (contents, props changed)
  projects/stress2/mkdir.cfg   (contents, props changed)
  projects/stress2/mkfifo.cfg   (contents, props changed)
  projects/stress2/norw.cfg   (contents, props changed)
  projects/stress2/noswap.cfg   (contents, props changed)
  projects/stress2/orangutan.netperf.freebsd.org   (contents, props changed)
  projects/stress2/pty.cfg   (contents, props changed)
  projects/stress2/run.sh   (contents, props changed)
  projects/stress2/rw.cfg   (contents, props changed)
  projects/stress2/syscall.cfg   (contents, props changed)
  projects/stress2/sysctl.cfg   (contents, props changed)
  projects/stress2/testcases/
  projects/stress2/testcases/Makefile   (contents, props changed)
  projects/stress2/testcases/Makefile.inc   (contents, props changed)
  projects/stress2/testcases/README   (contents, props changed)
  projects/stress2/testcases/badcode/
  projects/stress2/testcases/badcode/Makefile   (contents, props changed)
  projects/stress2/testcases/badcode/badcode.c   (contents, props changed)
  projects/stress2/testcases/creat/
  projects/stress2/testcases/creat/Makefile   (contents, props changed)
  projects/stress2/testcases/creat/creat.c   (contents, props changed)
  projects/stress2/testcases/fts/
  projects/stress2/testcases/fts/Makefile   (contents, props changed)
  projects/stress2/testcases/fts/fts.c   (contents, props changed)
  projects/stress2/testcases/link/
  projects/stress2/testcases/link/Makefile   (contents, props changed)
  projects/stress2/testcases/link/link.c   (contents, props changed)
  projects/stress2/testcases/lockf/
  projects/stress2/testcases/lockf/Makefile   (contents, props changed)
  projects/stress2/testcases/lockf/lockf.c   (contents, props changed)
  projects/stress2/testcases/lockf2/
  projects/stress2/testcases/lockf2/Makefile   (contents, props changed)
  projects/stress2/testcases/lockf2/lockf2.c   (contents, props changed)
  projects/stress2/testcases/mkdir/
  projects/stress2/testcases/mkdir/Makefile   (contents, props changed)
  projects/stress2/testcases/mkdir/mkdir.c   (contents, props changed)
  projects/stress2/testcases/mkfifo/
  projects/stress2/testcases/mkfifo/Makefile   (contents, props changed)
  projects/stress2/testcases/mkfifo/mkfifo.c   (contents, props changed)
  projects/stress2/testcases/mmap/
  projects/stress2/testcases/mmap/Makefile   (contents, props changed)
  projects/stress2/testcases/mmap/mmap.c   (contents, props changed)
  projects/stress2/testcases/openat/
  projects/stress2/testcases/openat/Makefile   (contents, props changed)
  projects/stress2/testcases/openat/doat.c   (contents, props changed)
  projects/stress2/testcases/openat/openat.c   (contents, props changed)
  projects/stress2/testcases/pty/
  projects/stress2/testcases/pty/Makefile   (contents, props changed)
  projects/stress2/testcases/pty/pty.c   (contents, props changed)
  projects/stress2/testcases/rename/
  projects/stress2/testcases/rename/Makefile   (contents, props changed)
  projects/stress2/testcases/rename/rename.c   (contents, props changed)
  projects/stress2/testcases/run/
  projects/stress2/testcases/run/Makefile   (contents, props changed)
  projects/stress2/testcases/run/run.c   (contents, props changed)
  projects/stress2/testcases/rw/
  projects/stress2/testcases/rw/Makefile   (contents, props changed)
  projects/stress2/testcases/rw/rw.c   (contents, props changed)
  projects/stress2/testcases/shm/
  projects/stress2/testcases/shm/Makefile   (contents, props changed)
  projects/stress2/testcases/shm/shm.c   (contents, props changed)
  projects/stress2/testcases/socket/
  projects/stress2/testcases/socket/Makefile   (contents, props changed)
  projects/stress2/testcases/socket/socket.c   (contents, props changed)
  projects/stress2/testcases/swap/
  projects/stress2/testcases/swap/Makefile   (contents, props changed)
  projects/stress2/testcases/swap/swap.c   (contents, props changed)
  projects/stress2/testcases/symlink/
  projects/stress2/testcases/symlink/Makefile   (contents, props changed)
  projects/stress2/testcases/symlink/symlink.c   (contents, props changed)
  projects/stress2/testcases/syscall/
  projects/stress2/testcases/syscall/Makefile   (contents, props changed)
  projects/stress2/testcases/syscall/syscall.c   (contents, props changed)
  projects/stress2/testcases/sysctl/
  projects/stress2/testcases/sysctl/Makefile   (contents, props changed)
  projects/stress2/testcases/sysctl/sysctl.c   (contents, props changed)
  projects/stress2/testcases/tcp/
  projects/stress2/testcases/tcp/Makefile   (contents, props changed)
  projects/stress2/testcases/tcp/tcp.c   (contents, props changed)
  projects/stress2/testcases/thr1/
  projects/stress2/testcases/thr1/Makefile   (contents, props changed)
  projects/stress2/testcases/thr1/thr1.c   (contents, props changed)
  projects/stress2/testcases/thr2/
  projects/stress2/testcases/thr2/Makefile   (contents, props changed)
  projects/stress2/testcases/thr2/thr2.c   (contents, props changed)
  projects/stress2/testcases/udp/
  projects/stress2/testcases/udp/Makefile   (contents, props changed)
  projects/stress2/testcases/udp/udp.c   (contents, props changed)
  projects/stress2/tools/
  projects/stress2/tools/df.sh   (contents, props changed)
  projects/stress2/tools/freeze.sh   (contents, props changed)
  projects/stress2/tools/freeze2.sh   (contents, props changed)
  projects/stress2/tools/fstool.c   (contents, props changed)
  projects/stress2/tools/iwatch.sh   (contents, props changed)
  projects/stress2/tools/l3.sh   (contents, props changed)
  projects/stress2/tools/leaks.sh   (contents, props changed)
  projects/stress2/tools/leaks2.sh   (contents, props changed)
  projects/stress2/tools/module/
  projects/stress2/tools/module/Makefile   (contents, props changed)
  projects/stress2/tools/module/ptest.c   (contents, props changed)
  projects/stress2/tools/monitor.sh   (contents, props changed)
  projects/stress2/tools/ptsleak.sh   (contents, props changed)
  projects/stress2/tools/ptyleak.sh   (contents, props changed)
  projects/stress2/tools/rwatch.sh   (contents, props changed)
  projects/stress2/udp.cfg   (contents, props changed)
  projects/stress2/vfs.cfg   (contents, props changed)

Added: projects/stress2/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/Makefile	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+SUBDIR= lib testcases
+
+.include <bsd.subdir.mk>

Added: projects/stress2/Makefile.gnu
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/Makefile.gnu	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,28 @@
+#MAKE=gmake
+
+# Gnu Makefile by "Brad Knotwell" <bknotwell@yahoo.com>
+
+LIBOBJS=$(subst .c,.o,$(wildcard lib/*.c))
+TESTDIRS=run swap mkdir creat thr1 syscall rw sysctl tcp udp
+EXES=$(foreach dir,$(TESTDIRS),testcases/$(dir)/$(dir).test)
+OBJS=$(subst .test,.o,$(EXES)) 
+SRCS=$(subst .o,.c,$(OBJS))
+LIBS=./lib/libstress.a
+CFLAGS=-g -Wall -I./include
+
+all: $(EXES)
+
+lib/libstress.a: lib/libstress.a($(LIBOBJS))
+	ranlib lib/libstress.a
+
+lib/libstress.a(*.o): $(LIBOBJS)
+
+$(OBJS): %.o: %.c
+
+$(EXES): %.test: %.o lib/libstress.a
+
+%.test: %.o
+	$(CC) $(CFLAGS) $(LIBS) $< -o $@
+
+clean:
+	rm -fr $(LIBOBJS) lib/libstress.a $(EXES) $(OBJS)

Added: projects/stress2/README
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/README	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,39 @@
+$FreeBSD$
+
+This is the FreeBSD kernel stress test suite. The purpose is to crash the
+computer, by stressing selected parts of the kernel, thus exposing inadequate
+error handling.
+
+Do not run the syscall test as root.
+
+To build and use:
+
+make
+sh ./run.sh
+
+The "run.sh" script accepts an optional configuration file in order to test specific areas.
+For example:
+
+./run.sh vfs.sh
+
+
+To run all of the different test scenarios type:
+
+./run.sh -a
+
+You may have to tune the stress test to make sure that your test box run low
+on resources.  For example:
+
+INCARNATIONS=125 ./run.sh
+
+The following sub-directories exists:
+
+./doc		Documentation
+./include	Include file for building the test programs in ./testcases
+./lib		Common support files for the test programs
+./misc		Various test scenarios. Mostly regression tests
+./testcases	Test programs
+./tools		Supplementary tools used in stress testing
+
+The name stress2 indicates that this is the second generation of the Kernel Stress Test Suite.
+The first version (stress) was based mostly on scripts.

Added: projects/stress2/all.cfg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/all.cfg	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+# Stress Test Suite Configuration: run all test programs
+
+# Default values
+. ./default.cfg
+
+export TESTPROGS=""

Added: projects/stress2/beaver1.sentex.ca
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/beaver1.sentex.ca	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+# Configuration needed for the beaver1 test box
+
+export RUNDIR=/usr/tmp/stressX
+TZ=Europe/Copenhagen; export TZ
+
+###export BLASTHOST=192.168.5.105	# orangutan
+export BLASTHOST=127.0.0.1	# 
+
+export DISKIMAGE=/usr/tmp/diskimage	# Location of 1G disk image
+export MNTPOINT=/mnt		# Disk image mount point
+export TESTUSER=test		# Name of non root test user
+###export MDSTART=5		# Start of free md units
+###INCARNATIONS=125

Added: projects/stress2/creat.cfg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/creat.cfg	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+# Stress Test Suite Configuration
+
+# Default values
+. ./default.cfg
+
+export TESTPROGS="testcases/creat/creat"
+export creatNODELAY=1
+export creatLOAD=100

Added: projects/stress2/default.cfg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/default.cfg	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,76 @@
+# $FreeBSD$
+
+# Stress Test Suite Configuration
+
+# Default values
+export RUNDIR=${RUNDIR:-/tmp/stressX}
+export RUNTIME=${RUNTIME:-2m}
+export VERBOSE=${VERBOSE:-1}
+export LOAD=20
+
+# The INCARNATIONS variable should be set to match the number of CPUs and
+# the amount of RAM in the test box.
+# 10  for a 1,8 GHz Celeron with 256 Mb of RAM
+# 100 for a dual Xeon 1,8 GHz with 1024 Gb of RAM
+
+export INCARNATIONS=${INCARNATIONS:-20}
+
+# Change hostname!
+#export BLASTHOST=192.168.1.2	# host with udp disacard enabled in inetd.conf
+export BLASTHOST=192.168.1.3	# host with udp disacard enabled in inetd.conf
+
+
+# Run all test cases:
+export runRUNTIME=${runRUNTIME:-3d}		# Run tests for three days
+export runINCARNATIONS=1
+export runLOAD=100
+
+export swapINCARNATIONS=$((2 * INCARNATIONS))
+export swapLOAD=80
+
+export syscallKILL=1
+
+export rwLOAD=70
+export mkdirLOAD=80
+export creatLOAD=80
+
+export symlinkLOAD=20
+
+export tcpKILL=1
+#export shmKILL=1
+export shmINCARNATIONS=5
+
+export TESTPROGS="
+testcases/rw/rw
+testcases/swap/swap
+testcases/creat/creat
+testcases/mkdir/mkdir
+testcases/thr1/thr1
+testcases/udp/udp
+testcases/tcp/tcp
+"
+
+[ -r default.cfg ] && ulimit -t 200	# Do not run this for the misc sub directory
+
+# 
+# Defaults for ./misc tests
+#
+
+diskimage=/var/tmp/diskimage	# Location of 1G disk image
+mntpoint=/mnt			# Disk image mount point
+testuser=pho			# Name of non root test user
+mdstart=5			# Start of free md units
+part=a				# partitition to use on a md FS
+
+# Wrapper for dd
+dede () {        # file, blocksize, count
+   local log=/tmp/$0.$$
+   dd if=/dev/zero of=$1 bs=$2 count=$3 > $log 2>&1
+   local status=$?
+   egrep -v "records in|records out|bytes transferred" $log
+   rm -f $log
+   return $status 
+}
+
+[ -r "./`hostname`" ] && . "./`hostname`"	# source in local configuration
+[ -r "../`hostname`" ] && . "../`hostname`"	# source in local configuration

Added: projects/stress2/df.cfg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/df.cfg	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+# Stress Test Suite Configuration
+
+# Default values
+. ./default.cfg
+###export creatVERBOSE=3	# Remove comments for test
+###export rwVERBOSE=3		# Remove comments for test
+
+# Only run these two test programs for VFS tests
+
+export TESTPROGS="testcases/creat/creat testcases/rw/rw"

Added: projects/stress2/disk.cfg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/disk.cfg	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+# Stress Test Suite Configuration
+
+# Default values
+. ./default.cfg
+
+export TESTPROGS="testcases/rw/rw testcases/creat/creat testcases/mkdir/mkdir"
+export rwNODELAY=1
+export rwLOAD=100

Added: projects/stress2/doc/README
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/doc/README	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,5 @@
+$FreeBSD$
+
+stress.pdf		An old (and out of date) document escribing the first
+			generation of the test suite.
+linuxforum06.pdf	The slides from a presentation at Linux Forum 2006

Added: projects/stress2/doc/linuxforum06.pdf
==============================================================================
Binary file. No diff available.

Added: projects/stress2/doc/stress.pdf
==============================================================================
Binary file. No diff available.

Added: projects/stress2/hydra1.netperf.freebsd.org
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/hydra1.netperf.freebsd.org	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+# Configuration needed for the hydra1 test box
+
+export RUNDIR=/var/tmp/stressX
+
+export BLASTHOST=192.168.5.105	# orangutan
+
+export DISKIMAGE=/var/tmp/diskimage	# Location of 1G disk image
+export MNTPOINT=/mnt		# Disk image mount point
+export TESTUSER=test		# Name of non root test user
+export MDSTART=5		# Start of free md units
+INCARNATIONS=150

Added: projects/stress2/hydra2.netperf.freebsd.org
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/hydra2.netperf.freebsd.org	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+# Configuration needed for the hydra1 test box
+
+export RUNDIR=/m2/stressX
+
+export BLASTHOST=192.168.5.105	# orangutan
+
+export DISKIMAGE=/m2/tmp/diskimage	# Location of 1G disk image
+export MNTPOINT=/mnt		# Disk image mount point
+export TESTUSER=test		# Name of non root test user
+export MDSTART=5		# Start of free md units
+INCARNATIONS=125

Added: projects/stress2/include/stress.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/include/stress.h	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,65 @@
+/*-
+ * Copyright (c) 2008 Peter Holm <pho@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _STRESS_H_
+#define _STRESS_H_
+extern int setup(int);
+extern int test(void);
+extern void cleanup(void);
+extern void options(int, char **);
+extern int random_int(int, int);
+/*extern void limits(void);*/
+
+typedef struct {
+	int argc;
+	char **argv;
+	int run_time;
+	int load;
+	char *wd;
+	char *cd;
+	int verbose;
+	int incarnations;
+	int hog;
+	int nodelay;
+	int kill;
+	int kblocks;
+	int inodes;
+} opt_t;
+
+extern opt_t *op;
+
+extern volatile int done_testing;
+extern char *home;
+extern void rmval(void);
+extern void putval(unsigned long);
+extern unsigned long getval(void);
+extern void getdf(int64_t *, int64_t *);
+extern void reservedf(int64_t, int64_t);
+extern int64_t swap(void);
+extern unsigned long usermem(void);
+#endif

Added: projects/stress2/io.cfg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/io.cfg	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+# Stress Test Suite Configuration
+
+# Default values
+. ./default.cfg
+
+# Only run these three test programs for VFS tests
+
+export TESTPROGS="testcases/swap/swap testcases/creat/creat testcases/mkdir/mkdir testcases/rw/rw"
+export swapLOAD=10

Added: projects/stress2/jeff.cfg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/jeff.cfg	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+# Stress Test Suite Configuration
+
+# Default values
+. ./default.cfg
+
+# Only run these two test programs for VFS tests
+
+export TESTPROGS="testcases/creat/creat testcases/mkdir/mkdir"

Added: projects/stress2/lib/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/lib/Makefile	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+LIB=stress
+SRCS=main.c options.c random_int.c resources.c
+
+.include "../testcases/Makefile.inc"
+
+.include <bsd.lib.mk>

Added: projects/stress2/lib/main.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/lib/main.c	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,206 @@
+/*-
+ * Copyright (c) 2008 Peter Holm <pho@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* Main program for all test programs */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <signal.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <err.h>
+#include <errno.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+
+#include "stress.h"
+
+static char const rcsid[] = "$Name:  $ $FreeBSD$";
+
+volatile int done_testing;
+static int cleanupcalled = 0;
+char *home;
+
+static	pid_t *r;
+
+void
+handler(int i)
+{
+	int j;
+
+	done_testing = 1;
+	for (j = 0; j < op->incarnations; j++) {
+		if (op->verbose > 2)
+			printf("handler: kill -HUP %d\n", r[j]);
+		if (r[j] != 0 && kill(r[j], SIGHUP) == -1)
+			if (errno != ESRCH)
+				warn("kill(%d, SIGHUP), %s:%d", r[j], __FILE__, __LINE__);
+	}
+	if (op->kill == 1) {
+		sleep(5);
+		/* test programs may have blocked for the SIGHUP, so try harder */
+		for (j = 0; j < op->incarnations; j++) {
+			if (op->verbose > 2)
+				printf("handler: kill -KILL %d\n", r[j]);
+			if (r[j] != 0)
+				(void) kill(r[j], SIGKILL);
+		}
+	}
+}
+
+void
+run_test_handler(int i)
+{
+
+	done_testing = 1;
+}
+
+void
+exit_handler(int i)
+{
+
+	exit(1);
+}
+
+void
+callcleanup(void)
+{
+	if (cleanupcalled == 0)
+		cleanup();
+	cleanupcalled = 1;
+}
+
+static void
+run_tests(int i)
+{
+	time_t start;
+
+	signal(SIGHUP, run_test_handler);
+	signal(SIGINT, exit_handler);
+	atexit(callcleanup);
+	arc4random_stir();
+	if ((strcmp(getprogname(), "run") != 0) && (op->nodelay == 0))
+		sleep(random_int(1,10));
+	setup(i);
+	start = time(NULL);
+	while (done_testing == 0 &&
+			(time(NULL) - start) < op->run_time) {
+		test();
+	}
+	callcleanup();
+	exit(EXIT_SUCCESS);
+}
+
+static void
+run_incarnations(void)
+{
+	int i;
+	int s;
+
+	signal(SIGHUP, handler);
+	for (i = 0; i < op->incarnations && done_testing == 0; i++) {
+		if ((r[i] = fork()) == 0) {
+			run_tests(i);
+		}
+		if (r[i] < 0) {
+			warn("fork(), %s:%d", __FILE__, __LINE__);
+			r[i] = 0;
+			break;
+		}
+	}
+	for (i = 0; i < op->incarnations; i++)
+		if (r[i] != 0 && waitpid(r[i], &s, 0) == -1)
+			warn("waitpid(%d), %s:%d", r[i], __FILE__, __LINE__);
+
+	exit(EXIT_SUCCESS);
+}
+
+static int
+run_test(void)
+{
+	pid_t p;
+	time_t start;
+	int status = 0;
+
+	if (random_int(1,100) > op->load)
+		return (status);
+
+	start = time(NULL);
+	done_testing = 0;
+	fflush(stdout);
+	rmval();
+	p = fork();
+	if (p == 0)
+		run_incarnations();
+	if (p < 0)
+		err(1, "fork() in %s:%d", __FILE__, __LINE__);
+	while (done_testing != 1 &&
+			(time(NULL) - start) < op->run_time)
+		sleep(1);
+	if (kill(p, SIGHUP) == -1)
+		warn("kill(%d, SIGHUP), %s:%d", p, __FILE__, __LINE__);
+
+	if (waitpid(p, &status, 0) == -1)
+		err(1, "waitpid(%d), %s:%d", p, __FILE__, __LINE__);
+
+	return (status);
+}
+
+int
+main(int argc, char **argv)
+{
+	struct stat sb;
+	int status = 0;
+
+	options(argc, argv);
+
+	umask(0);
+	if (stat(op->wd, &sb) == -1) {
+		if (mkdir(op->wd, 0770) == -1)
+			if (errno != EEXIST)
+				err(1, "mkdir(%s) %s:%d", op->wd, __FILE__, __LINE__);
+	}
+	if (stat(op->cd, &sb) == -1) {
+		if (mkdir(op->cd, 0770) == -1)
+			if (errno != EEXIST)
+				err(1, "mkdir(%s) %s:%d", op->cd, __FILE__, __LINE__);
+	}
+	if ((home = getcwd(NULL, 0)) == NULL)
+		err(1, "getcwd(), %s:%d",  __FILE__, __LINE__);
+	if (chdir(op->wd) == -1)
+		err(1, "chdir(%s) %s:%d", op->wd, __FILE__, __LINE__);
+
+	r = (pid_t *)calloc(1, op->incarnations * sizeof(pid_t));
+
+	status = run_test();
+
+	return (status);
+}

Added: projects/stress2/lib/options.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/lib/options.c	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,261 @@
+/*-
+ * Copyright (c) 2008 Peter Holm <pho@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sysexits.h>
+#include <string.h>
+#include <time.h>
+#include <err.h>
+
+#include "stress.h"
+
+opt_t opt;
+opt_t *op;
+
+static char path[64];
+
+static void
+usage(char *where)
+{
+	char *help;
+
+	if (where != NULL)
+		printf("Error in \"%s\"\n", where);
+	fprintf(stderr, "Usage: %s [-t | -l | -i | -d | -h | -k | -v]\n", getprogname());
+	help =  " t <number><s|m|h|d> : time to run test\n"
+		" l <pct>             : load factor 0 - 100%\n"
+		" i <number>          : max # of parallel incarnations\n"
+		" d <path>            : working directory\n"
+		" h                   : hog resources\n"
+		" k                   : terminate with SIGHUP + SIGKILL\n"
+		" n                   : no startup delay\n"
+		" v                   : verbose\n";
+	printf(help);
+	exit(EX_USAGE);
+}
+
+static int
+time2sec(const char *string)
+{
+	int r, s = 0;
+	char modifier;
+	r = sscanf(string, "%d%c", &s, &modifier);
+	if (r == 2)
+		switch(modifier) {
+		case 's': break;
+		case 'm': s = s * 60; break;
+		case 'h': s = s * 60 * 60; break;
+		case 'd': s = s * 60 * 60 * 24; break;
+		default:
+			usage("-t");
+		}
+	else
+		usage("-t");
+	return (s);
+}
+
+static char *gete(char *name)
+{
+	char *cp;
+	char help[128];
+
+	snprintf(help, sizeof(help), "%s%s", getprogname(), name);
+	cp = getenv(help);
+	if (cp == NULL)
+		cp = getenv(name);
+	return (cp);
+}
+
+static void
+environment(void)
+{
+	char *cp;
+
+	if ((cp = gete("INCARNATIONS")) != NULL) {
+		if (sscanf(cp, "%d", &op->incarnations) != 1)
+			usage("INCARNATIONS");
+	}
+	if ((cp = gete("LOAD")) != NULL) {
+		if (sscanf(cp, "%d", &op->load) != 1)
+			usage("LOAD");
+	}
+	if ((cp = gete("RUNTIME")) != NULL) {
+		op->run_time = time2sec(cp);
+	}
+	if ((cp = gete("RUNDIR")) != NULL) {
+		op->wd = cp;
+	}
+	if ((cp = gete("CTRLDIR")) != NULL) {
+		op->cd = cp;
+	}
+	if ((cp = gete("HOG")) != NULL) {
+		op->hog = 1;
+	}
+	if ((cp = gete("KILL")) != NULL) {
+		op->kill = 1;
+	}
+	if ((cp = gete("NODELAY")) != NULL) {
+		op->nodelay = 1;
+	}
+	if ((cp = gete("VERBOSE")) != NULL) {
+		if (sscanf(cp, "%d", &op->verbose) != 1)
+			usage("VERBOSE");
+	}
+	if ((cp = gete("KBLOCKS")) != NULL) {
+		if (sscanf(cp, "%d", &op->kblocks) != 1)
+			usage("KBLOCKS");
+	}
+	if ((cp = gete("INODES")) != NULL) {
+		if (sscanf(cp, "%d", &op->inodes) != 1)
+			usage("INODES");
+	}
+}
+	
+void
+options(int argc, char **argv)
+{
+	int ch;
+	int days;
+	time_t t;
+	char buf[80];
+
+	op = &opt;
+
+	op->run_time	= 60;
+	op->load	= 100;
+	op->wd		= "/tmp/stressX";
+	op->cd		= "/tmp/stressX.control";
+	op->incarnations	= 1;
+	op->hog		= 0;
+	op->kill	= 0;
+	op->nodelay	= 0;
+	op->verbose	= 0;
+	op->kblocks	= 0;
+	op->inodes	= 0;
+
+	environment();
+
+	while ((ch = getopt(argc, argv, "t:l:i:d:hknv")) != -1)
+		switch(ch) {
+		case 't':	/* run time */
+			op->run_time = time2sec(optarg);
+			break;
+		case 'l':	/* load factor in pct */
+			if (sscanf(optarg, "%d", &op->load) != 1)
+				usage("-l");
+			break;
+		case 'i':	/* max incarnations */
+			if (sscanf(optarg, "%d", &op->incarnations) != 1)
+				usage("-i");
+			break;
+		case 'd':	/* working directory */
+			op->wd = strdup(optarg);
+			break;
+		case 'h':	/* hog flag */
+			op->hog += 1;
+			break;
+		case 'k':	/* kill flag */
+			op->kill = 1;
+			break;
+		case 'n':	/* no delay flag */
+			op->nodelay = 1;
+			break;
+		case 'v':	/* verbose flag */
+			op->verbose += 1;
+			break;
+		default:
+			usage(NULL);
+		}
+	op->argc = argc -= optind;
+	op->argv = argv += optind;
+
+	if (op->incarnations < 1)
+		op->incarnations = 1;
+	if (op->hog == 0)
+		op->incarnations = random_int(1, op->incarnations);
+	if (op->run_time < 15)
+		op->run_time = 15;
+	if (op->load < 0 || op->load > 100)
+		op->load = 100;
+
+	if (op->verbose > 0) {
+		t = op->run_time;
+		days = t / (60 * 60 * 24);
+		t = t % (60 * 60 * 24);
+		strftime(buf, sizeof(buf), "%T", gmtime(&t));
+		printf("%8s: run time %2d+%s, incarnations %3d, load %3d, verbose %d\n",
+			getprogname(), days, buf, op->incarnations, op->load,
+			op->verbose);
+	}
+}
+
+
+void
+rmval(void)
+{
+	if (snprintf(path, sizeof(path), "%s/%s.conf", op->cd, getprogname()) < 0)
+		err(1, "snprintf path");
+	(void) unlink(path);
+}
+
+void
+putval(unsigned long v)
+{
+	char buf[64];
+
+	rmval();
+	snprintf(buf, sizeof(buf), "%lu", v);
+	if (symlink(buf, path) < 0)
+		err(1, "symlink(%s, %s)", path, buf);
+}
+
+unsigned long
+getval(void)
+{
+	int i, n;
+	unsigned long val;
+	char buf[64];
+
+	if ((n = readlink(path, buf, sizeof(buf) -1)) < 0) {
+		for (i = 0; i < 60; i++) {
+			sleep(1);
+			if ((n = readlink(path, buf, sizeof(buf) -1)) > 0)
+				break;
+		}
+		if (n < 0)
+			err(1, "readlink(%s). %s:%d", path, __FILE__, __LINE__);
+	}
+	buf[n] = '\0';
+	if (sscanf(buf, "%ld", &val) != 1)
+		err(1, "sscanf(%s)", buf);
+	return val;
+}

Added: projects/stress2/lib/random_int.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/lib/random_int.c	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,57 @@
+/*-
+ * Copyright (c) 2008 Peter Holm <pho@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdlib.h>
+
+int
+random_int(int mi, int ma)
+{
+	return (arc4random()  % (ma - mi + 1) + mi);
+}
+
+#ifdef TEST
+#include <stdio.h>
+int
+main()
+{
+	int i, j, min, max, r;
+	min = 100;
+	max = 1;
+	for (i = 0; i < 10000; i++) {
+		j += (r = random_int(1,100));
+		if (max < r)
+			max = r;
+		if (min > r)
+			min = r;
+	}
+	printf("Average is %d, min = %d, max = %d\n", j / 10000, min, max);
+	return (0);
+}
+#endif

Added: projects/stress2/lib/resources.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/stress2/lib/resources.c	Wed Jan 14 16:03:10 2009	(r187224)
@@ -0,0 +1,297 @@
+/*-
+ * Copyright (c) 2008 Peter Holm <pho@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/* Get various resource limits for the tests */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <kvm.h>
+#include <vm/vm_param.h>
+#include <errno.h>
+#include <err.h>
+#include <stdarg.h>
+#include <libutil.h>
+
+#include "stress.h"
+
+static int lockfd;
+static int dffd;
+static int flags;
+static char lockpath[128];
+static char dfpath[128];
+
+static int64_t
+inodes(void)
+{
+	char path[MAXPATHLEN+1];
+	struct statfs buf;
+
+	if (op->inodes != 0)
+		return (op->inodes);
+	if (getcwd(path, sizeof(path)) == NULL)
+		err(1, "getcwd()");
+
+	if (statfs(path, &buf) < 0)
+		err(1, "statfs(%s)", path);
+	if (!strcmp(buf.f_fstypename, "msdosfs"))
+			buf.f_ffree = 9999;
+	flags = buf.f_flags & MNT_VISFLAGMASK;
+	if (op->verbose > 2)
+		printf("Free inodes on %s (%s): %jd\n", path, buf.f_mntonname, buf.f_ffree);
+	return (buf.f_ffree);
+}
+
+static int64_t
+df(void)
+{
+	char path[MAXPATHLEN+1];
+	struct statfs buf;
+
+	if (op->kblocks != 0)
+		return (op->kblocks * (uint64_t)1024);
+
+	if (getcwd(path, sizeof(path)) == NULL)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901141603.n0EG3BP0047461>