##/bin/bash
-#
+# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2000-2002,2005 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
-#
-#
# Functions useful for xfsdump/xfsrestore tests
-#
# --- initializations ---
rm -f $seqres.full
# Use dump/restore in qa directory (copy them here) for debugging
export PATH="$here:$PATH"
- export __XFSDUMP_PROG="`set_prog_path xfsdump`"
+ export __XFSDUMP_PROG=$(type -P xfsdump)
export XFSDUMP_PROG="$__XFSDUMP_PROG -e"
- export XFSRESTORE_PROG="`set_prog_path xfsrestore`"
- export XFSINVUTIL_PROG="`set_prog_path xfsinvutil`"
+ export XFSRESTORE_PROG=$(type -P xfsrestore)
+ export XFSINVUTIL_PROG=$(type -P xfsinvutil)
[ -x $here/xfsdump ] && echo "Using xfstests' xfsdump for debug"
[ -x $here/xfsrestore ] && echo "Using xfstests' xfsrestore for debug"
[ -x $here/xfsinvutil ] && echo "Using xfstests' xfsinvutil for debug"
nobody=4 # define this uid/gid as a number
do_quota_check=true # do quota check if quotas enabled
-# install our cleaner
-trap "_cleanup; exit \$status" 0 1 2 3 15
-
# start inventory from a known base - move it aside for test
for dir in /var/xfsdump/inventory /var/lib/xfsdump/inventory; do
if [ -d $dir ]; then
# Cleanup created dirs and files
# Called by trap
#
-_cleanup()
+_cleanup_dump()
{
# Some tests include this before checking _supported_fs xfs
# and the sleeps & checks here get annoying
fi
cd $here
- rm -f $tmp.*
if [ -n "$DEBUGDUMP" ]; then
# save it for inspection
mv $dir.$seq $dir
done
- if [ $status -ne $NOTRUNSTS ]; then
+ if [ -f ${RESULT_DIR}/require_scratch ] && [ $status -ne $NOTRUNSTS ]; then
# Sleep added to stop _check_scratch_fs from complaining that the
# scratch_dev is still busy
sleep 10
if $FSSTRESS_PROG | grep -q deduperange; then
FSSTRESS_AVOID="-f deduperange=0 $FSSTRESS_AVOID"
fi
+ if $FSSTRESS_PROG | grep -q copyrange; then
+ FSSTRESS_AVOID="-f copyrange=0 $FSSTRESS_AVOID"
+ fi
+ if $FSSTRESS_PROG | grep -q splice; then
+ FSSTRESS_AVOID="-f splice=0 $FSSTRESS_AVOID"
+ fi
echo ""
echo "-----------------------------------------------"
-e 's/id:[[:space:]]*[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/ID: ID/' \
-e 's/\[y\/n\][- ]----------------------*/\[y\/n\]/' \
-e '/skip attribute set/d' \
+ -e '/xfsrestore: NOTE: attempt to reserve [0-9]* bytes for.*Operation not supported/d' \
| perl -ne '
# filter out all the output between the lines "Dump Summary:"
# and "Dump Status:"
print "Found extra:", $0
}
next
+ }
+ $0 ~ "Restore Status: INCOMPLETE" {
+ incomplete = 1
}
{ print }
END {
- if (uquota && !found_uquota) {
+ if (uquota && !found_uquota && !incomplete) {
print "Missing user quota msg:", usermsg
}
- if (gquota && !found_gquota) {
+ if (gquota && !found_gquota && !incomplete) {
print "Missing group quota msg:", groupmsg
}
- if (pquota && !found_pquota) {
+ if (pquota && !found_pquota && !incomplete) {
print "Missing project quota msg:", projectmsg
}
}
_check_quota 'xfsdump_quotas' 'xfsdump_quotas_group' 'xfsdump_quotas_proj'
}
+_count_dir_files()
+{
+ local dir=$1
+
+ local ndirs=$(find $dir -type d | wc -l)
+ local nents=$(find $dir | wc -l)
+
+ echo "$ndirs directories and $nents entries"
+}
+
+_count_dumpdir_files()
+{
+ _count_dir_files $dump_dir
+}
+
+_count_restoredir_files()
+{
+ _count_dir_files $restore_dir/$dump_sdir
+}
+
# make sure this script returns success
/bin/true