mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
xfstests: move generic tests out of top level dir
And into tests/generic. Tests were found simply by grepping for the __supported_fs field in the tests. Output starts to look like: $ sudo ./check -g quick -r FSTYP -- xfs (debug) PLATFORM -- Linux/x86_64 test-1 3.5.0-rc5-dgc+ MKFS_OPTIONS -- -f -bsize=4096 /dev/vdb MOUNT_OPTIONS -- /dev/vdb /mnt/scratch ./242 1s ./183 2s generic/236 1s generic/014 1s generic/258 0s ./096 1s generic/245 0s ^C Ran: ./242 ./183 generic/236 generic/014 generic/258 ./096 generic/245 Passed all 7 tests Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Phil White <pwhite@sgi.com> [rjohnston@sgi.com added TOT changes] Signed-off-by: Rich Johnston <rjohnston@sgi.com>
This commit is contained in:
committed by
Rich Johnston
parent
35424188a9
commit
797e625f28
Executable
+184
@@ -0,0 +1,184 @@
|
||||
#! /bin/bash
|
||||
# FS QA Test No. 020
|
||||
#
|
||||
# extended attributes
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright (c) 2000-2002 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`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
tmp=/tmp/$$
|
||||
status=0 # success is the default!
|
||||
trap "_cleanup; rm -f $tmp.* $testfile; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
. ./common.attr
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
_cleanup_testdir
|
||||
}
|
||||
|
||||
_filter()
|
||||
{
|
||||
sed "s#$testdir[^ :]*#<TESTFILE>#g;
|
||||
s#$tmp[^ :]*#<TMPFILE>#g" $1
|
||||
}
|
||||
|
||||
_attr()
|
||||
{
|
||||
$ATTR_PROG $* 2>$tmp.err >$tmp.out
|
||||
exit=$?
|
||||
_filter $tmp.out
|
||||
_filter $tmp.err 1>&2
|
||||
return $exit
|
||||
}
|
||||
|
||||
_getfattr()
|
||||
{
|
||||
$GETFATTR_PROG $* 2>$tmp.err >$tmp.out
|
||||
exit=$?
|
||||
_filter $tmp.out
|
||||
_filter $tmp.err 1>&2
|
||||
return $exit
|
||||
}
|
||||
|
||||
_attr_list()
|
||||
{
|
||||
file=$1
|
||||
|
||||
echo " *** print attributes"
|
||||
if ! _getfattr -d -e text --absolute-names $file
|
||||
then
|
||||
echo " !!! error return"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# real QA test starts here
|
||||
_supported_fs generic
|
||||
_supported_os Linux
|
||||
|
||||
_require_attrs
|
||||
|
||||
_setup_testdir
|
||||
|
||||
rm -f $seq.full
|
||||
|
||||
testfile=$testdir/attribute_$$
|
||||
|
||||
echo "*** list non-existant file"
|
||||
_attr_list $testfile
|
||||
|
||||
echo "*** list empty file"
|
||||
touch $testfile
|
||||
_attr_list $testfile
|
||||
|
||||
echo "*** query non-existant attribute"
|
||||
_attr -g "nonexistant" $testfile 2>&1
|
||||
|
||||
echo "*** one attribute"
|
||||
echo "fish" | _attr -s fish $testfile
|
||||
_attr_list $testfile
|
||||
|
||||
echo "*** replace attribute"
|
||||
echo "fish3" | _attr -s fish $testfile
|
||||
_attr_list $testfile
|
||||
|
||||
echo "*** add attribute"
|
||||
echo "fish2" | _attr -s snrub $testfile
|
||||
_attr_list $testfile
|
||||
|
||||
echo "*** remove attribute"
|
||||
_attr -r fish $testfile
|
||||
_attr_list $testfile
|
||||
|
||||
echo "*** add lots of attributes"
|
||||
v=0
|
||||
|
||||
while [ $v -lt $MAX_ATTRS ]
|
||||
do
|
||||
echo -n "value_$v" | attr -s "attribute_$v" $testfile >>$seq.full
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "!!! failed to add \"attribute_$v\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
let "v = v + 1"
|
||||
done
|
||||
|
||||
echo "*** check"
|
||||
# don't print it all out...
|
||||
getfattr --absolute-names $testfile \
|
||||
| tee -a $seq.full \
|
||||
| $AWK_PROG '
|
||||
/^#/ { next }
|
||||
/^[ ]*$/ { next }
|
||||
{ l++ }
|
||||
END {print " *** " (l - 1) " attribute(s)" }' \
|
||||
| sed s/$MAX_ATTRS/MAX_ATTRS/
|
||||
|
||||
echo "*** remove lots of attributes"
|
||||
v=0
|
||||
while [ $v -lt $MAX_ATTRS ]
|
||||
do
|
||||
if ! $ATTR_PROG -r "attribute_$v" $testfile >>$seq.full
|
||||
then
|
||||
echo "!!! failed to remove \"attribute_$v\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
let "v = v + 1"
|
||||
done
|
||||
|
||||
_attr_list $testfile
|
||||
|
||||
echo "*** really long value"
|
||||
dd if=/dev/zero bs=1 count=$MAX_ATTRVAL_SIZE 2>/dev/null \
|
||||
| _attr -s "long_attr" $testfile >/dev/null
|
||||
|
||||
OCTAL_SIZE=`echo "obase=8; $MAX_ATTRVAL_SIZE" | bc`
|
||||
_attr -q -g "long_attr" $testfile | od -t x1 | sed -e "s/^0*$OCTAL_SIZE$/ATTRSIZE/"
|
||||
_attr -r "long_attr" $testfile >/dev/null
|
||||
|
||||
|
||||
echo "*** set/get/remove really long names (expect failure)"
|
||||
short="XXXXXXXXXX"
|
||||
long="$short$short$short$short$short$short$short$short$short$short"
|
||||
vlong="$long$long$long"
|
||||
|
||||
_attr -s $vlong -V fish $testfile 2>&1 >/dev/null
|
||||
_attr -g $vlong $testfile 2>&1 >/dev/null
|
||||
_attr -r $vlong $testfile 2>&1 >/dev/null
|
||||
|
||||
echo "*** check final"
|
||||
|
||||
_attr_list $testfile
|
||||
|
||||
echo "*** delete"
|
||||
rm -f $testfile
|
||||
|
||||
exit
|
||||
Reference in New Issue
Block a user