From efd156c058ed857d954c6673e2caffb20f319473 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 23 Jul 2025 10:48:14 +0200 Subject: [PATCH] Skip TestSocketXDPGetInfo on EPERM Skip TestSocketXDPGetInfo rather than failing it when the user lacks permissions to create AF_XDP sockets. This allows to run the full test suite as an unprivileged user again. --- socket_xdp_linux_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/socket_xdp_linux_test.go b/socket_xdp_linux_test.go index 4f09487..1eb8a59 100644 --- a/socket_xdp_linux_test.go +++ b/socket_xdp_linux_test.go @@ -4,6 +4,7 @@ package netlink import ( + "errors" "os" "testing" @@ -13,6 +14,9 @@ import ( func TestSocketXDPGetInfo(t *testing.T) { xdpsockfd, err := unix.Socket(unix.AF_XDP, unix.SOCK_RAW, 0) if err != nil { + if errors.Is(err, unix.EPERM) { + t.Skipf("creating AF_XDP socket not permitted") + } t.Fatal(err) } defer unix.Close(xdpsockfd)