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 _begin_fstest auto quick attr
14 file=$TEST_DIR/foo.$seq
18 _getfattr --absolute-names "$@" |& _filter_test_dir
23 $SETFATTR_PROG "$@" |& _filter_test_dir
26 # Import common functions.
30 # real QA test starts here
36 echo -e "\ncreate file foo.$seq"
40 echo -e "\nshould be no EAs for foo.$seq:"
43 echo -e "\nset EA <NOISE,woof>:"
44 setfattr -n user.NOISE -v woof $file
46 echo -e "\nset EA <COLOUR,blue>:"
47 setfattr -n user.COLOUR -v blue $file
49 echo -e "\nset EA <SIZE,small>:"
50 setfattr -n user.SIZE -v small $file
52 echo -e "\nlist the EAs for foo.$seq: NOISE, COLOUR, SIZE"
55 echo -e "\ncheck the list again for foo.$seq"
58 echo -e "\nunmount the FS and see if EAs are persistent"
61 echo -e "\ncheck the list again for foo.$seq after umount/mount"
64 echo -e "\nremove the COLOUR EA on foo.$seq"
65 setfattr -x user.COLOUR $file
67 echo -e "\nlist EAs for foo.$seq: NOISE, SIZE"
70 echo -e "\nget the value of the NOISE EA"
71 getfattr -n user.NOISE $file
73 echo -e "\nget the value of the COLOUR EA which was removed earlier"
74 getfattr -n user.COLOUR $file
76 echo -e "\nget the value of the SIZE EA"
77 getfattr -n user.SIZE $file
79 echo -e "\nlist all the EAs again: NOISE, SIZE"
82 echo -e "\nchange the value of the SIZE EA from small to huge"
83 setfattr -n user.SIZE -v huge $file
85 echo -e "\nget the SIZE EA which should now have value huge"
86 getfattr -n user.SIZE $file
88 echo -e "\nlist EAs: NOISE, SIZE"
91 echo -e "\nremove the SIZE EA from foo.$seq"
92 setfattr -x user.SIZE $file
94 echo -e "\nlist EAs: NOISE (SIZE EA has been removed)"
97 echo -e "\ntry removing non-existent EA named woof"
98 setfattr -x user.WOOF $file
100 echo -e "\ntry removing already removed EA SIZE"
101 setfattr -x user.SIZE $file
103 echo -e "\nlist EAs: NOISE"
106 echo -e "\ntry removing already removed EA COLOUR"
107 setfattr -x user.COLOUR $file
109 echo -e "\nlist EAs: NOISE"
112 echo -e "\nremove remaining EA NOISE"
113 setfattr -x user.NOISE $file
115 echo -e "\nlist EAs: should be no EAs left now"
118 echo -e "\nunmount the FS and see if EAs are persistent"
121 echo -e "\nlist EAs: should still be no EAs left"