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
50 # remove previous $seqres.full before test
53 echo -e "\ncreate file foo.$seq"
57 echo -e "\nshould be no EAs for foo.$seq:"
60 echo -e "\nset EA <NOISE,woof>:"
61 setfattr -n user.NOISE -v woof $file
63 echo -e "\nset EA <COLOUR,blue>:"
64 setfattr -n user.COLOUR -v blue $file
66 echo -e "\nset EA <SIZE,small>:"
67 setfattr -n user.SIZE -v small $file
69 echo -e "\nlist the EAs for foo.$seq: NOISE, COLOUR, SIZE"
72 echo -e "\ncheck the list again for foo.$seq"
75 echo -e "\nunmount the FS and see if EAs are persistent"
78 echo -e "\ncheck the list again for foo.$seq after umount/mount"
81 echo -e "\nremove the COLOUR EA on foo.$seq"
82 setfattr -x user.COLOUR $file
84 echo -e "\nlist EAs for foo.$seq: NOISE, SIZE"
87 echo -e "\nget the value of the NOISE EA"
88 getfattr -n user.NOISE $file
90 echo -e "\nget the value of the COLOUR EA which was removed earlier"
91 getfattr -n user.COLOUR $file
93 echo -e "\nget the value of the SIZE EA"
94 getfattr -n user.SIZE $file
96 echo -e "\nlist all the EAs again: NOISE, SIZE"
99 echo -e "\nchange the value of the SIZE EA from small to huge"
100 setfattr -n user.SIZE -v huge $file
102 echo -e "\nget the SIZE EA which should now have value huge"
103 getfattr -n user.SIZE $file
105 echo -e "\nlist EAs: NOISE, SIZE"
108 echo -e "\nremove the SIZE EA from foo.$seq"
109 setfattr -x user.SIZE $file
111 echo -e "\nlist EAs: NOISE (SIZE EA has been removed)"
114 echo -e "\ntry removing non-existent EA named woof"
115 setfattr -x user.WOOF $file
117 echo -e "\ntry removing already removed EA SIZE"
118 setfattr -x user.SIZE $file
120 echo -e "\nlist EAs: NOISE"
123 echo -e "\ntry removing already removed EA COLOUR"
124 setfattr -x user.COLOUR $file
126 echo -e "\nlist EAs: NOISE"
129 echo -e "\nremove remaining EA NOISE"
130 setfattr -x user.NOISE $file
132 echo -e "\nlist EAs: should be no EAs left now"
135 echo -e "\nunmount the FS and see if EAs are persistent"
138 echo -e "\nlist EAs: should still be no EAs left"