mirror of
https://github.com/golang/sys.git
synced 2026-02-08 19:56:04 +03:00
unix: skip Linux/L2TP tests for kernels without L2TP support
Creating an IPPROTO_L2TP socket requires that the kernel's l2tp_ip or l2tp_ip6 module is loaded. If these modules are not running, the socket call will return with error code EPROTONOSUPPORT. To allow tests to run without the L2TP modules loaded, skip tests where the unix.Socket() call returns EPROTONOSUPPORT. Fixes golang/go#37787
This commit is contained in:
@@ -154,7 +154,12 @@ func Test_anyToSockaddr(t *testing.T) {
|
||||
var err error
|
||||
if tt.skt.domain != 0 {
|
||||
fd, err = Socket(tt.skt.domain, tt.skt.typ, tt.skt.protocol)
|
||||
if err != nil {
|
||||
// Some sockaddr types need specific kernel modules running: if these
|
||||
// are not present we'll get EPROTONOSUPPORT back when trying to create
|
||||
// the socket. Skip the test in this situation.
|
||||
if err == EPROTONOSUPPORT {
|
||||
t.Skip("socket family/protocol not supported by kernel")
|
||||
} else if err != nil {
|
||||
t.Fatalf("socket(%v): %v", tt.skt, err)
|
||||
}
|
||||
defer func() {
|
||||
|
||||
Reference in New Issue
Block a user