mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
53b73199db
This test performs btrfs device replace tests with all possible profiles (single/dup/mixed/raid0/raid1/raid10), one round with the '-r' option to 'btrfs replace start' and one round without this option. The cancelation is tested only once and with the dup/single profile for metadata/data. This test takes 181 seconds on my SSD equiped test box and 237s on spinning disks. Almost all the time is spent when the filesystem is populated with test data. The replace operation itself takes less than a second for all the tests, except for the test that is marked as 'thorough' which will run for about 8 seconds on my test box. The amount of tests done depends on the number of devices in the SCRATCH_DEV_POOL. For full test coverage, at least 5 devices should be available (e.g. 5 partitions). With less than 2 entries in SCRATCH_DEV_POOL, the test is not executed. The source and target devices for the replace operation are arbitrarily chosen out of SCRATCH_DEV_POOl. Since the target device mustn't be smaller than the source device, the requirement for this test is that all devices have _exactly_ the same size. If this is not the case, the test terminates with _notrun. To check the filesystems after replacing a device, a scrub run is performed, a btrfsck run, and finally the filesystem is remounted. This commit depends on my other commit: "xfstest: don't remove the two first devices from SCRATCH_DEV_POOL" [rjohnston: renumbered to btrfs/011] Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> Reviewed-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Rich Johnston <rjohnston@sgi.com>
289 lines
9.2 KiB
Plaintext
289 lines
9.2 KiB
Plaintext
##/bin/bash
|
|
#
|
|
# Copyright (c) 2000-2003,2006 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
|
|
#
|
|
#
|
|
# setup and check for config parameters, and in particular
|
|
#
|
|
# EMAIL - email of the script runner.
|
|
# TEST_DIR - scratch test directory that is in an already
|
|
# mounted XFS file system, needs to be be world
|
|
# writeable
|
|
# TEST_DEV - device for file system containing TEST_DIR
|
|
#
|
|
# and optionally:
|
|
# SCRATCH_DEV - device you can make a scratch file system on
|
|
# SCRATCH_MNT - mount point for scratch file system
|
|
# SCRATCH_LOGDEV - scratch log device for external log testing
|
|
# SCRATCH_RTDEV - scratch rt dev
|
|
# TEST_LOGDEV - test log device for external log testing
|
|
# TEST_RTDEV - test rt dev
|
|
# TAPE_DEV - the tape device for the xfsdump tests
|
|
# RMT_TAPE_DEV - the remote tape device for the xfsdump tests
|
|
# RMT_IRIXTAPE_DEV- the IRIX remote tape device for the xfsdump tests
|
|
# RMT_TAPE_USER - remote user for tape device
|
|
#
|
|
# - These can be added to $HOST_CONFIG_DIR (witch default to ./config)
|
|
# below or a separate local configuration file can be used (using
|
|
# the HOST_OPTIONS variable).
|
|
# - This script is shared by the stress test system and the auto-qa
|
|
# system
|
|
# - TEST_DEV & TEST_DIR must be assigned.
|
|
# - this script shouldn't make any assertions about filesystem
|
|
# validity or mountedness.
|
|
#
|
|
|
|
# all tests should use a common language setting to prevent golden
|
|
# output mismatches.
|
|
export LANG=C
|
|
|
|
# Warning: don't put freeware before /usr/bsd on IRIX coz you'll
|
|
# get the wrong hostname and set your system name to -s :)
|
|
[ -d /usr/bsd ] && PATH=$PATH:/usr/bsd
|
|
[ -d /usr/freeware/bin ] && PATH=$PATH:/usr/freeware/bin
|
|
PATH=".:$PATH"
|
|
|
|
export HOST=`hostname -s`
|
|
export HOSTOS=`uname -s`
|
|
[ "$HOSTOS" = "IRIX64" ] && export HOSTOS="IRIX"
|
|
|
|
export MODULAR=0 # using XFS as a module or not
|
|
export BOOT="/boot" # install target for kernels
|
|
export EXTRA=${EXTRA:=xfs-qa}
|
|
|
|
# general parameters (mainly for auto-qa)
|
|
export SOAK_PROC=3 # -p option to fsstress
|
|
export SOAK_STRESS=10000 # -n option to fsstress
|
|
export SOAK_PASSES=-1 # count of repetitions of fsstress (while soaking)
|
|
export EMAIL=root@localhost # where auto-qa will send its status messages
|
|
export HOST_OPTIONS=${HOST_OPTIONS:=local.config}
|
|
export CHECK_OPTIONS=${CHECK_OPTIONS:="-g auto"}
|
|
export BENCH_PASSES=${BENCH_PASSES:=5}
|
|
export XFS_MKFS_OPTIONS=${XFS_MKFS_OPTIONS:=-bsize=4096}
|
|
export TIME_FACTOR=${TIME_FACTOR:=1}
|
|
export LOAD_FACTOR=${LOAD_FACTOR:=1}
|
|
export DEBUGFS_MNT=${DEBUGFS_MNT:="/sys/kernel/debug"}
|
|
|
|
export PWD=`pwd`
|
|
#export DEBUG=${DEBUG:=...} # arbitrary CFLAGS really.
|
|
export MALLOCLIB=${MALLOCLIB:=/usr/lib/libefence.a}
|
|
export LOCAL_CONFIGURE_OPTIONS=${LOCAL_CONFIGURE_OPTIONS:=--enable-readline=yes}
|
|
|
|
# $1 = prog to look for, $2* = default pathnames if not found in $PATH
|
|
set_prog_path()
|
|
{
|
|
p=`which $1 2> /dev/null`
|
|
if [ -n "$p" -a -x "$p" ]; then
|
|
echo $p
|
|
return 0
|
|
fi
|
|
p=$1
|
|
|
|
shift
|
|
for f; do
|
|
if [ -x $f ]; then
|
|
echo $f
|
|
return 0
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
return 1
|
|
}
|
|
|
|
# Handle mkfs.btrfs which does (or does not) require -f to overwrite
|
|
set_btrfs_mkfs_prog_path_with_opts()
|
|
{
|
|
p=`set_prog_path mkfs.btrfs`
|
|
if [ "$p" != "" ] && grep -q 'force overwrite' $p; then
|
|
echo "$p -f"
|
|
else
|
|
echo $p
|
|
fi
|
|
}
|
|
|
|
_fatal()
|
|
{
|
|
echo "$*"
|
|
status=1
|
|
exit 1
|
|
}
|
|
|
|
export MKFS_PROG="`set_prog_path mkfs`"
|
|
[ "$MKFS_PROG" = "" ] && _fatal "mkfs not found"
|
|
|
|
export MOUNT_PROG="`set_prog_path mount`"
|
|
[ "$MOUNT_PROG" = "" ] && _fatal "mount not found"
|
|
|
|
export UMOUNT_PROG="`set_prog_path umount`"
|
|
[ "$UMOUNT_PROG" = "" ] && _fatal "umount not found"
|
|
|
|
export FSSTRESS_PROG="`set_prog_path fsstress $PWD/ltp/fsstress`"
|
|
[ "$FSSTRESS_PROG" = "" ] && _fatal "fsstress not found"
|
|
|
|
export PERL_PROG="`set_prog_path perl`"
|
|
[ "$PERL_PROG" = "" ] && _fatal "perl not found"
|
|
|
|
export AWK_PROG="`set_prog_path awk`"
|
|
[ "$AWK_PROG" = "" ] && _fatal "awk not found"
|
|
|
|
export SED_PROG="`set_prog_path sed`"
|
|
[ "$SED_PROG" = "" ] && _fatal "sed not found"
|
|
|
|
export BC_PROG="`set_prog_path bc`"
|
|
[ "$BC_PROG" = "" ] && _fatal "bc not found"
|
|
|
|
export PS_ALL_FLAGS="-ef"
|
|
|
|
export DF_PROG="`set_prog_path df`"
|
|
[ "$DF_PROG" = "" ] && _fatal "df not found"
|
|
[ "$HOSTOS" = "Linux" ] && export DF_PROG="$DF_PROG -T"
|
|
|
|
export XFS_LOGPRINT_PROG="`set_prog_path xfs_logprint`"
|
|
export XFS_REPAIR_PROG="`set_prog_path xfs_repair`"
|
|
export XFS_DB_PROG="`set_prog_path xfs_db`"
|
|
export XFS_GROWFS_PROG=`set_prog_path xfs_growfs`
|
|
export XFS_IO_PROG="`set_prog_path xfs_io`"
|
|
export XFS_PARALLEL_REPAIR_PROG="`set_prog_path xfs_prepair`"
|
|
export XFS_PARALLEL_REPAIR64_PROG="`set_prog_path xfs_prepair64`"
|
|
export __XFSDUMP_PROG="`set_prog_path xfsdump`"
|
|
export XFSDUMP_PROG="$__XFSDUMP_PROG -e"
|
|
export XFSRESTORE_PROG="`set_prog_path xfsrestore`"
|
|
export XFSINVUTIL_PROG="`set_prog_path xfsinvutil`"
|
|
export GETFATTR_PROG="`set_prog_path getfattr`"
|
|
export SETFATTR_PROG="`set_prog_path setfattr`"
|
|
export ATTR_PROG="`set_prog_path attr`"
|
|
export QUOTA_PROG="`set_prog_path quota`"
|
|
export XFS_QUOTA_PROG="`set_prog_path xfs_quota`"
|
|
export KILLALL_PROG="`set_prog_path killall`"
|
|
export INDENT_PROG="`set_prog_path indent`"
|
|
export XFS_COPY_PROG="`set_prog_path xfs_copy`"
|
|
export FSTRIM_PROG="`set_prog_path fstrim`"
|
|
export DUMPE2FS_PROG="`set_prog_path dumpe2fs`"
|
|
export FIO_PROG="`set_prog_path fio`"
|
|
export FILEFRAG_PROG="`set_prog_path filefrag`"
|
|
export E4DEFRAG_PROG="`set_prog_path e4defrag`"
|
|
export LOGGER_PROG="`set_prog_path logger`"
|
|
export DBENCH_PROG="`set_prog_path dbench`"
|
|
export DMSETUP_PROG="`set_prog_path dmsetup`"
|
|
|
|
# Generate a comparable xfsprogs version number in the form of
|
|
# major * 10000 + minor * 100 + release
|
|
#
|
|
# $ xfs_db -V
|
|
# xfs_db version 2.9.7
|
|
#
|
|
# so, 2.9.7 = 20907
|
|
_version=`$XFS_DB_PROG -V | $AWK_PROG '
|
|
/version/ {
|
|
if (split($3,ver,".") == 3)
|
|
print (ver[1] * 10000) + (ver[2] * 100) + ver[3];
|
|
}'`
|
|
[ -z "$_version" ] && _fatal "xfsprogs version cannot be found"
|
|
export XFSPROGS_VERSION="$_version"
|
|
|
|
case "$HOSTOS" in
|
|
IRIX*)
|
|
export MKFS_XFS_PROG="`set_prog_path mkfs_xfs`"
|
|
export MKFS_UDF_PROG="`set_prog_path mkfs_udf`"
|
|
export XFS_FSR_PROG="`set_prog_path /usr/etc/fsr_xfs`"
|
|
export MKFS_NFS_PROG="false"
|
|
;;
|
|
Linux)
|
|
export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
|
|
export MKFS_UDF_PROG="`set_prog_path mkudffs`"
|
|
export MKFS_BTRFS_PROG="`set_btrfs_mkfs_prog_path_with_opts`"
|
|
export BTRFS_UTIL_PROG="`set_prog_path btrfs`"
|
|
export BTRFS_SHOW_SUPER_PROG="`set_prog_path btrfs-show-super`"
|
|
export XFS_FSR_PROG="`set_prog_path xfs_fsr`"
|
|
export MKFS_NFS_PROG="false"
|
|
;;
|
|
esac
|
|
|
|
known_hosts()
|
|
{
|
|
[ "$HOST_CONFIG_DIR" ] || HOST_CONFIG_DIR=`pwd`/configs
|
|
|
|
[ -f /etc/xfsqa.config ] && export HOST_OPTIONS=/etc/xfsqa.config
|
|
[ -f $HOST_CONFIG_DIR/$HOST ] && export HOST_OPTIONS=$HOST_CONFIG_DIR/$HOST
|
|
[ -f $HOST_CONFIG_DIR/$HOST.config ] && export HOST_OPTIONS=$HOST_CONFIG_DIR/$HOST.config
|
|
}
|
|
|
|
if [ ! -f "$HOST_OPTIONS" ]; then
|
|
known_hosts
|
|
fi
|
|
|
|
if [ -f "$HOST_OPTIONS" ]; then
|
|
. $HOST_OPTIONS
|
|
fi
|
|
|
|
get_next_config() {
|
|
# set default RESULT_BASE
|
|
if [ -z "$RESULT_BASE" ]; then
|
|
export RESULT_BASE="$here/results/"
|
|
fi
|
|
|
|
# Mandatory Config values.
|
|
MC=""
|
|
[ -z "$EMAIL" ] && MC="$MC EMAIL"
|
|
[ -z "$TEST_DIR" ] && MC="$MC TEST_DIR"
|
|
[ -z "$TEST_DEV" ] && MC="$MC TEST_DEV"
|
|
|
|
if [ -n "$MC" ]; then
|
|
echo "Warning: need to define parameters for host $HOST"
|
|
echo " or set variables:"
|
|
echo " $MC"
|
|
exit 1
|
|
fi
|
|
|
|
echo $TEST_DEV | grep -q ":" > /dev/null 2>&1
|
|
if [ ! -b "$TEST_DEV" -a "$?" != "0" ]; then
|
|
echo "common/config: Error: \$TEST_DEV ($TEST_DEV) is not a block device or a NFS filesystem"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -d "$TEST_DIR" ]; then
|
|
echo "common/config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
|
|
exit 1
|
|
fi
|
|
|
|
# a btrfs tester will set only SCRATCH_DEV_POOL, we will put first of its dev
|
|
# to SCRATCH_DEV and rest to SCRATCH_DEV_POOL to maintain the backward compatibility
|
|
if [ ! -z "$SCRATCH_DEV_POOL" ]; then
|
|
if [ ! -z "$SCRATCH_DEV" ]; then
|
|
echo "common/config: Error: \$SCRATCH_DEV should be unset when \$SCRATCH_DEV_POOL is set"
|
|
exit 1
|
|
fi
|
|
SCRATCH_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'`
|
|
fi
|
|
|
|
echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
|
|
if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]; then
|
|
echo "common/config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a block device or a NFS filesystem"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -z "$SCRATCH_MNT" -a ! -d "$SCRATCH_MNT" ]; then
|
|
echo "common/config: Error: \$SCRATCH_MNT ($SCRATCH_MNT) is not a directory"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
get_next_config
|
|
|
|
# make sure this script returns success
|
|
/bin/true
|