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