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.
19 #-----------------------------------------------------------------------
26 here=`pwd`; export here
27 status=1 # failure is the default!
29 # get standard environment, filters and checks
36 umount $SCRATCH_DEV >/dev/null 2>&1
70 while [ $pass -le $passes -o $passes -lt 0 ]
72 _log " *** clean scratch device [$bench starting, pass $pass]"
73 _scratch_mkfs 2>&1 | _fix_malloc >>$FULL
74 _log " *** mounting scratch device"
75 _scratch_mount || _fail " !!! failed to mount"
78 mkdir $SCRATCH_MNT/bench \
79 || _fail " !!! couldn't mkdir benchdir"
80 chown -R $user.$group $SCRATCH_MNT/bench \
81 || _fail " !!! couldn't chown benchdir"
84 seq=`perl -e 'printf "results.%s.%03d\n", '$bench', '$pass`
87 _log " *** bench [$seq]"
88 $here/src/runas -u $uid -g $gid $here/run.$bench >$tmp.out 2>>$FULL
89 [ $? -eq 0 ] || _fail " !!! $bench pass $pass failed"
92 _fix_malloc < $tmp.out > $seq
94 _log " *** unmounting scratch device"
95 umount $SCRATCH_DEV 2>&1 | _logp \
96 || _fail " !!! failed to umount"
98 _log " *** post-umount filesystem check"
101 let "pass = pass + 1"
107 echo Results for $bench benchmark
109 echo results.$bench.* | sort -nu | xargs cat
113 # real QA test starts here
115 if [ $# -lt 3 ]; then
116 echo Usage: bench passes user group [script]
125 if [ $# -gt 0 ]; then
128 benches=`echo run.* | sed -e 's/run\.//g'`
130 [ -z "$benches" -o "$benches" = "*" ] && _fail "no benchmark scripts found"
132 trap "_cleanup; exit \$status" 0 1 2 3 15
135 rm -f bench.* results.*
137 FULL_FSTYP_DETAILS=`_full_fstyp_details`
138 FULL_HOST_DETAILS=`_full_platform_details`
139 FULL_MKFS_OPTIONS=`_scratch_mkfs_options`
140 FULL_MOUNT_OPTIONS=`_scratch_mount_options`
142 # $OUT is the report which will ultimately be sent, keep it tidy.
144 FSTYP -- $FULL_FSTYP_DETAILS
145 PLATFORM -- $FULL_HOST_DETAILS
146 MKFS_OPTIONS -- $FULL_MKFS_OPTIONS
147 MOUNT_OPTIONS -- $FULL_MOUNT_OPTIONS
151 for bench in $benches
155 _log "*** benchmark started [passes=$passes, benchmark=$bench]"
157 _log "MKFS_OPTIONS -- $FULL_MKFS_OPTIONS"
158 _log "MOUNT_OPTIONS -- $FULL_MOUNT_OPTIONS"
159 _log " *** unmounting scratch device"
160 umount $SCRATCH_DEV 2>&1 | _fix_malloc >>$FULL
162 _run_benchmark | _fix_malloc
163 _merge_results >>$OUT
165 _log "*** done $bench"