blob: b9fb9d5416b154d0268960e65c49b78454209b8c [file] [log] [blame]
#! /bin/bash
# FS QA Test No. 074
#
# fstest
#
#-----------------------------------------------------------------------
# Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms 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. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
#-----------------------------------------------------------------------
#
# creator
owner=nathans@sgi.com
seq=`basename $0`
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=0 # success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -rf $testdir/fstest.$$.* $tmp.*
_cleanup_testdir
}
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
_do_test()
{
_n="$1"
_param="$2"
out=$testdir/fstest.$$.$_n
rm -rf $out
if ! mkdir $out
then
echo " failed to mkdir $out"
status=1
exit
fi
_filter_param=`echo "$_param" | sed\
-e 's/-n [0-9][0-9]*/-n children/' \
-e 's/-l [0-9][0-9]*/-l loops/' \
-e 's/-f [0-9][0-9]*/-f files/'`
echo ""
echo "-----------------------------------------------"
echo "fstest.$_n : $_filter_param"
echo "-----------------------------------------------"
if ! $here/src/fstest $_param -p $out >>$seq.full
then
echo " fstest ($_param) returned $? - see $seq.full"
status=1
exit
fi
_check_test_fs
}
_usage()
{
echo "$0: [-f files] [-l loops] [-n children]"
}
_process_args()
{
while getopts "f:l:n:?" c $@
do
case $c
in
f)
numfiles=$OPTARG
param_type="$param_type, overidde -f"
;;
l)
numloops=$OPTARG
param_type="$param_type, overidde -l"
;;
n)
numchildren=$OPTARG
param_type="$param_type, overidde -n"
;;
?)
_usage
exit
;;
esac
done
}
# real QA test starts here
rm -f $here/$seq.full
_supported_fs generic
_supported_os IRIX Linux
#
# set params
# These params can take a while on different CPUs/OSs
# so we set them differently for different machines
#
if [ $HOSTOS == "IRIX" ]; then
if uname -R | grep -iq debug; then
# e.g. getting around 37secs for 1,1,1 on IP30 debug
numchildren=2
numloops=1
numfiles=2
param_type="IRIX debug"
else
# getting around 1 sec 1,1,1 - 10secs 1,10,1 on IP30 nondebug
numloops=2
numfiles=3
numchildren=3
param_type="IRIX nondebug"
fi
elif [ $HOSTOS == "Linux" ]; then
if uname -a | grep -q SMP; then
numloops=10
numfiles=5
numchildren=3
param_type="Linux SMP"
else
numloops=2
numfiles=3
numchildren=3
param_type="Linux UP"
fi
else
numloops=1
numfiles=1
numchildren=1
param_type="Default"
fi
# can override the params here
_process_args "$@"
echo "Params are for $param_type" >>$seq.full
echo "Params: n = $numchildren l = $numloops f = $numfiles" >>$seq.full
_setup_testdir
_check_test_fs
# Options:
# -F generate files with holes (default=no)
# -n num_children set number of child processes (default=1)
# -f num_files set number of files (default=1)
# -s file_size set file sizes (default=1MiB)
# -b block_size set block (IO) size (default=1024)
# -l loops set loop count (default=100)
# -m use mmap (default=no)
# -S use synchronous IO (default=no)
# -P preallocate space (default=no)
size10=`expr 10 \* 1024 \* 1024` # 10 megabytes
size30=`expr 30 \* 1024 \* 1024` # 30 megabytes
_do_test 0 "-l $numloops"
_do_test 1 "-l $numloops -s $size10 -b 8192 -m"
_do_test 2 "-n $numchildren -F -l $numloops -f $numfiles -s $size30 -b 512"
_do_test 3 "-n $numchildren -F -l $numloops -f $numfiles -s $size30 -b 512 -m"
_do_test 4 "-n $numchildren -F -l $numloops -f $numfiles -s $size10 -b 512 -mS"