2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
4 # Copyright (c) 2017 Google, Inc. All Rights Reserved.
5 # Copyright (c) 2019 Red Hat Inc. All Rights Reserved.
9 # Simple attr smoke tests for user EAs, dereived from generic/097.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
20 file=$TEST_DIR/foo.$seq
30 _getfattr --absolute-names "$@" |& _filter_test_dir
35 $SETFATTR_PROG "$@" |& _filter_test_dir
38 # get standard environment, filters and checks
43 # real QA test starts here
49 # remove previous $seqres.full before test
52 echo -e "\ncreate file foo.$seq"
56 echo -e "\nshould be no EAs for foo.$seq:"
59 echo -e "\nset EA <NOISE,woof>:"
60 setfattr -n user.NOISE -v woof $file
62 echo -e "\nset EA <COLOUR,blue>:"
63 setfattr -n user.COLOUR -v blue $file
65 echo -e "\nset EA <SIZE,small>:"
66 setfattr -n user.SIZE -v small $file
68 echo -e "\nlist the EAs for foo.$seq: NOISE, COLOUR, SIZE"
71 echo -e "\ncheck the list again for foo.$seq"
74 echo -e "\nunmount the FS and see if EAs are persistent"
77 echo -e "\ncheck the list again for foo.$seq after umount/mount"
80 echo -e "\nremove the COLOUR EA on foo.$seq"
81 setfattr -x user.COLOUR $file
83 echo -e "\nlist EAs for foo.$seq: NOISE, SIZE"
86 echo -e "\nget the value of the NOISE EA"
87 getfattr -n user.NOISE $file
89 echo -e "\nget the value of the COLOUR EA which was removed earlier"
90 getfattr -n user.COLOUR $file
92 echo -e "\nget the value of the SIZE EA"
93 getfattr -n user.SIZE $file
95 echo -e "\nlist all the EAs again: NOISE, SIZE"
98 echo -e "\nchange the value of the SIZE EA from small to huge"
99 setfattr -n user.SIZE -v huge $file
101 echo -e "\nget the SIZE EA which should now have value huge"
102 getfattr -n user.SIZE $file
104 echo -e "\nlist EAs: NOISE, SIZE"
107 echo -e "\nremove the SIZE EA from foo.$seq"
108 setfattr -x user.SIZE $file
110 echo -e "\nlist EAs: NOISE (SIZE EA has been removed)"
113 echo -e "\ntry removing non-existent EA named woof"
114 setfattr -x user.WOOF $file
116 echo -e "\ntry removing already removed EA SIZE"
117 setfattr -x user.SIZE $file
119 echo -e "\nlist EAs: NOISE"
122 echo -e "\ntry removing already removed EA COLOUR"
123 setfattr -x user.COLOUR $file
125 echo -e "\nlist EAs: NOISE"
128 echo -e "\nremove remaining EA NOISE"
129 setfattr -x user.NOISE $file
131 echo -e "\nlist EAs: should be no EAs left now"
134 echo -e "\nunmount the FS and see if EAs are persistent"
137 echo -e "\nlist EAs: should still be no EAs left"