CMSIS-Driver Validation  
Driver Validation
Socket testing

Due to limitations of WiFi modules and their Software Development Kits (SDK), often it is not possible to comply with CMSIS-Driver BSD rules regarding function behavior or function return codes. Hence, the WiFi Driver tests accept alternative error codes and report them as Warnings and considers certain error codes as acceptable for certain functions. Exceptions to BSD-strict error codes and functionality are written below:

WiFi socket deviations from the BSD-strict specification

  1. SocketBind
    • bind socket to same address again
      BSD-strict expected return code ARM_SOCKET_EINVAL
      non BSD-strict accepted return codes: 0 or ARM_SOCKET_ERROR
    • bind another socket to used address
      BSD-strict expected return code ARM_SOCKET_EADDRINUSE
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • bind on closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code ARM_SOCKET_ERROR
  2. SocketListen
    • listen on already listening socket
      BSD-strict expected return code ARM_SOCKET_EINVAL
      non BSD-strict accepted return codes: 0 or ARM_SOCKET_ERROR
    • listen on unbound socket
      BSD-strict expected return code ARM_SOCKET_EINVAL
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • listen on closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • listen on datagram socket
      BSD-strict expected return code ARM_SOCKET_ENOTSUP
      non BSD-strict accepted return code ARM_SOCKET_ERROR
  3. SocketAccept
    • receive on disconnected socket
      BSD-strict expected return code ARM_SOCKET_ECONNRESET
      non BSD-strict accepted return codes: ARM_SOCKET_EAGAIN or ARM_SOCKET_ERROR
    • accept on closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • listen on datagram socket
      BSD-strict expected return code ARM_SOCKET_ENOTSUP
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • accept on datagram socket
      BSD-strict expected return code ARM_SOCKET_ENOTSUP
      non BSD-strict accepted return code ARM_SOCKET_ERROR
  4. SocketConnect
    • connect socket to same address again
      BSD-strict expected return code ARM_SOCKET_EISCONN
      non BSD-strict accepted return codes: 0 or ARM_SOCKET_ERROR
    • bind on connected socket
      BSD-strict expected return code ARM_SOCKET_EISCONN
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • connect on closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • connect to non-existent port
      BSD-strict expected return code ARM_SOCKET_ECONNREFUSED
      non BSD-strict accepted return codes: ARM_SOCKET_ETIMEDOUT or ARM_SOCKET_ERROR
    • connect to non-existent stream server
      BSD-strict expected return code ARM_SOCKET_ETIMEDOUT
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • connect on listening socket
      BSD-strict expected return code ARM_SOCKET_EINVAL
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • connect datagram socket to unspecified address (0.0.0.0)
      BSD-strict expected return code 0
      non BSD-strict accepted return codes: ARM_SOCKET_EINVAL or ARM_SOCKET_ERROR (special case that deletes the socket destination & filtering address)
  5. SocketRecv
    • recv on closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • recv on created socket
      BSD-strict expected return code ARM_SOCKET_ENOTCONN
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • recv on bound socket
      BSD-strict expected return code ARM_SOCKET_ENOTCONN
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • recv on listening socket
      BSD-strict expected return code ARM_SOCKET_ENOTCONN
      non BSD-strict accepted return code ARM_SOCKET_ERROR
  6. SocketRecvFrom
    • recvfrom on closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code ARM_SOCKET_ERROR
  7. SocketSend
    • send on closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • send on disconnected socket
      BSD-strict expected return code ARM_SOCKET_ECONNRESET
      non BSD-strict accepted return codes: >0 or ARM_SOCKET_EAGAIN or ARM_SOCKET_ERROR
    • send on created socket
      BSD-strict expected return code ARM_SOCKET_ENOTCONN
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • send on bound socket
      BSD-strict expected return code ARM_SOCKET_ENOTCONN
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • send on listening socket
      BSD-strict expected return code ARM_SOCKET_ENOTCONN
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • send on closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code ARM_SOCKET_ERROR
  8. SocketSendTo
    • sendto on closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code ARM_SOCKET_ERROR
  9. SocketGetSockName
    • getsockname on closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • getsockname on unbound socket
      BSD-strict expected return code ARM_SOCKET_EINVAL
      non BSD-strict accepted return code ARM_SOCKET_ERROR
  10. SocketGetPeerName
    • getpeername on closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • getpeername on created socket
      BSD-strict expected return code ARM_SOCKET_ENOTCONN
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • getpeername on bound socket
      BSD-strict expected return code ARM_SOCKET_ENOTCONN
      non BSD-strict accepted return code ARM_SOCKET_ERROR
    • getpeername on listening socket
      BSD-strict expected return code ARM_SOCKET_ENOTCONN
      non BSD-strict accepted return code ARM_SOCKET_ERROR
  11. SocketGetOpt
    • getsockopt on closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code ARM_SOCKET_ERROR
  12. SocketSetOpt
    • setsockopt on closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code ARM_SOCKET_ERROR
  13. SocketClose
    • close already closed socket
      BSD-strict expected return code ARM_SOCKET_ESOCK
      non BSD-strict accepted return code 0
  14. SocketGetHostByName
    • gethostbyname for non-existing host
      BSD-strict expected return code ARM_SOCKET_EHOSTNOTFOUND
      non BSD-strict accepted return code ARM_SOCKET_ERROR