diff options
| author | Jakob Unterwurzacher | 2025-11-22 21:44:51 +0100 |
|---|---|---|
| committer | Jakob Unterwurzacher | 2025-11-22 21:51:27 +0100 |
| commit | 75247e14612d2e71311aeeb7060ea704c96c3154 (patch) | |
| tree | 7146ada2875fd22284600c379425c8f47d7de366 /tests/reverse | |
| parent | ed1c5e4a9f5ce1921f3ec03b32e591ce828ec5b9 (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.go | 8 |
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)) |
