Files
apfstests/tests/generic/097
T

216 lines
5.0 KiB
Bash
Raw Normal View History

#! /bin/bash
# FS QA Test No. 097. Modifed from UDFQA test 033.
#
# simple attr tests for EAs:
# - set
# - get
# - list
# - remove
# Basic testing.
2009-05-12 13:24:15 -05:00
#
#-----------------------------------------------------------------------
# Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
2017-07-20 21:22:04 -07:00
# Copyright (c) 2017 Google, Inc. All Rights Reserved.
2009-05-12 13:24:15 -05:00
#
# 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
#
#-----------------------------------------------------------------------
#
2004-09-15 05:57:50 +00:00
seq=`basename $0`
seqres=$RESULT_DIR/$seq
2004-09-15 05:57:50 +00:00
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
2017-07-20 21:22:04 -07:00
file=$TEST_DIR/foo
2004-09-15 05:57:50 +00:00
_cleanup()
{
2017-07-20 21:22:04 -07:00
rm -f $tmp.* $file
2004-09-15 05:57:50 +00:00
}
2017-07-20 21:22:04 -07:00
getfattr()
2004-09-15 05:57:50 +00:00
{
2017-07-20 21:22:04 -07:00
$GETFATTR_PROG --absolute-names "$@" |& _filter_test_dir
}
setfattr()
{
$SETFATTR_PROG "$@" |& _filter_test_dir
2004-09-15 05:57:50 +00:00
}
# get standard environment, filters and checks
2013-03-15 12:28:04 +00:00
. ./common/rc
2017-07-20 21:22:04 -07:00
. ./common/attr
2013-03-15 12:28:04 +00:00
. ./common/filter
2004-09-15 05:57:50 +00:00
# real QA test starts here
2009-05-28 11:37:38 -05:00
_supported_fs generic
2017-07-20 21:22:04 -07:00
_supported_os Linux
2004-09-15 05:57:50 +00:00
_require_test
_require_attrs
2017-07-20 21:22:04 -07:00
echo -e "\ncreate file foo"
rm -f $file
touch $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nshould be no EAs for foo:"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nset EA <noise,woof>:"
setfattr -n user.noise -v woof $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nset EA <colour,blue>:"
setfattr -n user.colour -v blue $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nset EA <size,small>:"
setfattr -n user.size -v small $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist the EAs for foo: noise, colour, size"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\ncheck the list again for foo"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nunmount the FS and see if EAs are persistent"
_test_cycle_mount
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\ncheck the list again for foo after umount/mount"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nremove the colour EA on foo"
setfattr -x user.colour $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist EAs for foo: noise, size"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nget the value of the noise EA"
getfattr -n user.noise $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nget the value of the colour EA which was removed earlier"
getfattr -n user.colour $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nget the value of the size EA"
getfattr -n user.size $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist all the EAs again: noise, size"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nchange the value of the size EA from small to huge"
setfattr -n user.size -v huge $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nget the size EA which should now have value huge"
getfattr -n user.size $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist EAs: noise, size"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nremove the size EA from foo"
setfattr -x user.size $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist EAs: noise (size EA has been removed)"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\ntry removing non-existent EA named woof"
setfattr -x user.woof $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\ntry removing already removed EA size"
setfattr -x user.size $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist EAs: noise"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\ntry removing already removed EA colour"
setfattr -x user.colour $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist EAs: noise"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nremove remaining EA noise"
setfattr -x user.noise $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist EAs: should be no EAs left now"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nunmount the FS and see if EAs are persistent"
_test_cycle_mount
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist EAs: should still be no EAs left"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\n*** Test out the trusted namespace ***"
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nset EA <trusted:colour,marone>:"
setfattr -n trusted.colour -v marone $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nset EA <user:colour,beige>:"
setfattr -n user.colour -v beige $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nset EA <user:vomit,pizza>:"
setfattr -n user.vomit -v pizza $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nset EA <trusted:noise,whack>:"
setfattr -n trusted.noise -v whack $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist trusted EAs: <trusted:colour,noise>:"
getfattr -d -m '^trusted\.' $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist user EAs: <user:colour,vomit>:"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nget trusted EA colour: marone"
getfattr -n trusted.colour $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nget trusted EA noise: whack"
getfattr -n trusted.noise $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nget trusted EA vomit which is a user EA => find nothing"
getfattr -n trusted.vomit $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nunmount the FS and see if EAs are persistent"
_test_cycle_mount
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nget trusted EA colour: marone"
getfattr -n trusted.colour $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nget trusted EA noise: whack"
getfattr -n trusted.noise $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nget user EA vomit: pizza"
getfattr -n user.vomit $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nremove the trusted colour EA"
setfattr -x trusted.colour $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist trusted EAs: <trusted:noise>:"
getfattr -d -m '^trusted\.' $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist user EAs: <user:colour,vomit>:"
getfattr -d $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nremove the final trusted EA noise"
setfattr -x trusted.noise $file
2004-09-15 05:57:50 +00:00
2017-07-20 21:22:04 -07:00
echo -e "\nlist trusted EAs: none"
getfattr -d -m '^trusted\.' $file
2004-09-15 05:57:50 +00:00
# success, all done
status=0
exit