2002-09-18 03:28:20 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
#
|
|
|
|
|
# Wrapper for automating benchmarking runs.
|
2002-09-19 07:26:17 +00:00
|
|
|
# Usage: bench passes user group [script]
|
2002-09-18 03:28:20 +00:00
|
|
|
#
|
|
|
|
|
# ..where passes is the number of times to run each script; uid/gid
|
|
|
|
|
# gives credentials to use when running the script; and script is a
|
|
|
|
|
# simple wrapper around each actual benchmark tool (eg. see run.*),
|
|
|
|
|
# if this is ommited, all run.* scripts are used in turn.
|
|
|
|
|
#
|
|
|
|
|
# Each run.foo script should report a comma-separated-value list of
|
|
|
|
|
# benchmark results on stdout or fail with a non-zero exit code;
|
|
|
|
|
# unless the -i option is supplied in which case it should instead
|
|
|
|
|
# report a comma-separated-value list of column headers (for report
|
|
|
|
|
# generation purposes).
|
|
|
|
|
#
|
|
|
|
|
#-----------------------------------------------------------------------
|
2003-05-22 04:16:45 +00:00
|
|
|
# Copyright (c) 2002-2003 Silicon Graphics, Inc. All Rights Reserved.
|
2002-09-18 03:28:20 +00:00
|
|
|
#
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
|
|
|
# under the terms of version 2 of the GNU General Public License as
|
|
|
|
|
# published by the Free Software Foundation.
|
|
|
|
|
#
|
|
|
|
|
# This program is distributed in the hope that it would be useful, but
|
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
#
|
|
|
|
|
# Further, this software is distributed without any warranty that it is
|
|
|
|
|
# free of the rightful claim of any third person regarding infringement
|
|
|
|
|
# or the like. Any license provided herein, whether implied or
|
|
|
|
|
# otherwise, applies only to this software file. Patent licenses, if
|
|
|
|
|
# any, provided herein do not apply to combinations of this program with
|
|
|
|
|
# other software, or any other product whatsoever.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License along
|
|
|
|
|
# with this program; if not, write the Free Software Foundation, Inc., 59
|
|
|
|
|
# Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
|
|
|
|
#
|
|
|
|
|
# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
|
|
|
|
|
# Mountain View, CA 94043, or:
|
|
|
|
|
#
|
|
|
|
|
# http://www.sgi.com
|
|
|
|
|
#
|
|
|
|
|
# For further information regarding this notice, see:
|
|
|
|
|
#
|
|
|
|
|
# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# creator
|
|
|
|
|
owner=nathans@sgi.com
|
|
|
|
|
|
2003-08-25 01:18:54 +00:00
|
|
|
iam=bench
|
2002-09-18 03:28:20 +00:00
|
|
|
tmp=/tmp/$$
|
2002-11-07 05:42:19 +00:00
|
|
|
here=`pwd`; export here
|
2002-09-18 03:28:20 +00:00
|
|
|
status=1 # failure is the default!
|
|
|
|
|
|
|
|
|
|
# get standard environment, filters and checks
|
|
|
|
|
. ./common.rc
|
|
|
|
|
. ./common.filter
|
|
|
|
|
|
|
|
|
|
_cleanup()
|
|
|
|
|
{
|
|
|
|
|
echo " *** umount"
|
|
|
|
|
umount $SCRATCH_DEV >/dev/null 2>&1
|
2003-05-13 07:06:18 +00:00
|
|
|
rm -f $tmp.*
|
2002-09-18 03:28:20 +00:00
|
|
|
}
|
|
|
|
|
|
2002-09-19 07:26:17 +00:00
|
|
|
OUT="bench.out"
|
|
|
|
|
LOG="bench.log"
|
|
|
|
|
FULL="bench.full"
|
2002-09-18 03:28:20 +00:00
|
|
|
|
|
|
|
|
_log()
|
|
|
|
|
{
|
|
|
|
|
echo "$*" 1>&2
|
|
|
|
|
echo "$*" >>$LOG
|
|
|
|
|
echo "$*" >>$FULL
|
|
|
|
|
sync
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_logp()
|
|
|
|
|
{
|
|
|
|
|
tee -a $FULL
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_fail()
|
|
|
|
|
{
|
|
|
|
|
_log "$*"
|
|
|
|
|
status=1
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_run_benchmark()
|
|
|
|
|
{
|
|
|
|
|
pass=1
|
2002-09-18 08:03:37 +00:00
|
|
|
uid=`id -u $user`
|
|
|
|
|
gid=`id -g $group`
|
2002-09-18 03:28:20 +00:00
|
|
|
|
|
|
|
|
while [ $pass -le $passes -o $passes -lt 0 ]
|
|
|
|
|
do
|
2002-09-18 08:03:37 +00:00
|
|
|
_log " *** clean scratch device [$bench starting, pass $pass]"
|
2003-08-25 01:18:54 +00:00
|
|
|
_scratch_mkfs 2>&1 | _fix_malloc >>$FULL
|
2002-09-18 03:28:20 +00:00
|
|
|
_log " *** mounting scratch device"
|
2003-05-22 04:16:45 +00:00
|
|
|
_scratch_mount || _fail " !!! failed to mount"
|
2002-09-18 03:28:20 +00:00
|
|
|
|
|
|
|
|
_log " *** mkdir"
|
|
|
|
|
mkdir $SCRATCH_MNT/bench \
|
2002-09-18 08:03:37 +00:00
|
|
|
|| _fail " !!! couldn't mkdir benchdir"
|
2002-09-18 03:28:20 +00:00
|
|
|
chown -R $user.$group $SCRATCH_MNT/bench \
|
2002-09-18 08:03:37 +00:00
|
|
|
|| _fail " !!! couldn't chown benchdir"
|
2002-09-19 07:26:17 +00:00
|
|
|
|
2002-09-18 03:28:20 +00:00
|
|
|
cd $SCRATCH_MNT/bench
|
2002-09-20 01:35:55 +00:00
|
|
|
seq=`perl -e 'printf "results.%s.%03d\n", '$bench', '$pass`
|
|
|
|
|
rm -f $seq $tmp.out
|
|
|
|
|
|
|
|
|
|
_log " *** bench [$seq]"
|
2002-11-09 20:13:42 +00:00
|
|
|
$here/src/runas -u $uid -g $gid $here/run.$bench >$tmp.out 2>>$FULL
|
2002-09-20 01:35:55 +00:00
|
|
|
[ $? -eq 0 ] || _fail " !!! $bench pass $pass failed"
|
2002-09-18 03:28:20 +00:00
|
|
|
|
|
|
|
|
cd $here
|
2002-09-20 07:47:55 +00:00
|
|
|
_fix_malloc < $tmp.out > $seq
|
2002-09-18 03:28:20 +00:00
|
|
|
|
|
|
|
|
_log " *** unmounting scratch device"
|
|
|
|
|
umount $SCRATCH_DEV 2>&1 | _logp \
|
|
|
|
|
|| _fail " !!! failed to umount"
|
|
|
|
|
|
|
|
|
|
_log " *** post-umount filesystem check"
|
2003-05-22 04:16:45 +00:00
|
|
|
_check_scratch_fs
|
2002-09-18 03:28:20 +00:00
|
|
|
|
|
|
|
|
let "pass = pass + 1"
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-19 07:26:17 +00:00
|
|
|
_merge_results()
|
|
|
|
|
{
|
2002-11-28 08:37:02 +00:00
|
|
|
echo Results for $bench benchmark
|
2003-09-09 01:50:09 +00:00
|
|
|
$here/run.$bench -h
|
2002-11-28 08:37:02 +00:00
|
|
|
echo results.$bench.* | sort -nu | xargs cat
|
|
|
|
|
echo
|
2002-09-19 07:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
2002-09-18 03:28:20 +00:00
|
|
|
# real QA test starts here
|
|
|
|
|
|
2002-09-19 07:26:17 +00:00
|
|
|
if [ $# -lt 3 ]; then
|
|
|
|
|
echo Usage: bench passes user group [script]
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
passes=$1
|
|
|
|
|
user=$2
|
|
|
|
|
group=$3
|
2002-11-14 03:39:42 +00:00
|
|
|
shift; shift; shift
|
2002-09-19 07:26:17 +00:00
|
|
|
|
2002-11-14 03:39:42 +00:00
|
|
|
if [ $# -gt 0 ]; then
|
2003-08-29 00:41:36 +00:00
|
|
|
benches="$@"
|
2002-11-14 03:39:42 +00:00
|
|
|
else
|
2003-08-29 00:41:36 +00:00
|
|
|
benches=`echo run.* | sed -e 's/run\.//g'`
|
2002-11-14 03:39:42 +00:00
|
|
|
fi
|
2002-09-19 07:26:17 +00:00
|
|
|
[ -z "$benches" -o "$benches" = "*" ] && _fail "no benchmark scripts found"
|
|
|
|
|
|
|
|
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
|
|
2002-09-18 03:28:20 +00:00
|
|
|
_require_scratch
|
2002-12-03 00:48:41 +00:00
|
|
|
rm -f bench.* results.*
|
2002-11-28 08:37:02 +00:00
|
|
|
|
2003-09-01 22:44:21 +00:00
|
|
|
_full_fstyp_details()
|
2003-08-29 00:41:36 +00:00
|
|
|
{
|
|
|
|
|
[ -z "$FSTYP" ] && FSTYP=xfs
|
2003-09-19 06:09:47 +00:00
|
|
|
if [ $FSTYP = xfs ]; then
|
|
|
|
|
if grep 'debug 0' /proc/fs/xfs/stat >/dev/null; then
|
|
|
|
|
FSTYP="$FSTYP (non-debug)"
|
|
|
|
|
elif grep 'debug 1' /proc/fs/xfs/stat >/dev/null; then
|
|
|
|
|
FSTYP="$FSTYP (debug)"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2003-09-01 22:44:21 +00:00
|
|
|
echo $FSTYP
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_full_platform_details()
|
|
|
|
|
{
|
2003-08-29 00:41:36 +00:00
|
|
|
os=`uname -s`
|
|
|
|
|
host=`hostname -s`
|
|
|
|
|
kernel=`uname -r`
|
2003-09-02 22:13:34 +00:00
|
|
|
platform=`uname -m`
|
2003-09-01 22:44:21 +00:00
|
|
|
echo "$os/$platform $host $kernel"
|
2003-08-29 00:41:36 +00:00
|
|
|
}
|
|
|
|
|
|
2003-09-01 22:44:21 +00:00
|
|
|
FULL_FSTYP_DETAILS=`_full_fstyp_details`
|
2003-08-29 00:41:36 +00:00
|
|
|
FULL_HOST_DETAILS=`_full_platform_details`
|
2003-05-22 04:16:45 +00:00
|
|
|
FULL_MKFS_OPTIONS=`_scratch_mkfs_options`
|
|
|
|
|
FULL_MOUNT_OPTIONS=`_scratch_mount_options`
|
2002-12-18 01:10:06 +00:00
|
|
|
|
2002-11-28 08:37:02 +00:00
|
|
|
# $OUT is the report which will ultimately be sent, keep it tidy.
|
2003-08-29 00:41:36 +00:00
|
|
|
cat >$OUT <<EOF
|
2003-09-01 22:44:21 +00:00
|
|
|
FSTYP -- $FULL_FSTYP_DETAILS
|
2003-08-29 00:41:36 +00:00
|
|
|
PLATFORM -- $FULL_HOST_DETAILS
|
2003-05-22 06:14:09 +00:00
|
|
|
MKFS_OPTIONS -- $FULL_MKFS_OPTIONS
|
|
|
|
|
MOUNT_OPTIONS -- $FULL_MOUNT_OPTIONS
|
2002-11-28 08:37:02 +00:00
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
2002-09-18 08:03:37 +00:00
|
|
|
for bench in $benches
|
2002-11-10 23:32:19 +00:00
|
|
|
do
|
2003-08-25 01:18:54 +00:00
|
|
|
echo "" >>$FULL
|
2002-09-18 03:28:20 +00:00
|
|
|
echo "" >$LOG
|
2002-09-20 01:35:55 +00:00
|
|
|
_log "*** benchmark started [passes=$passes, benchmark=$bench]"
|
|
|
|
|
_log "*** (`date`)"
|
2003-05-22 04:16:45 +00:00
|
|
|
_log "MKFS_OPTIONS -- $FULL_MKFS_OPTIONS"
|
|
|
|
|
_log "MOUNT_OPTIONS -- $FULL_MOUNT_OPTIONS"
|
2002-09-18 03:28:20 +00:00
|
|
|
_log " *** unmounting scratch device"
|
2002-09-18 08:03:37 +00:00
|
|
|
umount $SCRATCH_DEV 2>&1 | _fix_malloc >>$FULL
|
|
|
|
|
|
2002-09-19 07:26:17 +00:00
|
|
|
_run_benchmark | _fix_malloc
|
2002-11-28 08:37:02 +00:00
|
|
|
_merge_results >>$OUT
|
2002-09-18 03:28:20 +00:00
|
|
|
|
|
|
|
|
_log "*** done $bench"
|
|
|
|
|
done
|
2002-09-18 08:03:37 +00:00
|
|
|
status=0
|