fstests: move test group info to test files
[xfstests-dev.git] / tests / generic / 533
1 #! /bin/bash
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.
6 #
7 # FS QA Test No. 526.
8 #
9 # Simple attr smoke tests for user EAs, dereived from generic/097.
10 #
11 . ./common/preamble
12 _begin_fstest auto quick attr
13
14 file=$TEST_DIR/foo.$seq
15
16 getfattr()
17 {
18         _getfattr --absolute-names "$@" |& _filter_test_dir
19 }
20
21 setfattr()
22 {
23         $SETFATTR_PROG "$@" |& _filter_test_dir
24 }
25
26 # Import common functions.
27 . ./common/attr
28 . ./common/filter
29
30 # real QA test starts here
31 _supported_fs generic
32
33 _require_test
34 _require_attrs
35
36 echo -e "\ncreate file foo.$seq"
37 rm -f $file
38 touch $file
39
40 echo -e "\nshould be no EAs for foo.$seq:"
41 getfattr -d $file
42
43 echo -e "\nset EA <NOISE,woof>:"
44 setfattr -n user.NOISE -v woof $file
45
46 echo -e "\nset EA <COLOUR,blue>:"
47 setfattr -n user.COLOUR -v blue $file
48
49 echo -e "\nset EA <SIZE,small>:"
50 setfattr -n user.SIZE -v small $file
51
52 echo -e "\nlist the EAs for foo.$seq: NOISE, COLOUR, SIZE"
53 getfattr -d $file
54
55 echo -e "\ncheck the list again for foo.$seq"
56 getfattr -d $file
57
58 echo -e "\nunmount the FS and see if EAs are persistent"
59 _test_cycle_mount
60
61 echo -e "\ncheck the list again for foo.$seq after umount/mount"
62 getfattr -d $file
63
64 echo -e "\nremove the COLOUR EA on foo.$seq"
65 setfattr -x user.COLOUR $file
66
67 echo -e "\nlist EAs for foo.$seq: NOISE, SIZE"
68 getfattr -d $file
69
70 echo -e "\nget the value of the NOISE EA"
71 getfattr -n user.NOISE $file
72
73 echo -e "\nget the value of the COLOUR EA which was removed earlier"
74 getfattr -n user.COLOUR $file
75
76 echo -e "\nget the value of the SIZE EA"
77 getfattr -n user.SIZE $file
78
79 echo -e "\nlist all the EAs again: NOISE, SIZE"
80 getfattr -d $file
81
82 echo -e "\nchange the value of the SIZE EA from small to huge"
83 setfattr -n user.SIZE -v huge $file
84
85 echo -e "\nget the SIZE EA which should now have value huge"
86 getfattr -n user.SIZE $file
87
88 echo -e "\nlist EAs: NOISE, SIZE"
89 getfattr -d $file
90
91 echo -e "\nremove the SIZE EA from foo.$seq"
92 setfattr -x user.SIZE $file
93
94 echo -e "\nlist EAs: NOISE (SIZE EA has been removed)"
95 getfattr -d $file
96
97 echo -e "\ntry removing non-existent EA named woof"
98 setfattr -x user.WOOF $file
99
100 echo -e "\ntry removing already removed EA SIZE"
101 setfattr -x user.SIZE $file
102
103 echo -e "\nlist EAs: NOISE"
104 getfattr -d $file
105
106 echo -e "\ntry removing already removed EA COLOUR"
107 setfattr -x user.COLOUR $file
108
109 echo -e "\nlist EAs: NOISE"
110 getfattr -d $file
111
112 echo -e "\nremove remaining EA NOISE"
113 setfattr -x user.NOISE $file
114
115 echo -e "\nlist EAs: should be no EAs left now"
116 getfattr -d $file
117
118 echo -e "\nunmount the FS and see if EAs are persistent"
119 _test_cycle_mount
120
121 echo -e "\nlist EAs: should still be no EAs left"
122 getfattr -d $file
123
124 # success, all done
125 status=0
126 exit