Files
apfstests/tests/generic/097
T

115 lines
2.3 KiB
Bash
Raw Normal View History

#! /bin/bash
2018-06-09 11:35:42 +10:00
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
# Copyright (c) 2017 Google, Inc. All Rights Reserved.
#
# 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
#
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
{
_getfattr --absolute-names "$@" |& _filter_test_dir
2017-07-20 21:22:04 -07:00
}
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
2004-09-15 05:57:50 +00:00
_require_test
2020-09-10 19:43:55 +00:00
_require_attrs user trusted
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 "\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