3 # Wrapper for automating benchmarking runs.
4 # Usage: bench passes user group [script]
6 # ..where passes is the number of times to run each script; uid/gid
7 # gives credentials to use when running the script; and script is a
8 # simple wrapper around each actual benchmark tool (eg. see run.*),
9 # if this is ommited, all run.* scripts are used in turn.
11 # Each run.foo script should report a comma-separated-value list of
12 # benchmark results on stdout or fail with a non-zero exit code;
13 # unless the -i option is supplied in which case it should instead
14 # report a comma-separated-value list of column headers (for report
15 # generation purposes).
17 #-----------------------------------------------------------------------
18 # Copyright (c) 2002 Silicon Graphics, Inc. All Rights Reserved.
20 # This program is free software; you can redistribute it and/or modify it
21 # under the terms of version 2 of the GNU General Public License as
22 # published by the Free Software Foundation.
24 # This program is distributed in the hope that it would be useful, but
25 # WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
28 # Further, this software is distributed without any warranty that it is
29 # free of the rightful claim of any third person regarding infringement
30 # or the like. Any license provided herein, whether implied or
31 # otherwise, applies only to this software file. Patent licenses, if
32 # any, provided herein do not apply to combinations of this program with
33 # other software, or any other product whatsoever.
35 # You should have received a copy of the GNU General Public License along
36 # with this program; if not, write the Free Software Foundation, Inc., 59
37 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
39 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
40 # Mountain View, CA 94043, or:
44 # For further information regarding this notice, see:
46 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
47 #-----------------------------------------------------------------------
53 here=`pwd`; export here
54 status=1 # failure is the default!
56 # get standard environment, filters and checks
63 umount $SCRATCH_DEV >/dev/null 2>&1
96 while [ $pass -le $passes -o $passes -lt 0 ]
98 _log " *** clean scratch device [$bench starting, pass $pass]"
99 mkfs_xfs -f $SCRATCH_DEV 2>&1 | _fix_malloc >>$FULL \
100 || _fail " !!! mkfs SCRATCH_DEV failed"
102 _log " *** mounting scratch device"
103 mount -t xfs $SCRATCH_DEV $SCRATCH_MNT \
104 || _fail " !!! failed to mount"
107 mkdir $SCRATCH_MNT/bench \
108 || _fail " !!! couldn't mkdir benchdir"
109 chown -R $user.$group $SCRATCH_MNT/bench \
110 || _fail " !!! couldn't chown benchdir"
112 cd $SCRATCH_MNT/bench
113 seq=`perl -e 'printf "results.%s.%03d\n", '$bench', '$pass`
116 _log " *** bench [$seq]"
117 $here/src/runas -u $uid -g $gid $here/run.$bench >$tmp.out 2>>$FULL
118 [ $? -eq 0 ] || _fail " !!! $bench pass $pass failed"
121 _fix_malloc < $tmp.out > $seq
123 _log " *** unmounting scratch device"
124 umount $SCRATCH_DEV 2>&1 | _logp \
125 || _fail " !!! failed to umount"
127 _log " *** post-umount filesystem check"
128 _check_fs $SCRATCH_DEV
130 let "pass = pass + 1"
136 echo Results for $bench benchmark >>$OUT
137 headers=`$here/run.$bench -h`
138 echo "[$headers]" >>$OUT
139 echo results.$bench.* | sort -nu | xargs cat >>$OUT
143 # real QA test starts here
145 if [ $# -lt 3 ]; then
146 echo Usage: bench passes user group [script]
155 if [ $# -gt 0 ]; then
158 benches=`echo run.* | sed -e 's/run\.//g'`
160 [ -z "$benches" -o "$benches" = "*" ] && _fail "no benchmark scripts found"
162 trap "_cleanup; exit \$status" 0 1 2 3 15
166 echo "MKFS_OPTIONS=$MKFS_OPTIONS" >>$OUT
167 echo "MOUNT_OPTIONS=$MOUNT_OPTIONS" >>$OUT
171 for bench in $benches
175 _log "*** benchmark started [passes=$passes, benchmark=$bench]"
177 _log "*** MKFS_OPTIONS=$MKFS_OPTIONS"
178 _log "*** MOUNT_OPTIONS=$MOUNT_OPTIONS"
179 _log " *** unmounting scratch device"
180 umount $SCRATCH_DEV 2>&1 | _fix_malloc >>$FULL
182 _run_benchmark | _fix_malloc
185 _log "*** done $bench"