Files
apfstests/tests/generic/074
T
Dave Chinner 80015accd0 generic: more tests should clean up TESTDIR on success
I'm getting enospc errors on a 4GB test device after a while of
running. Part of the issue is that many tests can't or don't clean
up previous failed runs when they start or if the run to success.
Hence while we want to slowly age the test filesystem, we don't
really want that aging to unintentionally run the filesystem out of
space. To that end:

$ sudo du -s /mnt/test/* | sort -nr |head -10
1929160 /mnt/test/fsfile
512000  /mnt/test/247.8133
512000  /mnt/test/247.4713
512000  /mnt/test/247.4488
466752  /mnt/test/fstest.9850.2
40000   /mnt/test/resv
29804   /mnt/test/fsstress.12144.1
26208   /mnt/test/populate_root
26208   /mnt/test/mnt
23216   /mnt/test/fsstress.4491.1

We can see that there are a few tests that using most of the space.
These are often left behind due to kernel failures during tests or
reboots while tests are in progress, so make sure that they at least
clean up such mess the next time they run.

Test generic/247, xfs/020 (fsfile) and generic/074 (fstest.$$.n)
are the worst offenders, so just target these to being with.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-09-29 12:56:16 +10:00

183 lines
4.4 KiB
Bash
Executable File

#! /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
#
#-----------------------------------------------------------------------
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
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()
{
rm -rf $fstest_dir.* $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
_supported_fs generic
_supported_os IRIX Linux
_require_test
rm -f $seqres.full
fstest_dir=$TEST_DIR/fstest
_do_test()
{
_n="$1"
_param="$2"
out=$fstest_dir.$_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 >>$seqres.full
then
echo " fstest ($_param) returned $? - see $seqres.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
}
#
# 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" >>$seqres.full
echo "Params: n = $numchildren l = $numloops f = $numfiles" >>$seqres.full
_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"