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-2003 Silicon Graphics, Inc. All Rights Reserved.
20 # This program is free software; you can redistribute it and/or
21 # modify it under the terms 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,
25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 # GNU General Public License for more details.
29 # You should have received a copy of the GNU General Public License
30 # along with this program; if not, write the Free Software Foundation,
31 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
33 #-----------------------------------------------------------------------
40 here=`pwd`; export here
41 status=1 # failure is the default!
43 # get standard environment, filters and checks
50 umount $SCRATCH_DEV >/dev/null 2>&1
84 while [ $pass -le $passes -o $passes -lt 0 ]
86 _log " *** clean scratch device [$bench starting, pass $pass]"
87 _scratch_mkfs 2>&1 | _fix_malloc >>$FULL
88 _log " *** mounting scratch device"
89 _scratch_mount || _fail " !!! failed to mount"
92 mkdir $SCRATCH_MNT/bench \
93 || _fail " !!! couldn't mkdir benchdir"
94 chown -R $user.$group $SCRATCH_MNT/bench \
95 || _fail " !!! couldn't chown benchdir"
98 seq=`perl -e 'printf "results.%s.%03d\n", '$bench', '$pass`
101 _log " *** bench [$seq]"
102 $here/src/runas -u $uid -g $gid $here/run.$bench >$tmp.out 2>>$FULL
103 [ $? -eq 0 ] || _fail " !!! $bench pass $pass failed"
106 _fix_malloc < $tmp.out > $seq
108 _log " *** unmounting scratch device"
109 umount $SCRATCH_DEV 2>&1 | _logp \
110 || _fail " !!! failed to umount"
112 _log " *** post-umount filesystem check"
115 let "pass = pass + 1"
121 echo Results for $bench benchmark
123 echo results.$bench.* | sort -nu | xargs cat
127 # real QA test starts here
129 if [ $# -lt 3 ]; then
130 echo Usage: bench passes user group [script]
139 if [ $# -gt 0 ]; then
142 benches=`echo run.* | sed -e 's/run\.//g'`
144 [ -z "$benches" -o "$benches" = "*" ] && _fail "no benchmark scripts found"
146 trap "_cleanup; exit \$status" 0 1 2 3 15
149 rm -f bench.* results.*
151 FULL_FSTYP_DETAILS=`_full_fstyp_details`
152 FULL_HOST_DETAILS=`_full_platform_details`
153 FULL_MKFS_OPTIONS=`_scratch_mkfs_options`
154 FULL_MOUNT_OPTIONS=`_scratch_mount_options`
156 # $OUT is the report which will ultimately be sent, keep it tidy.
158 FSTYP -- $FULL_FSTYP_DETAILS
159 PLATFORM -- $FULL_HOST_DETAILS
160 MKFS_OPTIONS -- $FULL_MKFS_OPTIONS
161 MOUNT_OPTIONS -- $FULL_MOUNT_OPTIONS
165 for bench in $benches
169 _log "*** benchmark started [passes=$passes, benchmark=$bench]"
171 _log "MKFS_OPTIONS -- $FULL_MKFS_OPTIONS"
172 _log "MOUNT_OPTIONS -- $FULL_MOUNT_OPTIONS"
173 _log " *** unmounting scratch device"
174 umount $SCRATCH_DEV 2>&1 | _fix_malloc >>$FULL
176 _run_benchmark | _fix_malloc
177 _merge_results >>$OUT
179 _log "*** done $bench"