83440cf110
The legacy part for now is internal/errorsx. It will stay there until I figure out whether it also needs some extra bug fixing. The good part is now in internal/netxlite/errorsx and contains all the logic for mapping errors. We need to further improve upon this logic by writing more thorough integration tests for QUIC. We also need to copy the various dialer, conn, etc adapters that set errors. We will put them inside netxlite and we will generate errors in a way that is less crazy with respect to the major operation. (The idea is to always wrap, given that now we measure in an incremental way and we don't measure every operation together.) Part of https://github.com/ooni/probe/issues/1591
104 lines
4.3 KiB
Go
104 lines
4.3 KiB
Go
// Code generated by go generate; DO NOT EDIT.
|
|
// Generated: 2021-09-07 16:43:08.510432 +0200 CEST m=+0.153127376
|
|
|
|
package errorsx
|
|
|
|
import (
|
|
"io"
|
|
"syscall"
|
|
"testing"
|
|
)
|
|
|
|
func TestToSyscallErr(t *testing.T) {
|
|
if v := classifySyscallError(io.EOF); v != "" {
|
|
t.Fatalf("expected empty string, got '%s'", v)
|
|
}
|
|
if v := classifySyscallError(ECANCELED); v != FailureOperationCanceled {
|
|
t.Fatalf("expected '%s', got '%s'", FailureOperationCanceled, v)
|
|
}
|
|
if v := classifySyscallError(ECONNREFUSED); v != FailureConnectionRefused {
|
|
t.Fatalf("expected '%s', got '%s'", FailureConnectionRefused, v)
|
|
}
|
|
if v := classifySyscallError(ECONNRESET); v != FailureConnectionReset {
|
|
t.Fatalf("expected '%s', got '%s'", FailureConnectionReset, v)
|
|
}
|
|
if v := classifySyscallError(EHOSTUNREACH); v != FailureHostUnreachable {
|
|
t.Fatalf("expected '%s', got '%s'", FailureHostUnreachable, v)
|
|
}
|
|
if v := classifySyscallError(ETIMEDOUT); v != FailureTimedOut {
|
|
t.Fatalf("expected '%s', got '%s'", FailureTimedOut, v)
|
|
}
|
|
if v := classifySyscallError(EAFNOSUPPORT); v != FailureAddressFamilyNotSupported {
|
|
t.Fatalf("expected '%s', got '%s'", FailureAddressFamilyNotSupported, v)
|
|
}
|
|
if v := classifySyscallError(EADDRINUSE); v != FailureAddressInUse {
|
|
t.Fatalf("expected '%s', got '%s'", FailureAddressInUse, v)
|
|
}
|
|
if v := classifySyscallError(EADDRNOTAVAIL); v != FailureAddressNotAvailable {
|
|
t.Fatalf("expected '%s', got '%s'", FailureAddressNotAvailable, v)
|
|
}
|
|
if v := classifySyscallError(EISCONN); v != FailureAlreadyConnected {
|
|
t.Fatalf("expected '%s', got '%s'", FailureAlreadyConnected, v)
|
|
}
|
|
if v := classifySyscallError(EFAULT); v != FailureBadAddress {
|
|
t.Fatalf("expected '%s', got '%s'", FailureBadAddress, v)
|
|
}
|
|
if v := classifySyscallError(EBADF); v != FailureBadFileDescriptor {
|
|
t.Fatalf("expected '%s', got '%s'", FailureBadFileDescriptor, v)
|
|
}
|
|
if v := classifySyscallError(ECONNABORTED); v != FailureConnectionAborted {
|
|
t.Fatalf("expected '%s', got '%s'", FailureConnectionAborted, v)
|
|
}
|
|
if v := classifySyscallError(EALREADY); v != FailureConnectionAlreadyInProgress {
|
|
t.Fatalf("expected '%s', got '%s'", FailureConnectionAlreadyInProgress, v)
|
|
}
|
|
if v := classifySyscallError(EDESTADDRREQ); v != FailureDestinationAddressRequired {
|
|
t.Fatalf("expected '%s', got '%s'", FailureDestinationAddressRequired, v)
|
|
}
|
|
if v := classifySyscallError(EINTR); v != FailureInterrupted {
|
|
t.Fatalf("expected '%s', got '%s'", FailureInterrupted, v)
|
|
}
|
|
if v := classifySyscallError(EINVAL); v != FailureInvalidArgument {
|
|
t.Fatalf("expected '%s', got '%s'", FailureInvalidArgument, v)
|
|
}
|
|
if v := classifySyscallError(EMSGSIZE); v != FailureMessageSize {
|
|
t.Fatalf("expected '%s', got '%s'", FailureMessageSize, v)
|
|
}
|
|
if v := classifySyscallError(ENETDOWN); v != FailureNetworkDown {
|
|
t.Fatalf("expected '%s', got '%s'", FailureNetworkDown, v)
|
|
}
|
|
if v := classifySyscallError(ENETRESET); v != FailureNetworkReset {
|
|
t.Fatalf("expected '%s', got '%s'", FailureNetworkReset, v)
|
|
}
|
|
if v := classifySyscallError(ENETUNREACH); v != FailureNetworkUnreachable {
|
|
t.Fatalf("expected '%s', got '%s'", FailureNetworkUnreachable, v)
|
|
}
|
|
if v := classifySyscallError(ENOBUFS); v != FailureNoBufferSpace {
|
|
t.Fatalf("expected '%s', got '%s'", FailureNoBufferSpace, v)
|
|
}
|
|
if v := classifySyscallError(ENOPROTOOPT); v != FailureNoProtocolOption {
|
|
t.Fatalf("expected '%s', got '%s'", FailureNoProtocolOption, v)
|
|
}
|
|
if v := classifySyscallError(ENOTSOCK); v != FailureNotASocket {
|
|
t.Fatalf("expected '%s', got '%s'", FailureNotASocket, v)
|
|
}
|
|
if v := classifySyscallError(ENOTCONN); v != FailureNotConnected {
|
|
t.Fatalf("expected '%s', got '%s'", FailureNotConnected, v)
|
|
}
|
|
if v := classifySyscallError(EWOULDBLOCK); v != FailureOperationWouldBlock {
|
|
t.Fatalf("expected '%s', got '%s'", FailureOperationWouldBlock, v)
|
|
}
|
|
if v := classifySyscallError(EACCES); v != FailurePermissionDenied {
|
|
t.Fatalf("expected '%s', got '%s'", FailurePermissionDenied, v)
|
|
}
|
|
if v := classifySyscallError(EPROTONOSUPPORT); v != FailureProtocolNotSupported {
|
|
t.Fatalf("expected '%s', got '%s'", FailureProtocolNotSupported, v)
|
|
}
|
|
if v := classifySyscallError(EPROTOTYPE); v != FailureWrongProtocolType {
|
|
t.Fatalf("expected '%s', got '%s'", FailureWrongProtocolType, v)
|
|
}
|
|
if v := classifySyscallError(syscall.Errno(0)); v != "" {
|
|
t.Fatalf("expected empty string, got '%s'", v)
|
|
}
|
|
}
|