From owner-svn-soc-all@FreeBSD.ORG Wed Jul 13 22:42:38 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 546DE106564A for ; Wed, 13 Jul 2011 22:42:36 +0000 (UTC) (envelope-from shm@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 13 Jul 2011 22:42:36 +0000 Date: Wed, 13 Jul 2011 22:42:36 +0000 From: shm@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110713224236.546DE106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r224192 - in soc2011/shm: TESLA/assertions/strawman TESLA/libtesla TESLA/strawman mac_test stress2 stress2/include stress2/lib stress2/misc stress2/testcases stress2/testcases/badcod... X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2011 22:42:38 -0000 Author: shm Date: Wed Jul 13 22:42:35 2011 New Revision: 224192 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=224192 Log: * the great merge: 2.5/3 Added: soc2011/shm/TESLA/assertions/strawman/ - copied from r223430, soc2011/shm/TESLA/strawman/ soc2011/shm/stress2/ soc2011/shm/stress2/Makefile soc2011/shm/stress2/Makefile.gnu soc2011/shm/stress2/README soc2011/shm/stress2/all.cfg soc2011/shm/stress2/beaver1.sentex.ca soc2011/shm/stress2/creat.cfg soc2011/shm/stress2/default.cfg soc2011/shm/stress2/df.cfg soc2011/shm/stress2/disk.cfg soc2011/shm/stress2/hydra1.netperf.freebsd.org soc2011/shm/stress2/hydra2.netperf.freebsd.org soc2011/shm/stress2/include/ soc2011/shm/stress2/include/stress.h soc2011/shm/stress2/io.cfg soc2011/shm/stress2/jeff.cfg soc2011/shm/stress2/lib/ soc2011/shm/stress2/lib/Makefile soc2011/shm/stress2/lib/main.c soc2011/shm/stress2/lib/options.c soc2011/shm/stress2/lib/random_int.c soc2011/shm/stress2/lib/resources.c soc2011/shm/stress2/link.cfg soc2011/shm/stress2/load.cfg soc2011/shm/stress2/lockf.cfg soc2011/shm/stress2/marcus.cfg soc2011/shm/stress2/misc/ soc2011/shm/stress2/misc/README soc2011/shm/stress2/misc/all.sh (contents, props changed) soc2011/shm/stress2/misc/altbufferflushes.sh (contents, props changed) soc2011/shm/stress2/misc/alternativeFlushPath.sh (contents, props changed) soc2011/shm/stress2/misc/backingstore.sh (contents, props changed) soc2011/shm/stress2/misc/backingstore2.sh (contents, props changed) soc2011/shm/stress2/misc/backingstore3.sh (contents, props changed) soc2011/shm/stress2/misc/cleanup.sh (contents, props changed) soc2011/shm/stress2/misc/core.sh (contents, props changed) soc2011/shm/stress2/misc/crossmp.sh (contents, props changed) soc2011/shm/stress2/misc/crossmp2.sh (contents, props changed) soc2011/shm/stress2/misc/datamove.sh (contents, props changed) soc2011/shm/stress2/misc/datamove2.sh (contents, props changed) soc2011/shm/stress2/misc/datamove3.sh (contents, props changed) soc2011/shm/stress2/misc/devfs.sh (contents, props changed) soc2011/shm/stress2/misc/devfs2.sh (contents, props changed) soc2011/shm/stress2/misc/extattr.sh (contents, props changed) soc2011/shm/stress2/misc/extattrctl.sh (contents, props changed) soc2011/shm/stress2/misc/fdescfs.sh (contents, props changed) soc2011/shm/stress2/misc/fpclone.sh (contents, props changed) soc2011/shm/stress2/misc/fpclone2.sh (contents, props changed) soc2011/shm/stress2/misc/fpu.sh (contents, props changed) soc2011/shm/stress2/misc/fragments.sh (contents, props changed) soc2011/shm/stress2/misc/fs.sh (contents, props changed) soc2011/shm/stress2/misc/fullpath.sh (contents, props changed) soc2011/shm/stress2/misc/fuzz.sh (contents, props changed) soc2011/shm/stress2/misc/gjournal.sh (contents, props changed) soc2011/shm/stress2/misc/inversion.sh (contents, props changed) soc2011/shm/stress2/misc/isofs.sh (contents, props changed) soc2011/shm/stress2/misc/jail.sh (contents, props changed) soc2011/shm/stress2/misc/jail2.sh (contents, props changed) soc2011/shm/stress2/misc/jail3.sh (contents, props changed) soc2011/shm/stress2/misc/jail4.sh (contents, props changed) soc2011/shm/stress2/misc/kevent.sh (contents, props changed) soc2011/shm/stress2/misc/kevent2.sh (contents, props changed) soc2011/shm/stress2/misc/kevent3.sh (contents, props changed) soc2011/shm/stress2/misc/kevent4.sh (contents, props changed) soc2011/shm/stress2/misc/kevent5.sh (contents, props changed) soc2011/shm/stress2/misc/kinfo.sh (contents, props changed) soc2011/shm/stress2/misc/kinfo2.sh (contents, props changed) soc2011/shm/stress2/misc/kinfo3.sh (contents, props changed) soc2011/shm/stress2/misc/ldt.sh (contents, props changed) soc2011/shm/stress2/misc/ldt2.sh (contents, props changed) soc2011/shm/stress2/misc/libMicro.sh (contents, props changed) soc2011/shm/stress2/misc/linger.sh (contents, props changed) soc2011/shm/stress2/misc/linger2.sh (contents, props changed) soc2011/shm/stress2/misc/lockf.sh (contents, props changed) soc2011/shm/stress2/misc/lookup_shared.sh (contents, props changed) soc2011/shm/stress2/misc/mac.sh (contents, props changed) soc2011/shm/stress2/misc/mac_chkexec.sh (contents, props changed) soc2011/shm/stress2/misc/md.sh (contents, props changed) soc2011/shm/stress2/misc/md2.sh (contents, props changed) soc2011/shm/stress2/misc/md3.sh (contents, props changed) soc2011/shm/stress2/misc/mlockall.sh (contents, props changed) soc2011/shm/stress2/misc/mmap.sh (contents, props changed) soc2011/shm/stress2/misc/mmap2.sh (contents, props changed) soc2011/shm/stress2/misc/mmap3.sh (contents, props changed) soc2011/shm/stress2/misc/mmap4.sh (contents, props changed) soc2011/shm/stress2/misc/mount.sh (contents, props changed) soc2011/shm/stress2/misc/mount2.sh (contents, props changed) soc2011/shm/stress2/misc/mountro.sh (contents, props changed) soc2011/shm/stress2/misc/mountro2.sh (contents, props changed) soc2011/shm/stress2/misc/mountro3.sh (contents, props changed) soc2011/shm/stress2/misc/msdos.sh (contents, props changed) soc2011/shm/stress2/misc/msdos2.sh (contents, props changed) soc2011/shm/stress2/misc/msdos3.sh (contents, props changed) soc2011/shm/stress2/misc/msdos4.sh (contents, props changed) soc2011/shm/stress2/misc/namecache.sh (contents, props changed) soc2011/shm/stress2/misc/nbufkv.sh (contents, props changed) soc2011/shm/stress2/misc/newfs.sh (contents, props changed) soc2011/shm/stress2/misc/newfs2.sh (contents, props changed) soc2011/shm/stress2/misc/newfs3.sh (contents, props changed) soc2011/shm/stress2/misc/newfs4.sh (contents, props changed) soc2011/shm/stress2/misc/nfs.sh (contents, props changed) soc2011/shm/stress2/misc/nfs2.sh (contents, props changed) soc2011/shm/stress2/misc/nfs3.sh (contents, props changed) soc2011/shm/stress2/misc/nfs4.sh (contents, props changed) soc2011/shm/stress2/misc/nfs5.sh (contents, props changed) soc2011/shm/stress2/misc/nfs6.sh (contents, props changed) soc2011/shm/stress2/misc/nfs7.sh (contents, props changed) soc2011/shm/stress2/misc/nfs8.sh (contents, props changed) soc2011/shm/stress2/misc/nfs9.sh (contents, props changed) soc2011/shm/stress2/misc/nfsrename.sh (contents, props changed) soc2011/shm/stress2/misc/nullfs.sh (contents, props changed) soc2011/shm/stress2/misc/nullfs2.sh (contents, props changed) soc2011/shm/stress2/misc/nullfs3.sh (contents, props changed) soc2011/shm/stress2/misc/nullfs4.sh (contents, props changed) soc2011/shm/stress2/misc/nullfs5.sh (contents, props changed) soc2011/shm/stress2/misc/nullfs6.sh (contents, props changed) soc2011/shm/stress2/misc/pmc.sh (contents, props changed) soc2011/shm/stress2/misc/procfs.sh (contents, props changed) soc2011/shm/stress2/misc/procfs2.sh (contents, props changed) soc2011/shm/stress2/misc/pthread.sh (contents, props changed) soc2011/shm/stress2/misc/quota1.sh (contents, props changed) soc2011/shm/stress2/misc/quota10.sh (contents, props changed) soc2011/shm/stress2/misc/quota2.sh (contents, props changed) soc2011/shm/stress2/misc/quota3.sh (contents, props changed) soc2011/shm/stress2/misc/quota4.sh (contents, props changed) soc2011/shm/stress2/misc/quota5.sh (contents, props changed) soc2011/shm/stress2/misc/quota6.sh (contents, props changed) soc2011/shm/stress2/misc/quota7.sh (contents, props changed) soc2011/shm/stress2/misc/quota8.sh (contents, props changed) soc2011/shm/stress2/misc/quota9.sh (contents, props changed) soc2011/shm/stress2/misc/recursiveflushes.sh (contents, props changed) soc2011/shm/stress2/misc/rename.sh (contents, props changed) soc2011/shm/stress2/misc/rename2.sh (contents, props changed) soc2011/shm/stress2/misc/rename3.sh (contents, props changed) soc2011/shm/stress2/misc/rename4.sh (contents, props changed) soc2011/shm/stress2/misc/revoke.sh (contents, props changed) soc2011/shm/stress2/misc/sem.sh (contents, props changed) soc2011/shm/stress2/misc/sendfile.sh (contents, props changed) soc2011/shm/stress2/misc/snap.sh (contents, props changed) soc2011/shm/stress2/misc/snap2-1.sh (contents, props changed) soc2011/shm/stress2/misc/snap2.sh (contents, props changed) soc2011/shm/stress2/misc/snap3.sh (contents, props changed) soc2011/shm/stress2/misc/snap4.sh (contents, props changed) soc2011/shm/stress2/misc/snap5-1.sh (contents, props changed) soc2011/shm/stress2/misc/snap5.sh (contents, props changed) soc2011/shm/stress2/misc/snap6.sh (contents, props changed) soc2011/shm/stress2/misc/snap7.sh (contents, props changed) soc2011/shm/stress2/misc/snap8.sh (contents, props changed) soc2011/shm/stress2/misc/snapbackup.sh (contents, props changed) soc2011/shm/stress2/misc/softupdate.sh (contents, props changed) soc2011/shm/stress2/misc/statfs.sh (contents, props changed) soc2011/shm/stress2/misc/suj.sh (contents, props changed) soc2011/shm/stress2/misc/suj10.sh (contents, props changed) soc2011/shm/stress2/misc/suj11.sh (contents, props changed) soc2011/shm/stress2/misc/suj12.sh (contents, props changed) soc2011/shm/stress2/misc/suj13.sh (contents, props changed) soc2011/shm/stress2/misc/suj14.sh (contents, props changed) soc2011/shm/stress2/misc/suj15.sh (contents, props changed) soc2011/shm/stress2/misc/suj16.sh (contents, props changed) soc2011/shm/stress2/misc/suj17.sh (contents, props changed) soc2011/shm/stress2/misc/suj19.sh (contents, props changed) soc2011/shm/stress2/misc/suj2.sh (contents, props changed) soc2011/shm/stress2/misc/suj20.sh (contents, props changed) soc2011/shm/stress2/misc/suj21.sh (contents, props changed) soc2011/shm/stress2/misc/suj22.sh (contents, props changed) soc2011/shm/stress2/misc/suj3.sh (contents, props changed) soc2011/shm/stress2/misc/suj4.sh (contents, props changed) soc2011/shm/stress2/misc/suj5.sh (contents, props changed) soc2011/shm/stress2/misc/suj6.sh (contents, props changed) soc2011/shm/stress2/misc/suj7.sh (contents, props changed) soc2011/shm/stress2/misc/suj8.sh (contents, props changed) soc2011/shm/stress2/misc/suj9.sh (contents, props changed) soc2011/shm/stress2/misc/symlink.sh (contents, props changed) soc2011/shm/stress2/misc/symlink2.sh (contents, props changed) soc2011/shm/stress2/misc/syscall.sh (contents, props changed) soc2011/shm/stress2/misc/syscall2.sh (contents, props changed) soc2011/shm/stress2/misc/tmpfs.sh (contents, props changed) soc2011/shm/stress2/misc/tmpfs2.sh (contents, props changed) soc2011/shm/stress2/misc/tmpfs3.sh (contents, props changed) soc2011/shm/stress2/misc/tmpfs4.sh (contents, props changed) soc2011/shm/stress2/misc/trim.sh (contents, props changed) soc2011/shm/stress2/misc/trim2.sh (contents, props changed) soc2011/shm/stress2/misc/trim3.sh (contents, props changed) soc2011/shm/stress2/misc/trim4.sh (contents, props changed) soc2011/shm/stress2/misc/truncate.sh (contents, props changed) soc2011/shm/stress2/misc/truncate2.sh (contents, props changed) soc2011/shm/stress2/misc/truncate3.sh (contents, props changed) soc2011/shm/stress2/misc/truncate4.sh (contents, props changed) soc2011/shm/stress2/misc/truncate5.sh (contents, props changed) soc2011/shm/stress2/misc/ucom.sh (contents, props changed) soc2011/shm/stress2/misc/umount.sh (contents, props changed) soc2011/shm/stress2/misc/umountf.sh (contents, props changed) soc2011/shm/stress2/misc/umountf2.sh (contents, props changed) soc2011/shm/stress2/misc/umountf3.sh (contents, props changed) soc2011/shm/stress2/misc/umountf4.sh (contents, props changed) soc2011/shm/stress2/misc/union.sh (contents, props changed) soc2011/shm/stress2/misc/unionfs.sh (contents, props changed) soc2011/shm/stress2/misc/unionfs2.sh (contents, props changed) soc2011/shm/stress2/misc/unionfs3.sh (contents, props changed) soc2011/shm/stress2/misc/vunref.sh (contents, props changed) soc2011/shm/stress2/misc/vunref2.sh (contents, props changed) soc2011/shm/stress2/misc/zfs.sh (contents, props changed) soc2011/shm/stress2/misc/zfs2.sh (contents, props changed) soc2011/shm/stress2/misc/zfs3.sh (contents, props changed) soc2011/shm/stress2/misc/zfs4.sh (contents, props changed) soc2011/shm/stress2/misc/zfs5.sh (contents, props changed) soc2011/shm/stress2/mkdir.cfg soc2011/shm/stress2/mkfifo.cfg soc2011/shm/stress2/norw.cfg soc2011/shm/stress2/noswap.cfg soc2011/shm/stress2/orangutan.netperf.freebsd.org soc2011/shm/stress2/pty.cfg soc2011/shm/stress2/run.sh (contents, props changed) soc2011/shm/stress2/rw.cfg soc2011/shm/stress2/syscall.cfg soc2011/shm/stress2/sysctl.cfg soc2011/shm/stress2/testcases/ soc2011/shm/stress2/testcases/Makefile soc2011/shm/stress2/testcases/Makefile.inc soc2011/shm/stress2/testcases/README soc2011/shm/stress2/testcases/badcode/ soc2011/shm/stress2/testcases/badcode/Makefile soc2011/shm/stress2/testcases/badcode/badcode.c soc2011/shm/stress2/testcases/creat/ soc2011/shm/stress2/testcases/creat/Makefile soc2011/shm/stress2/testcases/creat/creat.c soc2011/shm/stress2/testcases/fts/ soc2011/shm/stress2/testcases/fts/Makefile soc2011/shm/stress2/testcases/fts/fts.c soc2011/shm/stress2/testcases/link/ soc2011/shm/stress2/testcases/link/Makefile soc2011/shm/stress2/testcases/link/link.c soc2011/shm/stress2/testcases/lockf/ soc2011/shm/stress2/testcases/lockf/Makefile soc2011/shm/stress2/testcases/lockf/lockf.c soc2011/shm/stress2/testcases/lockf2/ soc2011/shm/stress2/testcases/lockf2/Makefile soc2011/shm/stress2/testcases/lockf2/lockf2.c soc2011/shm/stress2/testcases/mkdir/ soc2011/shm/stress2/testcases/mkdir/Makefile soc2011/shm/stress2/testcases/mkdir/mkdir.c soc2011/shm/stress2/testcases/mkfifo/ soc2011/shm/stress2/testcases/mkfifo/Makefile soc2011/shm/stress2/testcases/mkfifo/mkfifo.c soc2011/shm/stress2/testcases/mmap/ soc2011/shm/stress2/testcases/mmap/Makefile soc2011/shm/stress2/testcases/mmap/mmap.c soc2011/shm/stress2/testcases/openat/ soc2011/shm/stress2/testcases/openat/Makefile soc2011/shm/stress2/testcases/openat/doat.c soc2011/shm/stress2/testcases/openat/openat.c soc2011/shm/stress2/testcases/pty/ soc2011/shm/stress2/testcases/pty/Makefile soc2011/shm/stress2/testcases/pty/pty.c soc2011/shm/stress2/testcases/rename/ soc2011/shm/stress2/testcases/rename/Makefile soc2011/shm/stress2/testcases/rename/rename.c soc2011/shm/stress2/testcases/run/ soc2011/shm/stress2/testcases/run/Makefile soc2011/shm/stress2/testcases/run/run.c soc2011/shm/stress2/testcases/rw/ soc2011/shm/stress2/testcases/rw/Makefile soc2011/shm/stress2/testcases/rw/rw.c soc2011/shm/stress2/testcases/shm/ soc2011/shm/stress2/testcases/shm/Makefile soc2011/shm/stress2/testcases/shm/shm.c soc2011/shm/stress2/testcases/socket/ soc2011/shm/stress2/testcases/socket/Makefile soc2011/shm/stress2/testcases/socket/socket.c soc2011/shm/stress2/testcases/swap/ soc2011/shm/stress2/testcases/swap/Makefile soc2011/shm/stress2/testcases/swap/swap.c soc2011/shm/stress2/testcases/symlink/ soc2011/shm/stress2/testcases/symlink/Makefile soc2011/shm/stress2/testcases/symlink/symlink.c soc2011/shm/stress2/testcases/syscall/ soc2011/shm/stress2/testcases/syscall/Makefile soc2011/shm/stress2/testcases/syscall/syscall.c soc2011/shm/stress2/testcases/sysctl/ soc2011/shm/stress2/testcases/sysctl/Makefile soc2011/shm/stress2/testcases/sysctl/sysctl.c soc2011/shm/stress2/testcases/tcp/ soc2011/shm/stress2/testcases/tcp/Makefile soc2011/shm/stress2/testcases/tcp/tcp.c soc2011/shm/stress2/testcases/thr1/ soc2011/shm/stress2/testcases/thr1/Makefile soc2011/shm/stress2/testcases/thr1/thr1.c soc2011/shm/stress2/testcases/thr2/ soc2011/shm/stress2/testcases/thr2/Makefile soc2011/shm/stress2/testcases/thr2/thr2.c soc2011/shm/stress2/testcases/udp/ soc2011/shm/stress2/testcases/udp/Makefile soc2011/shm/stress2/testcases/udp/udp.c soc2011/shm/stress2/tools/ soc2011/shm/stress2/tools/df.sh (contents, props changed) soc2011/shm/stress2/tools/freeze.sh (contents, props changed) soc2011/shm/stress2/tools/freeze2.sh (contents, props changed) soc2011/shm/stress2/tools/fstool.c soc2011/shm/stress2/tools/iwatch.sh (contents, props changed) soc2011/shm/stress2/tools/l3.sh (contents, props changed) soc2011/shm/stress2/tools/leaks.sh (contents, props changed) soc2011/shm/stress2/tools/leaks2.sh (contents, props changed) soc2011/shm/stress2/tools/module/ soc2011/shm/stress2/tools/module/Makefile soc2011/shm/stress2/tools/module/ptest.c soc2011/shm/stress2/tools/monitor.sh (contents, props changed) soc2011/shm/stress2/tools/ptsleak.sh (contents, props changed) soc2011/shm/stress2/tools/ptyleak.sh (contents, props changed) soc2011/shm/stress2/tools/rwatch.sh (contents, props changed) soc2011/shm/stress2/udp.cfg soc2011/shm/stress2/vfs.cfg Replaced: soc2011/shm/TESLA/assertions/strawman/Makefile - copied unchanged from r224064, soc2011/shm/TESLA/strawman/Makefile Deleted: soc2011/shm/TESLA/strawman/ soc2011/shm/mac_test/ Modified: soc2011/shm/TESLA/libtesla/Makefile Copied: soc2011/shm/TESLA/assertions/strawman/Makefile (from r224064, soc2011/shm/TESLA/strawman/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/TESLA/assertions/strawman/Makefile Wed Jul 13 22:42:35 2011 (r224192, copy of r224064, soc2011/shm/TESLA/strawman/Makefile) @@ -0,0 +1,65 @@ +.DEFAULT: all +.PHONY: all clean + +CC = ../kernel/tesla-clang -DTESLA_INCLUDE_ASSERTIONS +LD = ../kernel/tesla-clang + +CFLAGS = -g -Wall -I .. + +UNITS = instrumentation caller syscalls +## Include if not using automatically generated instrumentation +# _instrumentation + +OBJ = $(UNITS:=.o) + + +all: instrumentation + ## First create or copy instrumentation.c/.spec if needed + ## then actually build the application. We need to do this + ## in a new make instance, as otherwise make won't realize + ## that instrumentation.c was created after it started + make -C . test + +clean: + rm -f test *.bc *.ll *.o *.c-tesla.h \ + generated.c generated.spec instrumentation.spec \ + instrumentation.c + +## Create $(1) from $(2), if ($2) exists and is different from $(1), +## but if neither $(1) nor $(2) exist, create $(1) from a blank file +copy_changed_file = \ + if [ -e $(2) -a -e $(1) ] \ + && ! cmp -s $(2) $(1); then \ + echo $(2) has changed, copying to $(1); \ + cp $(2) $(1); \ + elif [ ! -e $(1) ]; then \ + echo $(2) and $(1) do not exist, creating blank $(1); \ + touch $(1); \ + fi + +## On every build, if generated.spec/.c has been changed, copy it +## to instrumentation.spec/.c but if generated.spec/.c does not exist, +## create an empty file +instrumentation: + $(call copy_changed_file,instrumentation.spec,generated.spec) + $(call copy_changed_file,instrumentation.c,generated.c) +## Force this to be run even if instrumentation.spec exists +.PHONY: instrumentation + +test: $(OBJ) + $(LD) -o $@ $^ *.o + +syscalls.o: ../tesla/tesla.h + + +# LLVM IR for inspection +all: syscalls.ll +syscalls.ll: syscalls.c + $(CC) $(CFLAGS) -emit-llvm -o $@ -S $^ + + +# Clang-generated declarations of instrumentation +syscalls.o: instrumentation.spec +_instrumentation.o: syscalls.c-tesla.h +syscalls.c-tesla.h: syscalls.o + Modified: soc2011/shm/TESLA/libtesla/Makefile ============================================================================== --- soc2011/shm/TESLA/libtesla/Makefile Wed Jul 13 21:07:50 2011 (r224191) +++ soc2011/shm/TESLA/libtesla/Makefile Wed Jul 13 22:42:35 2011 (r224192) @@ -1,20 +1,19 @@ -CFLAGS=-g -Wall -I.. -Werror +CFLAGS=-g -Wall -Werror -I.. ALL=tesla_state.o tesla_state_global.o tesla_state_perthread.o \ tesla_registration.o tesla_util.o all: ${ALL} tesla_state.o: tesla_state.c - gcc -c ${CFLAGS} -o tesla_state.o tesla_state.c + $(CC) -c ${CFLAGS} -o tesla_state.o tesla_state.c tesla_state_global.o: tesla_state_global.c - gcc -c ${CFLAGS} -o tesla_state_global.o tesla_state_global.c + $(CC) -c ${CFLAGS} -o tesla_state_global.o tesla_state_global.c tesla_state_perthread.o: tesla_state_perthread.c - gcc -c ${CFLAGS} -o tesla_state_perthread.o tesla_state_perthread.c + $(CC) -c ${CFLAGS} -o tesla_state_perthread.o tesla_state_perthread.c tesla_registration.o: tesla_registration.c - gcc -c ${CFLAGS} -o tesla_registration.o tesla_registration.c + $(CC) -c ${CFLAGS} -o tesla_registration.o tesla_registration.c tesla_util.o: tesla_util.c - gcc -c ${CFLAGS} -o tesla_util.o tesla_util.c + $(CC) -c ${CFLAGS} -o tesla_util.o tesla_util.c clean: rm -f ${ALL} - Added: soc2011/shm/stress2/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/Makefile Wed Jul 13 22:42:35 2011 (r224192) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= lib testcases + +.include Added: soc2011/shm/stress2/Makefile.gnu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/Makefile.gnu Wed Jul 13 22:42:35 2011 (r224192) @@ -0,0 +1,28 @@ +#MAKE=gmake + +# Gnu Makefile by "Brad Knotwell" + +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: soc2011/shm/stress2/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/README Wed Jul 13 22:42:35 2011 (r224192) @@ -0,0 +1,59 @@ +$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. + + +20090120: des@ pointed out it would be nice to be able to set the + random seed in order to be able to reproduce errors in time. + A test of this show that the occurrence of panics are still + non-deterministic even with a fixed seed. The known broken + unionfs was used to test this: + http://people.freebsd.org/~pho/stress/log/marcus006.txt. + First panic occurred after 29 loops and the second after 8 + with a seed of "123". + + The randomness that is provided by lack of synchronization + with timer interrupt, disk block layout and disk access + latencies caused by platter and heads speed changes, disk + firmware internal operations, and so on are _much_ bigger + then the undeterminism caused by the non-repeatable random + seed. + + Anyway, I have always view the this issue as only a slight + inconvenience. Added: soc2011/shm/stress2/all.cfg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/all.cfg Wed Jul 13 22:42:35 2011 (r224192) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +# Stress Test Suite Configuration: run all test programs + +# Default values +. ./default.cfg + +export TESTPROGS="" Added: soc2011/shm/stress2/beaver1.sentex.ca ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/beaver1.sentex.ca Wed Jul 13 22:42:35 2011 (r224192) @@ -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: soc2011/shm/stress2/creat.cfg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/creat.cfg Wed Jul 13 22:42:35 2011 (r224192) @@ -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: soc2011/shm/stress2/default.cfg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/default.cfg Wed Jul 13 22:42:35 2011 (r224192) @@ -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 +} + +[ -f "./`hostname`" ] && . "./`hostname`" # source in local configuration +[ -f "../`hostname`" ] && . "../`hostname`" # source in local configuration Added: soc2011/shm/stress2/df.cfg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/df.cfg Wed Jul 13 22:42:35 2011 (r224192) @@ -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: soc2011/shm/stress2/disk.cfg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/disk.cfg Wed Jul 13 22:42:35 2011 (r224192) @@ -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: soc2011/shm/stress2/hydra1.netperf.freebsd.org ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/hydra1.netperf.freebsd.org Wed Jul 13 22:42:35 2011 (r224192) @@ -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: soc2011/shm/stress2/hydra2.netperf.freebsd.org ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/hydra2.netperf.freebsd.org Wed Jul 13 22:42:35 2011 (r224192) @@ -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: soc2011/shm/stress2/include/stress.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/include/stress.h Wed Jul 13 22:42:35 2011 (r224192) @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 2008 Peter Holm + * 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 void show_status(void); +extern int64_t swap(void); +extern unsigned long usermem(void); +#endif Added: soc2011/shm/stress2/io.cfg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/io.cfg Wed Jul 13 22:42:35 2011 (r224192) @@ -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: soc2011/shm/stress2/jeff.cfg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/jeff.cfg Wed Jul 13 22:42:35 2011 (r224192) @@ -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: soc2011/shm/stress2/lib/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/lib/Makefile Wed Jul 13 22:42:35 2011 (r224192) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +LIB=stress +SRCS=main.c options.c random_int.c resources.c + +.include "../testcases/Makefile.inc" + +.include Added: soc2011/shm/stress2/lib/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/lib/main.c Wed Jul 13 22:42:35 2011 (r224192) @@ -0,0 +1,208 @@ +/*- + * Copyright (c) 2008 Peter Holm + * 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 __unused) +{ + 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 __unused) +{ + + done_testing = 1; +} + +void +exit_handler(int i __unused) +{ + + 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(); + setup(i); + if ((strcmp(getprogname(), "run") != 0) && (op->nodelay == 0)) + sleep(random_int(1,10)); + 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); + + show_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: soc2011/shm/stress2/lib/options.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/lib/options.c Wed Jul 13 22:42:35 2011 (r224192) @@ -0,0 +1,265 @@ +/*- + * Copyright (c) 2008 Peter Holm + * 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#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 : time to run test\n" + " l : load factor 0 - 100%\n" + " i : max # of parallel incarnations\n" + " d : 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; + + 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; +} + +void +show_status(void) +{ + char buf[80]; + int days; + time_t t; + + 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: soc2011/shm/stress2/lib/random_int.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/shm/stress2/lib/random_int.c Wed Jul 13 22:42:35 2011 (r224192) @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 2008 Peter Holm + * 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 +__FBSDID("$FreeBSD$"); + +#include + *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***