[ "$MKFS_F2FS_PROG" = "" ] && _fatal "mkfs.f2fs not found"
;;
nfs)
+ . ./common/nfs
;;
cifs)
;;
ceph)
;;
+ glusterfs)
+ ;;
overlay)
;;
reiser4)
[ "$MKFS_REISER4_PROG" = "" ] && _fatal "mkfs.reiser4 not found"
;;
+ pvfs2)
+ ;;
+ ubifs)
+ [ "$UBIUPDATEVOL_PROG" = "" ] && _fatal "ubiupdatevol not found"
+ ;;
esac
if [ ! -z "$REPORT_LIST" ]; then
ceph)
# do nothing for ceph
;;
+ glusterfs)
+ # do nothing for glusterfs
+ ;;
overlay)
# do nothing for overlay
;;
+ pvfs2)
+ # do nothing for pvfs2
+ ;;
udf)
$MKFS_UDF_PROG $MKFS_OPTIONS $* $TEST_DEV > /dev/null
;;
overlay)
# do nothing for overlay
;;
+ pvfs2)
+ # do nothing for pvfs2
+ ;;
udf)
$MKFS_UDF_PROG $MKFS_OPTIONS $* 2>$tmp_dir.mkfserr 1>$tmp_dir.mkfsstd
;;
local mkfs_status
case $FSTYP in
- nfs*|cifs|ceph|overlay)
+ nfs*|cifs|ceph|overlay|glusterfs|pvfs2)
# unable to re-create this fstyp, just remove all files in
# $SCRATCH_MNT to avoid EEXIST caused by the leftover files
# created in previous runs
# do nothing for tmpfs
return 0
;;
+ ubifs)
+ # erase the UBI volume; reformated automatically on next mount
+ $UBIUPDATEVOL_PROG ${SCRATCH_DEV} -t
+ return 0
+ ;;
ext4)
_scratch_mkfs_ext4 $*
return $?
_notrun "All devs used no spare"
fi
# Get a dev that is not used
- local devs[]="( $SCRATCH_DEV_POOL_SAVED )"
+ local -a devs="( $SCRATCH_DEV_POOL_SAVED )"
SPARE_DEV=${devs[@]:$ndevs:1}
export SPARE_DEV
}
local test_ndevs=$1
local config_ndevs=`echo $SCRATCH_DEV_POOL| wc -w`
- local devs[]="( $SCRATCH_DEV_POOL )"
+ local -a devs="( $SCRATCH_DEV_POOL )"
typeset -p config_ndevs >/dev/null 2>&1
if [ $? -ne 0 ]; then
# Fix the filesystem type up here so that the callers don't
# have to bother with this quirk.
#
- _df_device $1 | $AWK_PROG '{ print $2 }' | sed -e 's/nfs4/nfs/'
+ _df_device $1 | $AWK_PROG '{ print $2 }' | \
+ sed -e 's/nfs4/nfs/' -e 's/fuse.glusterfs/glusterfs/'
}
# return the FS mount options of a mounted device
fi
}
+# returns device number if a file is a character device
+#
+_is_char_dev()
+{
+ if [ $# -ne 1 ]; then
+ echo "Usage: _is_char_dev dev" 1>&2
+ exit 1
+ fi
+
+ _dev=$1
+ if [ -L "${_dev}" ]; then
+ _dev=`readlink -f "${_dev}"`
+ fi
+
+ if [ -c "${_dev}" ]; then
+ src/lstat64 "${_dev}" | $AWK_PROG '/Device type:/ { print $9 }'
+ fi
+}
+
# Do a command, log it to $seqres.full, optionally test return status
# and die if command fails. If called with one argument _do executes the
# command, logs it, and returns its exit status. With two arguments _do
local type=$5
# find $dev as the source, and print result in "$dev $mnt" format
- local mount_rec=`findmnt -rnc -S $dev -o SOURCE,TARGET`
+ local mount_rec=`findmnt -rncv -S $dev -o SOURCE,TARGET`
[ -n "$mount_rec" ] || return 1 # 1 = not mounted
# if it's mounted, make sure its on $mnt
_require_scratch_nocheck()
{
case "$FSTYP" in
+ glusterfs)
+ echo $SCRATCH_DEV | egrep -q ":/?" > /dev/null 2>&1
+ if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then
+ _notrun "this test requires a valid \$SCRATCH_DEV"
+ fi
+ if [ ! -d "$SCRATCH_MNT" ]; then
+ _notrun "this test requires a valid \$SCRATCH_MNT"
+ fi
+ ;;
nfs*|ceph)
echo $SCRATCH_DEV | grep -q ":/" > /dev/null 2>&1
if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then
_notrun "this test requires a valid \$SCRATCH_MNT"
fi
;;
+ pvfs2)
+ echo $SCRATCH_DEV | grep -q "://" > /dev/null 2>&1
+ if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then
+ _notrun "this test requires a valid \$SCRATCH_DEV"
+ fi
+ if [ ! -d "$SCRATCH_MNT" ]; then
+ _notrun "this test requires a valid \$SCRATCH_MNT"
+ fi
+ ;;
cifs)
echo $SCRATCH_DEV | grep -q "//" > /dev/null 2>&1
if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then
_notrun "this test requires a valid \$SCRATCH_MNT and unique $SCRATCH_DEV"
fi
;;
+ ubifs)
+ # ubifs needs an UBI volume. This will be a char device, not a block device.
+ if [ ! -c "$SCRATCH_DEV" ]; then
+ _notrun "this test requires a valid UBI volume for \$SCRATCH_DEV"
+ fi
+ if [ ! -d "$SCRATCH_MNT" ]; then
+ _notrun "this test requires a valid \$SCRATCH_MNT"
+ fi
+ ;;
*)
if [ -z "$SCRATCH_DEV" -o "`_is_block_dev "$SCRATCH_DEV"`" = "" ]
then
_require_test()
{
case "$FSTYP" in
+ glusterfs)
+ echo $TEST_DEV | egrep -q ":/?" > /dev/null 2>&1
+ if [ -z "$TEST_DEV" -o "$?" != "0" ]; then
+ _notrun "this test requires a valid \$TEST_DEV"
+ fi
+ if [ ! -d "$TEST_DIR" ]; then
+ _notrun "this test requires a valid \$TEST_DIR"
+ fi
+ ;;
nfs*|ceph)
echo $TEST_DEV | grep -q ":/" > /dev/null 2>&1
if [ -z "$TEST_DEV" -o "$?" != "0" ]; then
_notrun "this test requires a valid \$TEST_DIR"
fi
;;
+ pvfs2)
+ echo $TEST_DEV | grep -q "://" > /dev/null 2>&1
+ if [ -z "$TEST_DEV" -o "$?" != "0" ]; then
+ _notrun "this test requires a valid \$TEST_DIR"
+ fi
+ if [ ! -d "$TEST_DIR" ]; then
+ _notrun "this test requires a valid \$TEST_DIR"
+ fi
+ ;;
overlay)
if [ -z "$OVL_BASE_TEST_DIR" -o ! -d "$OVL_BASE_TEST_DIR" ]; then
_notrun "this test requires a valid \$TEST_DIR as ovl base dir"
_notrun "this test requires a valid \$TEST_DIR and unique $TEST_DEV"
fi
;;
+ ubifs)
+ # ubifs needs an UBI volume. This will be a char device, not a block device.
+ if [ ! -c "$TEST_DEV" ]; then
+ _notrun "this test requires a valid UBI volume for \$TEST_DEV"
+ fi
+ if [ ! -d "$TEST_DIR" ]; then
+ _notrun "this test requires a valid \$TEST_DIR"
+ fi
+ ;;
*)
if [ -z "$TEST_DEV" ] || [ "`_is_block_dev "$TEST_DEV"`" = "" ]
then
fi
}
+# this test requires a path to refere to a local block or character device
+# $1 - device
+_require_local_device()
+{
+ if [ -z "$1" ]; then
+ echo "Usage: _require_local_device <dev>" 1>&2
+ exit 1
+ fi
+ if [ "`_is_block_dev "$1"`" != "" ]; then
+ return 0
+ fi
+ if [ "`_is_char_dev "$1"`" != "" ]; then
+ return 0
+ fi
+ _notrun "require $1 to be local device"
+}
+
# brd based ram disks erase the device when they receive a flush command when no
# active references are present. This causes problems for DM devices sitting on
# top of brd devices as DM doesn't hold active references to the brd device.
_notrun "External device testing in progress, skipped this test"
}
+# this test requires that the kernel supports asynchronous I/O
+_require_aio()
+{
+ $here/src/feature -A
+ case $? in
+ 0)
+ ;;
+ 1)
+ _notrun "kernel does not support asynchronous I/O"
+ ;;
+ *)
+ _fail "unexpected error testing for asynchronous I/O support"
+ ;;
+ esac
+}
+
# this test requires that a (specified) aio-dio executable exists
+# and that the kernel supports asynchronous I/O.
# $1 - command (optional)
#
_require_aiodio()
AIO_TEST=src/aio-dio-regress/$1
[ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
fi
+ _require_aio
_require_odirect
}
qa_group=$1
fi
_cat_group | grep -q $qa_group
- [ "$?" == "0" ] || _notrun "$qa_group user not defined."
+ [ "$?" == "0" ] || _notrun "$qa_group group not defined."
}
_filter_user_do()
echo "Usage: _require_xfs_io_command command [switch]" 1>&2
exit 1
fi
- command=$1
+ local command=$1
shift
- param="$*"
+ local param="$*"
+ local param_checked=0
testfile=$TEST_DIR/$$.xfs_io
case $command in
"chproj")
testio=`$XFS_IO_PROG -F -f -c "chproj 0" $testfile 2>&1`
;;
+ "copy_range")
+ testcopy=$TEST_DIR/$$.copy.xfs_io
+ $XFS_IO_PROG -F -f -c "pwrite 0 4k" $testfile > /dev/null 2>&1
+ testio=`$XFS_IO_PROG -F -f -c "copy_range $testfile" $testcopy 2>&1`
+ rm -f $testcopy > /dev/null 2>&1
+ ;;
"falloc" )
- testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1`
+ testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1`
+ param_checked=1
;;
"fpunch" | "fcollapse" | "zero" | "fzero" | "finsert" | "funshare")
testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
;;
"fiemap")
testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
- -c "fiemap -v" $testfile 2>&1`
+ -c "fiemap -v $param" $testfile 2>&1`
+ param_checked=1
;;
"flink" )
testio=`$XFS_IO_PROG -T -F -c "flink $testfile" \
testio=`$XFS_IO_PROG -f -c "utimes" 0 0 0 0 $testfile 2>&1`
;;
*)
- testio=`$XFS_IO_PROG -c "$command help" 2>&1`
+ testio=`$XFS_IO_PROG -c "help $command" 2>&1`
esac
rm -f $testfile 2>&1 > /dev/null
_notrun "xfs_io $command support is missing"
echo $testio | grep -q "Operation not supported" && \
_notrun "xfs_io $command failed (old kernel/wrong fs?)"
+ echo $testio | grep -q "Invalid" && \
+ _notrun "xfs_io $command failed (old kernel/wrong fs/bad args?)"
echo $testio | grep -q "foreign file active" && \
_notrun "xfs_io $command not supported on $FSTYP"
- test -z "$param" && return
- $XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
- _notrun "xfs_io $command doesn't support $param"
+ if [ -n "$param" -a $param_checked -eq 0 ]; then
+ $XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
+ _notrun "xfs_io $command doesn't support $param"
+ fi
}
# check that kernel and filesystem support direct I/O
ceph)
# no way to check consistency for CephFS
;;
+ glusterfs)
+ # no way to check consistency for GlusterFS
+ ;;
overlay)
# no way to check consistency for overlay
;;
+ pvfs2)
+ ;;
udf)
# do nothing for now
;;
tmpfs)
# no way to check consistency for tmpfs
;;
+ ubifs)
+ # there is no fsck program for ubifs yet
+ ;;
*)
_check_generic_filesystem $TEST_DEV
;;
ceph)
# no way to check consistency for CephFS
;;
+ glusterfs)
+ # no way to check consistency for GlusterFS
+ ;;
overlay)
# no way to check consistency for overlay
;;
+ pvfs2)
+ ;;
btrfs)
_check_btrfs_filesystem $device
;;
tmpfs)
# no way to check consistency for tmpfs
;;
+ ubifs)
+ # there is no fsck program for ubifs yet
+ ;;
*)
_check_generic_filesystem $device
;;
[ $result -eq 0 ] || _notrun "$FSTYP does not support freezing"
}
+# Does NFS export work on this fs?
+_require_exportfs()
+{
+ _require_test_program "open_by_handle"
+ mkdir -p "$TEST_DIR"/exportfs_test
+ $here/src/open_by_handle -c "$TEST_DIR"/exportfs_test 2>&1 \
+ || _notrun "$FSTYP does not support NFS export"
+}
+
+
# Does shutdown work on this fs?
_require_scratch_shutdown()
{
fi
case "$FSTYP" in
- ext2|vfat|msdos)
+ ext2|vfat|msdos|udf)
_notrun "$FSTYP does not support metadata journaling"
;;
ext4)
esac
}
-# Does fiemap support?
-_require_fiemap()
-{
- _require_xfs_io_command "fiemap"
-}
-
_count_extents()
{
$XFS_IO_PROG -c "fiemap" $1 | tail -n +2 | grep -v hole | wc -l
$XFS_IO_PROG -c "fiemap" $1 | tail -n +2 | grep hole | wc -l
}
+_count_attr_extents()
+{
+ $XFS_IO_PROG -c "fiemap -a" $1 | tail -n +2 | grep -v hole | wc -l
+}
+
# arg 1 is dev to remove and is output of the below eg.
# ls -l /sys/class/block/sdd | rev | cut -d "/" -f 3 | rev
_devmgt_remove()
_require_chattr()
{
- attribute=$1
-
- touch $TEST_DIR/syscalltest
- chattr "+$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1
- status=$?
- chattr "-$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1
- if [ "$status" -ne 0 ]; then
- _notrun "file system doesn't support chattr +$attribute"
- fi
- cat $TEST_DIR/syscalltest.out >> $seqres.full
+ if [ -z "$1" ]; then
+ echo "Usage: _require_chattr <attr>"
+ exit 1
+ fi
+ local attribute=$1
- rm -f $TEST_DIR/syscalltest.out
+ touch $TEST_DIR/syscalltest
+ chattr "+$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1
+ status=$?
+ chattr "-$attribute" $TEST_DIR/syscalltest > $TEST_DIR/syscalltest.out 2>&1
+ if [ "$status" -ne 0 ]; then
+ _notrun "file system doesn't support chattr +$attribute"
+ fi
+ cat $TEST_DIR/syscalltest.out >> $seqres.full
+ rm -f $TEST_DIR/syscalltest.out
}
_get_total_inode()
# use sed \cregexpc address type, since $seqnum contains "/"
dmesg | tac | sed -ne "0,\#run fstests $seqnum at $date_time#p" | \
tac | $filter >$seqres.dmesg
- grep -q -e "kernel BUG at" \
+ egrep -q -e "kernel BUG at" \
-e "WARNING:" \
-e "BUG:" \
-e "Oops:" \
-e "possible recursive locking detected" \
-e "Internal error" \
- -e "INFO: suspicious RCU usage" \
+ -e "(INFO|ERR): suspicious RCU usage" \
-e "INFO: possible circular locking dependency detected" \
-e "general protection fault:" \
$seqres.dmesg
fi
}
+_require_statx()
+{
+ $here/src/stat_test --check-statx ||
+ _notrun "This test requires the statx system call"
+}
+
# Write "content" into /sys/fs/$FSTYP/$DEV/$ATTR
#
# All arguments are necessary, and in this order: