aboutsummaryrefslogtreecommitdiff
path: root/tests/reverse
diff options
context:
space:
mode:
authorJakob Unterwurzacher2025-11-22 21:44:51 +0100
committerJakob Unterwurzacher2025-11-22 21:51:27 +0100
commit75247e14612d2e71311aeeb7060ea704c96c3154 (patch)
tree7146ada2875fd22284600c379425c8f47d7de366 /tests/reverse
parented1c5e4a9f5ce1921f3ec03b32e591ce828ec5b9 (diff)
reverse: fix TestXattrList failure
On my Fedora I used to get this failure: --- FAIL: TestXattrList (0.00s) xattr_test.go:52: wrong number of names, want=20 have=21 xattr_test.go:58: mismatch on attr "security.selinux": valA = "", valC = "xxxxxxxxyyyyyyyyyyyyyyyzzzzzzzzzzzzz" First step is to print the actual value using xattr.LGet. This improves the error message to this: --- FAIL: TestXattrList (0.00s) xattr_test.go:53: wrong number of names, want=20 have=21 xattr_test.go:59: mismatch on attr "security.selinux": valA = "", valC = "system_u:object_r:fusefs_t:s0\x00" 2nd step is to ignore "security." attribs as we have no control over them.
Diffstat (limited to 'tests/reverse')
-rw-r--r--tests/reverse/xattr_test.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/reverse/xattr_test.go b/tests/reverse/xattr_test.go
index df7724f..406d055 100644
--- a/tests/reverse/xattr_test.go
+++ b/tests/reverse/xattr_test.go
@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
+ "strings"
"syscall"
"testing"
@@ -46,7 +47,12 @@ func TestXattrList(t *testing.T) {
}
namesC := map[string]string{}
for _, n := range tmp {
- namesC[n] = string(val)
+ if strings.HasPrefix(n, "security.") {
+ t.Logf("Ignoring xattr %q", n)
+ continue
+ }
+ v, _ := xattr.LGet(fnC, n)
+ namesC[n] = string(v)
}
if len(namesA) != len(namesC) {
t.Errorf("wrong number of names, want=%d have=%d", len(namesA), len(namesC))