@@ -56,20 +56,22 @@ func TestXattr(t *testing.T) {
56
56
xattrs := stringsFromByteSlice (buf [:read ])
57
57
58
58
xattrWant := xattrName
59
- if runtime .GOOS == "freebsd" {
60
- // On FreeBSD, the namespace is stored separately from the xattr
59
+ switch runtime .GOOS {
60
+ case "freebsd" , "netbsd" :
61
+ // On FreeBSD and NetBSD, the namespace is stored separately from the xattr
61
62
// name and Listxattr doesn't return the namespace prefix.
62
63
xattrWant = strings .TrimPrefix (xattrWant , "user." )
63
64
}
64
65
found := false
65
66
for _ , name := range xattrs {
66
67
if name == xattrWant {
67
68
found = true
69
+ break
68
70
}
69
71
}
70
72
71
73
if ! found {
72
- t .Errorf ("Listxattr did not return previously set attribute '%s' " , xattrName )
74
+ t .Errorf ("Listxattr did not return previously set attribute %q in attributes %v " , xattrName , xattrs )
73
75
}
74
76
75
77
// find size
@@ -162,20 +164,22 @@ func TestFdXattr(t *testing.T) {
162
164
xattrs := stringsFromByteSlice (buf [:read ])
163
165
164
166
xattrWant := xattrName
165
- if runtime .GOOS == "freebsd" {
166
- // On FreeBSD, the namespace is stored separately from the xattr
167
+ switch runtime .GOOS {
168
+ case "freebsd" , "netbsd" :
169
+ // On FreeBSD and NetBSD, the namespace is stored separately from the xattr
167
170
// name and Listxattr doesn't return the namespace prefix.
168
171
xattrWant = strings .TrimPrefix (xattrWant , "user." )
169
172
}
170
173
found := false
171
174
for _ , name := range xattrs {
172
175
if name == xattrWant {
173
176
found = true
177
+ break
174
178
}
175
179
}
176
180
177
181
if ! found {
178
- t .Errorf ("Flistxattr did not return previously set attribute '%s' " , xattrName )
182
+ t .Errorf ("Flistxattr did not return previously set attribute %q in attributes %v " , xattrName , xattrs )
179
183
}
180
184
181
185
// find size
0 commit comments