| #! /bin/bash |
| # 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. |
| # |
| seq=`basename $0` |
| seqres=$RESULT_DIR/$seq |
| 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 |
| |
| file=$TEST_DIR/foo |
| |
| _cleanup() |
| { |
| rm -f $tmp.* $file |
| } |
| |
| getfattr() |
| { |
| _getfattr --absolute-names "$@" |& _filter_test_dir |
| } |
| |
| setfattr() |
| { |
| $SETFATTR_PROG "$@" |& _filter_test_dir |
| } |
| |
| # get standard environment, filters and checks |
| . ./common/rc |
| . ./common/attr |
| . ./common/filter |
| |
| # real QA test starts here |
| _supported_fs generic |
| |
| _require_test |
| _require_attrs user trusted |
| |
| echo -e "\ncreate file foo" |
| rm -f $file |
| touch $file |
| |
| echo -e "\n*** Test out the trusted namespace ***" |
| |
| echo -e "\nset EA <trusted:colour,marone>:" |
| setfattr -n trusted.colour -v marone $file |
| |
| echo -e "\nset EA <user:colour,beige>:" |
| setfattr -n user.colour -v beige $file |
| |
| echo -e "\nset EA <user:vomit,pizza>:" |
| setfattr -n user.vomit -v pizza $file |
| |
| echo -e "\nset EA <trusted:noise,whack>:" |
| setfattr -n trusted.noise -v whack $file |
| |
| echo -e "\nlist trusted EAs: <trusted:colour,noise>:" |
| getfattr -d -m '^trusted\.' $file |
| |
| echo -e "\nlist user EAs: <user:colour,vomit>:" |
| getfattr -d $file |
| |
| echo -e "\nget trusted EA colour: marone" |
| getfattr -n trusted.colour $file |
| |
| echo -e "\nget trusted EA noise: whack" |
| getfattr -n trusted.noise $file |
| |
| echo -e "\nget trusted EA vomit which is a user EA => find nothing" |
| getfattr -n trusted.vomit $file |
| |
| echo -e "\nunmount the FS and see if EAs are persistent" |
| _test_cycle_mount |
| |
| echo -e "\nget trusted EA colour: marone" |
| getfattr -n trusted.colour $file |
| |
| echo -e "\nget trusted EA noise: whack" |
| getfattr -n trusted.noise $file |
| |
| echo -e "\nget user EA vomit: pizza" |
| getfattr -n user.vomit $file |
| |
| echo -e "\nremove the trusted colour EA" |
| setfattr -x trusted.colour $file |
| |
| echo -e "\nlist trusted EAs: <trusted:noise>:" |
| getfattr -d -m '^trusted\.' $file |
| |
| echo -e "\nlist user EAs: <user:colour,vomit>:" |
| getfattr -d $file |
| |
| echo -e "\nremove the final trusted EA noise" |
| setfattr -x trusted.noise $file |
| |
| echo -e "\nlist trusted EAs: none" |
| getfattr -d -m '^trusted\.' $file |
| |
| # success, all done |
| status=0 |
| exit |